Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Issue 2110083007: Updating FeatureList default initialization pattern (Closed)

Created:
4 years, 5 months ago by joedow
Modified:
4 years, 5 months ago
CC:
chromium-reviews, chromoting-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Updating FeatureList default initialization pattern FeatureList currently expects a singleton to be manually set by all code which uses it. This works fine in the browser where it is intialized and in unit tests which use a default initializer, however for code outside the browser which relies on the various components in Chromium, this causes their code to crash. An example of this is CL: https://codereview.chromium.org/2101283004/ This was an innocuous change in a component which CRD relied on. Since the unit tests are set up to never catch these kind of problems, our component started crashing and we had to investigate to figure out the root cause. This change updates the feature and trial checks to initialize the singleton if it was not already initialized. If a caller tries to re-initialize the singleton after that, the init code will DCHECK as this represents a race condition and we want to ensure consistency for the callers who rely on these checks being accurate. BUG=624879 Committed: https://crrev.com/958f0473b8039a057b0e31412c2acae7dfda39cd Cr-Commit-Position: refs/heads/master@{#404243}

Patch Set 1 #

Patch Set 2 : Fixing some unittest expectations #

Patch Set 3 : Fixing some unit test comments #

Patch Set 4 : Fixing a DCHECK vs. CHECK problem #

Total comments: 6

Patch Set 5 : Adding some thread safety. #

Patch Set 6 : Updating the init check and removing lock. #

Patch Set 7 : Fixing a windows build issue. #

Total comments: 10

Patch Set 8 : Addressing feedback #

Total comments: 4

Patch Set 9 : Addressing feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+27 lines, -7 lines) Patch
M base/feature_list.h View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M base/feature_list.cc View 1 2 3 4 5 6 7 8 5 chunks +14 lines, -5 lines 0 comments Download
M base/feature_list_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +11 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (5 generated)
joedow
This is the FeatureList initialization change we dicsussed today, PTAL! Thanks, Joe
4 years, 5 months ago (2016-06-30 23:26:47 UTC) #3
joedow
Fixing a unit test comment.
4 years, 5 months ago (2016-06-30 23:33:55 UTC) #4
joedow
Fixing a DCHECK/CHECK problem.
4 years, 5 months ago (2016-07-01 00:28:22 UTC) #5
joedow
Ping!
4 years, 5 months ago (2016-07-01 15:48:11 UTC) #6
Sergey Ulanov
https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc File base/feature_list.cc (right): https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc#newcode134 base/feature_list.cc:134: CHECK(InitializeInstance(std::string(), std::string())); As discussed offline I think the problem ...
4 years, 5 months ago (2016-07-01 21:36:11 UTC) #7
Alexei Svitkine (slow)
https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc File base/feature_list.cc (right): https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc#newcode134 base/feature_list.cc:134: CHECK(InitializeInstance(std::string(), std::string())); On 2016/07/01 21:36:10, Sergey Ulanov wrote: > ...
4 years, 5 months ago (2016-07-04 15:50:06 UTC) #8
Sergey Ulanov
https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc File base/feature_list.cc (right): https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc#newcode134 base/feature_list.cc:134: CHECK(InitializeInstance(std::string(), std::string())); On 2016/07/04 15:50:06, Alexei Svitkine (very slow) ...
4 years, 5 months ago (2016-07-04 16:52:53 UTC) #9
Alexei Svitkine (slow)
https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc File base/feature_list.cc (right): https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc#newcode134 base/feature_list.cc:134: CHECK(InitializeInstance(std::string(), std::string())); On 2016/07/04 16:52:53, Sergey Ulanov wrote: > ...
4 years, 5 months ago (2016-07-04 16:55:55 UTC) #10
joedow
I've updated the CL based on the feedback I've received, PTAL! Thanks, Joe https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc File ...
4 years, 5 months ago (2016-07-05 21:05:56 UTC) #11
Alexei Svitkine (slow)
https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc File base/feature_list.cc (right): https://codereview.chromium.org/2110083007/diff/60001/base/feature_list.cc#newcode134 base/feature_list.cc:134: CHECK(InitializeInstance(std::string(), std::string())); On 2016/07/05 21:05:56, joedow wrote: > On ...
4 years, 5 months ago (2016-07-05 21:11:34 UTC) #12
joedow
Addressed feedback, PTAL! https://codereview.chromium.org/2110083007/diff/120001/base/feature_list.cc File base/feature_list.cc (right): https://codereview.chromium.org/2110083007/diff/120001/base/feature_list.cc#newcode27 base/feature_list.cc:27: bool initialized_from_accessor = false; On 2016/07/05 ...
4 years, 5 months ago (2016-07-05 22:24:20 UTC) #13
Sergey Ulanov
lgtm https://codereview.chromium.org/2110083007/diff/140001/base/feature_list.cc File base/feature_list.cc (right): https://codereview.chromium.org/2110083007/diff/140001/base/feature_list.cc#newcode172 base/feature_list.cc:172: CHECK(!g_initialized_from_accessor); nit: I don't think this needs to ...
4 years, 5 months ago (2016-07-06 19:11:51 UTC) #14
Alexei Svitkine (slow)
https://codereview.chromium.org/2110083007/diff/120001/base/feature_list.cc File base/feature_list.cc (right): https://codereview.chromium.org/2110083007/diff/120001/base/feature_list.cc#newcode145 base/feature_list.cc:145: if (!GetInstance()) { On 2016/07/05 22:24:20, joedow wrote: > ...
4 years, 5 months ago (2016-07-06 19:59:06 UTC) #15
joedow
PTAL! https://codereview.chromium.org/2110083007/diff/120001/base/feature_list.cc File base/feature_list.cc (right): https://codereview.chromium.org/2110083007/diff/120001/base/feature_list.cc#newcode145 base/feature_list.cc:145: if (!GetInstance()) { On 2016/07/06 19:59:06, Alexei Svitkine ...
4 years, 5 months ago (2016-07-07 03:53:02 UTC) #16
Alexei Svitkine (slow)
lgtm
4 years, 5 months ago (2016-07-07 16:28:35 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2110083007/160001
4 years, 5 months ago (2016-07-07 18:46:49 UTC) #20
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 5 months ago (2016-07-07 22:09:08 UTC) #21
commit-bot: I haz the power
CQ bit was unchecked.
4 years, 5 months ago (2016-07-07 22:09:15 UTC) #22
commit-bot: I haz the power
4 years, 5 months ago (2016-07-07 22:11:18 UTC) #24
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/958f0473b8039a057b0e31412c2acae7dfda39cd
Cr-Commit-Position: refs/heads/master@{#404243}

Powered by Google App Engine
This is Rietveld 408576698