base: Make base::CommandLine thread safe [chromium/src : main]

0 views
Skip to first unread message

Nathan Hebert (Gerrit)

unread,
1:51 PM (4 hours ago) 1:51 PM
to Daniel Cheng, chromotin...@chromium.org, Enterprise Policy Reviews, Chromium LUCI CQ, chromium...@chromium.org, chromeos-kio...@google.com
Attention needed from Daniel Cheng

Nathan Hebert added 2 comments

Patchset-level comments
File-level comment, Patchset 5:
Nathan Hebert . resolved

Hmm. I'm looking around Chrome at the usage and see some places where the `argv()` and `GetSwitches()` changes can cause problems. I'll see what the extent of the issues are and re-evaluate. Sorry for the noise.

Nathan Hebert

Done. I added helper classes for making argv() and GetSwitches() easier to use while still being thread safe.

File-level comment, Patchset 9 (Latest):
Nathan Hebert . unresolved

Hi Daniel,

Sorry for some noise earlier this week. I am adding you as an owner of base::command_line. Feel free to suggest another reviewer for the `base::` code if needed.

Best regards,
Nathan

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ifc379c770883fb85f333c4829fed5ff2afadb1ef
Gerrit-Change-Number: 7857372
Gerrit-PatchSet: 9
Gerrit-Owner: Nathan Hebert <nhe...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Nathan Hebert <nhe...@chromium.org>
Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Thu, 21 May 2026 17:51:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nathan Hebert <nhe...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Nathan Hebert (Gerrit)

unread,
2:23 PM (4 hours ago) 2:23 PM
to Daniel Cheng, chromotin...@chromium.org, Enterprise Policy Reviews, Chromium LUCI CQ, chromium...@chromium.org, chromeos-kio...@google.com
Attention needed from Daniel Cheng

Nathan Hebert added 1 comment

File base/command_line.h
Line 96, Patchset 9 (Latest): operator StringVector() && { return std::move(argv_); }
Nathan Hebert . unresolved

👍, ClangTidy. I am removing the implicit conversions.

Gerrit-Comment-Date: Thu, 21 May 2026 18:23:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Daniel Cheng (Gerrit)

unread,
4:51 PM (1 hour ago) 4:51 PM
to Nathan Hebert, Greg Thompson, Daniel Cheng, chromotin...@chromium.org, Enterprise Policy Reviews, Chromium LUCI CQ, chromium...@chromium.org, chromeos-kio...@google.com
Attention needed from Nathan Hebert

Daniel Cheng added 1 comment

Patchset-level comments
File-level comment, Patchset 9 (Latest):
Daniel Cheng . unresolved

Sorry, I'd rather not land this. It's only a partial solution at best and introduces potential contention/jank between threads. While it might prevent or reduce the crashes, it doesn't really address other issues caused by this sort of potentially racy global mutation, e.g. if one thread is setting a flag on the singleton, and another thread is trying to use the singleton at the same time, whether or not the second thread sees the flag is non-deterministic.

@g...@chromium.org I guess we should seriously consider projects to make the global singleton read-only as you mentioned a few weeks ago...

Open in Gerrit

Related details

Attention is currently required from:
  • Nathan Hebert
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ifc379c770883fb85f333c4829fed5ff2afadb1ef
Gerrit-Change-Number: 7857372
Gerrit-PatchSet: 9
Gerrit-Owner: Nathan Hebert <nhe...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Nathan Hebert <nhe...@chromium.org>
Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
Gerrit-CC: Greg Thompson <g...@chromium.org>
Gerrit-Attention: Nathan Hebert <nhe...@chromium.org>
Gerrit-Comment-Date: Thu, 21 May 2026 20:51:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Nathan Hebert (Gerrit)

unread,
4:56 PM (1 hour ago) 4:56 PM
to Greg Thompson, Daniel Cheng, chromotin...@chromium.org, Enterprise Policy Reviews, Chromium LUCI CQ, chromium...@chromium.org, chromeos-kio...@google.com
Attention needed from Daniel Cheng

Nathan Hebert added 1 comment

Patchset-level comments
Daniel Cheng . unresolved

Sorry, I'd rather not land this. It's only a partial solution at best and introduces potential contention/jank between threads. While it might prevent or reduce the crashes, it doesn't really address other issues caused by this sort of potentially racy global mutation, e.g. if one thread is setting a flag on the singleton, and another thread is trying to use the singleton at the same time, whether or not the second thread sees the flag is non-deterministic.

@g...@chromium.org I guess we should seriously consider projects to make the global singleton read-only as you mentioned a few weeks ago...

Nathan Hebert

Thanks for the response. I agree that this could result in logic race conditions.

I was talking with another person in my office before lunch today, and started looking at what it would take to make `base::CommandLine::ForCurrentProcess()` return a const pointer. I can share my findings later today when I finish tracking down each of the places where the Chrome code breaks CommandLine const-ness.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ifc379c770883fb85f333c4829fed5ff2afadb1ef
Gerrit-Change-Number: 7857372
Gerrit-PatchSet: 9
Gerrit-Owner: Nathan Hebert <nhe...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Nathan Hebert <nhe...@chromium.org>
Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
Gerrit-CC: Greg Thompson <g...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Thu, 21 May 2026 20:56:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages