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

Side by Side Diff: chrome/browser/metrics/field_trial_synchronizer.cc

Issue 9432033: Add experiments info to crash dumps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/metrics/field_trial_synchronizer.h" 5 #include "chrome/browser/metrics/field_trial_synchronizer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "chrome/common/child_process_logging.h"
10 #include "chrome/common/chrome_constants.h" 11 #include "chrome/common/chrome_constants.h"
11 #include "chrome/common/render_messages.h" 12 #include "chrome/common/render_messages.h"
12 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
14 15
15 using content::BrowserThread; 16 using content::BrowserThread;
16 17
17 FieldTrialSynchronizer::FieldTrialSynchronizer() { 18 FieldTrialSynchronizer::FieldTrialSynchronizer() {
18 DCHECK(field_trial_synchronizer_ == NULL); 19 DCHECK(field_trial_synchronizer_ == NULL);
19 field_trial_synchronizer_ = this; 20 field_trial_synchronizer_ = this;
20 base::FieldTrialList::AddObserver(this); 21 base::FieldTrialList::AddObserver(this);
21 } 22 }
22 23
23 FieldTrialSynchronizer::~FieldTrialSynchronizer() { 24 FieldTrialSynchronizer::~FieldTrialSynchronizer() {
24 base::FieldTrialList::RemoveObserver(this); 25 base::FieldTrialList::RemoveObserver(this);
25 field_trial_synchronizer_ = NULL; 26 field_trial_synchronizer_ = NULL;
26 } 27 }
27 28
29 void FieldTrialSynchronizer::Init() {
30 child_process_logging::InitExperimentList();
31 }
32
28 void FieldTrialSynchronizer::NotifyAllRenderers( 33 void FieldTrialSynchronizer::NotifyAllRenderers(
29 const std::string& field_trial_name, 34 const std::string& field_trial_name,
30 const std::string& group_name) { 35 const std::string& group_name) {
31 // To iterate over RenderProcessHosts, or to send messages to the hosts, we 36 // To iterate over RenderProcessHosts, or to send messages to the hosts, we
32 // need to be on the UI thread. 37 // need to be on the UI thread.
33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
34 39
35 for (content::RenderProcessHost::iterator it( 40 for (content::RenderProcessHost::iterator it(
36 content::RenderProcessHost::AllHostsIterator()); 41 content::RenderProcessHost::AllHostsIterator());
37 !it.IsAtEnd(); it.Advance()) { 42 !it.IsAtEnd(); it.Advance()) {
38 it.GetCurrentValue()->Send( 43 it.GetCurrentValue()->Send(
39 new ChromeViewMsg_SetFieldTrialGroup(field_trial_name, group_name)); 44 new ChromeViewMsg_SetFieldTrialGroup(field_trial_name, group_name));
40 } 45 }
41 } 46 }
42 47
43 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( 48 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized(
44 const std::string& field_trial_name, 49 const std::string& field_trial_name,
45 const std::string& group_name) { 50 const std::string& group_name) {
46 BrowserThread::PostTask( 51 BrowserThread::PostTask(
47 BrowserThread::UI, FROM_HERE, 52 BrowserThread::UI, FROM_HERE,
48 base::Bind(&FieldTrialSynchronizer::NotifyAllRenderers, 53 base::Bind(&FieldTrialSynchronizer::NotifyAllRenderers,
49 this, 54 this,
50 field_trial_name, 55 field_trial_name,
51 group_name)); 56 group_name));
57 child_process_logging::AddFieldTrialGroup(field_trial_name, group_name);
52 } 58 }
53 59
54 // static 60 // static
55 FieldTrialSynchronizer* 61 FieldTrialSynchronizer*
56 FieldTrialSynchronizer::field_trial_synchronizer_ = NULL; 62 FieldTrialSynchronizer::field_trial_synchronizer_ = NULL;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698