OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
11 #include "chrome/common/metrics/experiments_helper.h" | 11 #include "chrome/common/metrics/experiments_helper.h" |
12 #include "chrome/common/render_messages.h" | 12 #include "chrome/common/render_messages.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
15 | 15 |
16 using content::BrowserThread; | 16 using content::BrowserThread; |
17 | 17 |
18 FieldTrialSynchronizer::FieldTrialSynchronizer() { | 18 FieldTrialSynchronizer::FieldTrialSynchronizer() { |
19 DCHECK(field_trial_synchronizer_ == NULL); | 19 DCHECK(field_trial_synchronizer_ == NULL); |
20 field_trial_synchronizer_ = this; | 20 field_trial_synchronizer_ = this; |
21 base::FieldTrialList::AddObserver(this); | 21 base::FieldTrialList::AddObserver(this); |
22 | 22 |
23 ExperimentsHelper::SetChildProcessLoggingExperimentList(); | 23 experiments_helper::SetChildProcessLoggingExperimentList(); |
24 } | 24 } |
25 | 25 |
26 FieldTrialSynchronizer::~FieldTrialSynchronizer() { | 26 FieldTrialSynchronizer::~FieldTrialSynchronizer() { |
27 base::FieldTrialList::RemoveObserver(this); | 27 base::FieldTrialList::RemoveObserver(this); |
28 field_trial_synchronizer_ = NULL; | 28 field_trial_synchronizer_ = NULL; |
29 } | 29 } |
30 | 30 |
31 void FieldTrialSynchronizer::NotifyAllRenderers( | 31 void FieldTrialSynchronizer::NotifyAllRenderers( |
32 const std::string& field_trial_name, | 32 const std::string& field_trial_name, |
33 const std::string& group_name) { | 33 const std::string& group_name) { |
(...skipping 11 matching lines...) Expand all Loading... |
45 | 45 |
46 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( | 46 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( |
47 const std::string& field_trial_name, | 47 const std::string& field_trial_name, |
48 const std::string& group_name) { | 48 const std::string& group_name) { |
49 BrowserThread::PostTask( | 49 BrowserThread::PostTask( |
50 BrowserThread::UI, FROM_HERE, | 50 BrowserThread::UI, FROM_HERE, |
51 base::Bind(&FieldTrialSynchronizer::NotifyAllRenderers, | 51 base::Bind(&FieldTrialSynchronizer::NotifyAllRenderers, |
52 this, | 52 this, |
53 field_trial_name, | 53 field_trial_name, |
54 group_name)); | 54 group_name)); |
55 ExperimentsHelper::SetChildProcessLoggingExperimentList(); | 55 experiments_helper::SetChildProcessLoggingExperimentList(); |
56 } | 56 } |
57 | 57 |
58 // static | 58 // static |
59 FieldTrialSynchronizer* | 59 FieldTrialSynchronizer* |
60 FieldTrialSynchronizer::field_trial_synchronizer_ = NULL; | 60 FieldTrialSynchronizer::field_trial_synchronizer_ = NULL; |
OLD | NEW |