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

Issue 256143006: Refactor MetricsStateManager class out of MetricsService. (Closed)

Created:
6 years, 7 months ago by Alexei Svitkine (slow)
Modified:
6 years, 7 months ago
CC:
chromium-reviews, Ilya Sherman, jar (doing other things), asvitkine+watch_chromium.org, Steven Holte, sky
Visibility:
Public.

Description

Refactor MetricsStateManager class out of MetricsService. The new class is responsible for managing various MetricsService state prefs, such as client id, low entropy source and the UMA opt-in state, as well as the cloned install detector. Also, moves IsMetricsReportingEnabled() from chrome_browser_main.cc to the new class as well as changing a couple MetricsService browser tests to instead be unit tests of the new class. BUG=368413 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=268232

Patch Set 1 : #

Patch Set 2 : #

Total comments: 10

Patch Set 3 : #

Total comments: 56

Patch Set 4 : #

Total comments: 6

Patch Set 5 : #

Patch Set 6 : #

Total comments: 2

Patch Set 7 : #

Patch Set 8 : #

Total comments: 6

Patch Set 9 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+596 lines, -445 lines) Patch
M chrome/browser/chrome_browser_main.h View 1 2 3 4 5 6 7 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/browser/chrome_browser_main.cc View 1 2 3 4 5 6 7 8 4 chunks +10 lines, -41 lines 0 comments Download
M chrome/browser/metrics/cloned_install_detector_unittest.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/metrics/metrics_service.h View 1 2 3 4 5 6 7 8 11 chunks +20 lines, -72 lines 0 comments Download
M chrome/browser/metrics/metrics_service.cc View 1 2 3 4 5 6 7 17 chunks +31 lines, -175 lines 0 comments Download
M chrome/browser/metrics/metrics_service_browsertest.cc View 1 2 3 4 5 6 7 4 chunks +2 lines, -26 lines 0 comments Download
M chrome/browser/metrics/metrics_service_unittest.cc View 1 2 3 4 5 6 7 6 chunks +11 lines, -121 lines 0 comments Download
A chrome/browser/metrics/metrics_state_manager.h View 1 2 3 4 5 6 7 8 1 chunk +124 lines, -0 lines 0 comments Download
A chrome/browser/metrics/metrics_state_manager.cc View 1 2 3 4 5 6 1 chunk +233 lines, -0 lines 0 comments Download
A chrome/browser/metrics/metrics_state_manager_unittest.cc View 1 2 3 4 5 1 chunk +160 lines, -0 lines 0 comments Download
M chrome/browser/prefs/browser_prefs.cc View 1 2 3 4 5 6 7 3 chunks +0 lines, -4 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 35 (0 generated)
Alexei Svitkine (slow)
Ilya, Jesse can you take an initial look? (The two patchsets are identical in content, ...
6 years, 7 months ago (2014-04-29 20:55:02 UTC) #1
Alexei Svitkine (slow)
friendly ping
6 years, 7 months ago (2014-05-01 15:41:03 UTC) #2
jwd
https://codereview.chromium.org/256143006/diff/140001/chrome/browser/metrics/metrics_service.h File chrome/browser/metrics/metrics_service.h (right): https://codereview.chromium.org/256143006/diff/140001/chrome/browser/metrics/metrics_service.h#newcode175 chrome/browser/metrics/metrics_service.h:175: // Returns the preferred entropy provider used to seed ...
6 years, 7 months ago (2014-05-01 15:51:13 UTC) #3
Alexei Svitkine (slow)
https://codereview.chromium.org/256143006/diff/140001/chrome/browser/metrics/metrics_service.h File chrome/browser/metrics/metrics_service.h (right): https://codereview.chromium.org/256143006/diff/140001/chrome/browser/metrics/metrics_service.h#newcode175 chrome/browser/metrics/metrics_service.h:175: // Returns the preferred entropy provider used to seed ...
6 years, 7 months ago (2014-05-01 18:01:45 UTC) #4
Ilya Sherman
Sorry, I started to look at this last night, but then got a little scared ...
6 years, 7 months ago (2014-05-01 21:52:18 UTC) #5
Alexei Svitkine (slow)
On 2014/05/01 21:52:18, Ilya Sherman wrote: > Sorry, I started to look at this last ...
6 years, 7 months ago (2014-05-01 21:55:54 UTC) #6
Ilya Sherman
https://codereview.chromium.org/256143006/diff/180001/chrome/browser/chrome_browser_main.cc File chrome/browser/chrome_browser_main.cc (right): https://codereview.chromium.org/256143006/diff/180001/chrome/browser/chrome_browser_main.cc#newcode638 chrome/browser/chrome_browser_main.cc:638: browser_process_->system_request_context()); Hmm, are you sure that it's safe to ...
6 years, 7 months ago (2014-05-02 05:12:37 UTC) #7
Alexei Svitkine (slow)
+cc holte for Android RAPPOR change Thanks for the detailed comments! https://codereview.chromium.org/256143006/diff/180001/chrome/browser/chrome_browser_main.cc File chrome/browser/chrome_browser_main.cc (right): ...
6 years, 7 months ago (2014-05-02 15:21:46 UTC) #8
Alexei Svitkine (slow)
https://codereview.chromium.org/256143006/diff/180001/chrome/browser/chrome_browser_main.cc File chrome/browser/chrome_browser_main.cc (right): https://codereview.chromium.org/256143006/diff/180001/chrome/browser/chrome_browser_main.cc#newcode638 chrome/browser/chrome_browser_main.cc:638: browser_process_->system_request_context()); On 2014/05/02 15:21:46, Alexei Svitkine wrote: > On ...
6 years, 7 months ago (2014-05-02 15:31:15 UTC) #9
Ilya Sherman
https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_service.cc File chrome/browser/metrics/metrics_service.cc (right): https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_service.cc#newcode467 chrome/browser/metrics/metrics_service.cc:467: g_browser_process->local_state())), On 2014/05/02 15:21:46, Alexei Svitkine wrote: > On ...
6 years, 7 months ago (2014-05-02 19:35:06 UTC) #10
Alexei Svitkine (slow)
https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_service.h File chrome/browser/metrics/metrics_service.h (right): https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_service.h#newcode149 chrome/browser/metrics/metrics_service.h:149: void Start(); On 2014/05/02 19:35:06, Ilya Sherman wrote: > ...
6 years, 7 months ago (2014-05-02 20:21:31 UTC) #11
Ilya Sherman
https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_service.h File chrome/browser/metrics/metrics_service.h (right): https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_service.h#newcode149 chrome/browser/metrics/metrics_service.h:149: void Start(); On 2014/05/02 20:21:31, Alexei Svitkine wrote: > ...
6 years, 7 months ago (2014-05-02 20:30:05 UTC) #12
Steven Holte
https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_state_manager.h File chrome/browser/metrics/metrics_state_manager.h (right): https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_state_manager.h#newcode30 chrome/browser/metrics/metrics_state_manager.h:30: bool IsMetricsReportingEnabled(); On 2014/05/02 19:35:06, Ilya Sherman wrote: > ...
6 years, 7 months ago (2014-05-02 20:39:01 UTC) #13
Alexei Svitkine (slow)
https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_state_manager.h File chrome/browser/metrics/metrics_state_manager.h (right): https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_state_manager.h#newcode30 chrome/browser/metrics/metrics_state_manager.h:30: bool IsMetricsReportingEnabled(); On 2014/05/02 20:39:01, Steven Holte wrote: > ...
6 years, 7 months ago (2014-05-02 20:45:50 UTC) #14
Ilya Sherman
https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_state_manager.h File chrome/browser/metrics/metrics_state_manager.h (right): https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_state_manager.h#newcode30 chrome/browser/metrics/metrics_state_manager.h:30: bool IsMetricsReportingEnabled(); On 2014/05/02 20:45:51, Alexei Svitkine wrote: > ...
6 years, 7 months ago (2014-05-02 20:49:47 UTC) #15
Alexei Svitkine (slow)
Thanks, PTAL! https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_state_manager.h File chrome/browser/metrics/metrics_state_manager.h (right): https://codereview.chromium.org/256143006/diff/180001/chrome/browser/metrics/metrics_state_manager.h#newcode30 chrome/browser/metrics/metrics_state_manager.h:30: bool IsMetricsReportingEnabled(); On 2014/05/02 20:49:48, Ilya Sherman ...
6 years, 7 months ago (2014-05-02 21:49:52 UTC) #16
Ilya Sherman
LGTM. Thanks, Alexei! https://codereview.chromium.org/256143006/diff/300001/chrome/browser/metrics/metrics_state_manager.cc File chrome/browser/metrics/metrics_state_manager.cc (right): https://codereview.chromium.org/256143006/diff/300001/chrome/browser/metrics/metrics_state_manager.cc#newcode26 chrome/browser/metrics/metrics_state_manager.cc:26: nit: Spurious newline.
6 years, 7 months ago (2014-05-02 23:12:02 UTC) #17
jwd
lgtm
6 years, 7 months ago (2014-05-05 13:52:38 UTC) #18
Alexei Svitkine (slow)
Thanks! +sky for chrome/ OWNERS https://codereview.chromium.org/256143006/diff/300001/chrome/browser/metrics/metrics_state_manager.cc File chrome/browser/metrics/metrics_state_manager.cc (right): https://codereview.chromium.org/256143006/diff/300001/chrome/browser/metrics/metrics_state_manager.cc#newcode26 chrome/browser/metrics/metrics_state_manager.cc:26: On 2014/05/02 23:12:03, Ilya ...
6 years, 7 months ago (2014-05-05 14:10:43 UTC) #19
Alexei Svitkine (slow)
Also, +cc rohitrao@ since this is changing chrome_browser_main.cc which iOS has a different version of.
6 years, 7 months ago (2014-05-05 14:21:22 UTC) #20
Alexei Svitkine (slow)
Looks like sky@ is busy today according to his calendar, trying another reviewer for chrome/ ...
6 years, 7 months ago (2014-05-05 15:45:32 UTC) #21
Nico
stampy lgtm https://codereview.chromium.org/256143006/diff/320002/chrome/browser/chrome_browser_main.cc File chrome/browser/chrome_browser_main.cc (right): https://codereview.chromium.org/256143006/diff/320002/chrome/browser/chrome_browser_main.cc#newcode637 chrome/browser/chrome_browser_main.cc:637: // currently disabled there. Is there a ...
6 years, 7 months ago (2014-05-05 15:59:11 UTC) #22
Alexei Svitkine (slow)
https://codereview.chromium.org/256143006/diff/320002/chrome/browser/chrome_browser_main.cc File chrome/browser/chrome_browser_main.cc (right): https://codereview.chromium.org/256143006/diff/320002/chrome/browser/chrome_browser_main.cc#newcode637 chrome/browser/chrome_browser_main.cc:637: // currently disabled there. On 2014/05/05 15:59:12, Nico wrote: ...
6 years, 7 months ago (2014-05-05 16:30:24 UTC) #23
Alexei Svitkine (slow)
The CQ bit was checked by asvitkine@chromium.org
6 years, 7 months ago (2014-05-05 16:30:32 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/asvitkine@chromium.org/256143006/350001
6 years, 7 months ago (2014-05-05 16:34:16 UTC) #25
commit-bot: I haz the power
Change committed as 268232
6 years, 7 months ago (2014-05-05 18:45:00 UTC) #26
Alexei Svitkine (slow)
Hmm, this got reverted because apparently it hit the static initializers check. The only thing ...
6 years, 7 months ago (2014-05-05 19:58:58 UTC) #27
Alexei Svitkine (slow)
On 2014/05/05 19:58:58, Alexei Svitkine wrote: > Hmm, this got reverted because apparently it hit ...
6 years, 7 months ago (2014-05-05 20:00:22 UTC) #28
miu
On 2014/05/05 20:00:22, Alexei Svitkine wrote: > > // static > > bool MetricsStateManager::instance_exists_ = ...
6 years, 7 months ago (2014-05-05 20:05:39 UTC) #29
Nico
Diff of the static initializers shows that these are the two new ones: # ppb_nacl_private_impl.cc ...
6 years, 7 months ago (2014-05-05 20:17:14 UTC) #30
miu
Yep, just discovered this myself. I'll reapply Alexei's change. -Yuri On Mon, May 5, 2014 ...
6 years, 7 months ago (2014-05-05 20:18:21 UTC) #31
Nico
On 2014/05/05 20:17:14, Nico wrote: > Diff of the static initializers shows that these are ...
6 years, 7 months ago (2014-05-05 20:19:17 UTC) #32
miu
Agreed. Reverting now. On Mon, May 5, 2014 at 1:19 PM, <thakis@chromium.org> wrote: > On ...
6 years, 7 months ago (2014-05-05 20:21:28 UTC) #33
Alexei Svitkine (slow)
Thanks! On Mon, May 5, 2014 at 4:21 PM, Yuri Wiitala <miu@chromium.org> wrote: > Agreed. ...
6 years, 7 months ago (2014-05-05 20:22:49 UTC) #34
Alexei Svitkine (slow)
6 years, 7 months ago (2014-05-05 20:24:35 UTC) #35
On Mon, May 5, 2014 at 4:05 PM, <miu@chromium.org> wrote:
>
> Out of curiosity, if MetricsStateManager is a singleton, why have this
> bool at
> all, and not use one of the appropriate mechanisms in src/base?  Also,
> relevant
> past discussion on this issue:
> http://neugierig.org/software/chromium/notes/2011/08/static-
> initializers.html


A singleton generally lets any piece of code call GetInstance() to get
access to it. Here, we wanted to restrict the class's direct use to be only
by the MetricsService and related code, so we went with this technique
instead.

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698