| OLD | NEW |
| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
| 9 #include "chrome/common/chrome_constants.h" | 9 #include "chrome/common/chrome_constants.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 void FieldTrialSynchronizer::NotifyAllRenderers( | 25 void FieldTrialSynchronizer::NotifyAllRenderers( |
| 26 const std::string& field_trial_name, | 26 const std::string& field_trial_name, |
| 27 const std::string& group_name) { | 27 const std::string& group_name) { |
| 28 // To iterate over RenderProcessHosts, or to send messages to the hosts, we | 28 // To iterate over RenderProcessHosts, or to send messages to the hosts, we |
| 29 // need to be on the UI thread. | 29 // need to be on the UI thread. |
| 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 31 | 31 |
| 32 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); | 32 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); |
| 33 !it.IsAtEnd(); it.Advance()) { | 33 !it.IsAtEnd(); it.Advance()) { |
| 34 it.GetCurrentValue()->Send( | 34 it.GetCurrentValue()->Send( |
| 35 new ViewMsg_SetFieldTrialGroup(field_trial_name, group_name)); | 35 new ChromeViewMsg_SetFieldTrialGroup(field_trial_name, group_name)); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( | 39 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( |
| 40 const std::string& field_trial_name, | 40 const std::string& field_trial_name, |
| 41 const std::string& group_name) { | 41 const std::string& group_name) { |
| 42 BrowserThread::PostTask( | 42 BrowserThread::PostTask( |
| 43 BrowserThread::UI, FROM_HERE, | 43 BrowserThread::UI, FROM_HERE, |
| 44 NewRunnableMethod(this, | 44 NewRunnableMethod(this, |
| 45 &FieldTrialSynchronizer::NotifyAllRenderers, | 45 &FieldTrialSynchronizer::NotifyAllRenderers, |
| 46 field_trial_name, | 46 field_trial_name, |
| 47 group_name)); | 47 group_name)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 FieldTrialSynchronizer* | 51 FieldTrialSynchronizer* |
| 52 FieldTrialSynchronizer::field_trial_synchronizer_ = NULL; | 52 FieldTrialSynchronizer::field_trial_synchronizer_ = NULL; |
| OLD | NEW |