| OLD | NEW |
| 1 // Copyright (c) 2011 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/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); |
| 22 |
| 23 ExperimentsHelper::SetChildProcessLoggingExperimentList(); |
| 21 } | 24 } |
| 22 | 25 |
| 23 FieldTrialSynchronizer::~FieldTrialSynchronizer() { | 26 FieldTrialSynchronizer::~FieldTrialSynchronizer() { |
| 24 base::FieldTrialList::RemoveObserver(this); | 27 base::FieldTrialList::RemoveObserver(this); |
| 25 field_trial_synchronizer_ = NULL; | 28 field_trial_synchronizer_ = NULL; |
| 26 } | 29 } |
| 27 | 30 |
| 28 void FieldTrialSynchronizer::NotifyAllRenderers( | 31 void FieldTrialSynchronizer::NotifyAllRenderers( |
| 29 const std::string& field_trial_name, | 32 const std::string& field_trial_name, |
| 30 const std::string& group_name) { | 33 const std::string& group_name) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 42 | 45 |
| 43 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( | 46 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( |
| 44 const std::string& field_trial_name, | 47 const std::string& field_trial_name, |
| 45 const std::string& group_name) { | 48 const std::string& group_name) { |
| 46 BrowserThread::PostTask( | 49 BrowserThread::PostTask( |
| 47 BrowserThread::UI, FROM_HERE, | 50 BrowserThread::UI, FROM_HERE, |
| 48 base::Bind(&FieldTrialSynchronizer::NotifyAllRenderers, | 51 base::Bind(&FieldTrialSynchronizer::NotifyAllRenderers, |
| 49 this, | 52 this, |
| 50 field_trial_name, | 53 field_trial_name, |
| 51 group_name)); | 54 group_name)); |
| 55 ExperimentsHelper::SetChildProcessLoggingExperimentList(); |
| 52 } | 56 } |
| 53 | 57 |
| 54 // static | 58 // static |
| 55 FieldTrialSynchronizer* | 59 FieldTrialSynchronizer* |
| 56 FieldTrialSynchronizer::field_trial_synchronizer_ = NULL; | 60 FieldTrialSynchronizer::field_trial_synchronizer_ = NULL; |
| OLD | NEW |