| 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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 content::RenderProcessHost::AllHostsIterator()); | 44 content::RenderProcessHost::AllHostsIterator()); |
| 45 !it.IsAtEnd(); it.Advance()) { | 45 !it.IsAtEnd(); it.Advance()) { |
| 46 it.GetCurrentValue()->Send( | 46 it.GetCurrentValue()->Send( |
| 47 new ChromeViewMsg_SetFieldTrialGroup(field_trial_name, group_name)); | 47 new ChromeViewMsg_SetFieldTrialGroup(field_trial_name, group_name)); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( | 51 void FieldTrialSynchronizer::OnFieldTrialGroupFinalized( |
| 52 const std::string& field_trial_name, | 52 const std::string& field_trial_name, |
| 53 const std::string& group_name) { | 53 const std::string& group_name) { |
| 54 // TODO(asvitkine): Remove these CHECKs once http://crbug.com/359406 is fixed. |
| 54 CHECK(!field_trial_name.empty() && !group_name.empty()); | 55 CHECK(!field_trial_name.empty() && !group_name.empty()); |
| 56 CHECK_EQ(group_name, base::FieldTrialList::FindFullName(field_trial_name)) |
| 57 << field_trial_name << ":" << group_name << "=>" |
| 58 << base::FieldTrialList::FindFullName(field_trial_name); |
| 55 BrowserThread::PostTask( | 59 BrowserThread::PostTask( |
| 56 BrowserThread::UI, FROM_HERE, | 60 BrowserThread::UI, FROM_HERE, |
| 57 base::Bind(&FieldTrialSynchronizer::NotifyAllRenderers, | 61 base::Bind(&FieldTrialSynchronizer::NotifyAllRenderers, |
| 58 this, | 62 this, |
| 59 field_trial_name, | 63 field_trial_name, |
| 60 group_name)); | 64 group_name)); |
| 61 variations::SetVariationListCrashKeys(); | 65 variations::SetVariationListCrashKeys(); |
| 62 } | 66 } |
| 63 | 67 |
| 64 FieldTrialSynchronizer::~FieldTrialSynchronizer() { | 68 FieldTrialSynchronizer::~FieldTrialSynchronizer() { |
| 65 base::FieldTrialList::RemoveObserver(this); | 69 base::FieldTrialList::RemoveObserver(this); |
| 66 g_field_trial_synchronizer = NULL; | 70 g_field_trial_synchronizer = NULL; |
| 67 } | 71 } |
| OLD | NEW |