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

Unified Diff: chrome/browser/metrics/field_trial_synchronizer.cc

Issue 10071036: RefCounted types should not have public destructors, chrome/browser/ part 6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation fixes Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/field_trial_synchronizer.cc
diff --git a/chrome/browser/metrics/field_trial_synchronizer.cc b/chrome/browser/metrics/field_trial_synchronizer.cc
index a6ad4c5cff6d8ca223919263e152774fe64e9938..b4833596525734f54b98803f23ced91bcb4048c1 100644
--- a/chrome/browser/metrics/field_trial_synchronizer.cc
+++ b/chrome/browser/metrics/field_trial_synchronizer.cc
@@ -15,19 +15,24 @@
using content::BrowserThread;
+namespace {
+
+// This singleton instance should be constructed during the single threaded
+// portion of main(). It initializes globals to provide support for all future
+// calls. This object is created on the UI thread, and it is destroyed after
+// all the other threads have gone away.
+FieldTrialSynchronizer* g_field_trial_synchronizer = NULL;
+
+} // namespace
+
FieldTrialSynchronizer::FieldTrialSynchronizer() {
- DCHECK(field_trial_synchronizer_ == NULL);
- field_trial_synchronizer_ = this;
+ DCHECK(g_field_trial_synchronizer == NULL);
+ g_field_trial_synchronizer = this;
base::FieldTrialList::AddObserver(this);
experiments_helper::SetChildProcessLoggingExperimentList();
}
-FieldTrialSynchronizer::~FieldTrialSynchronizer() {
- base::FieldTrialList::RemoveObserver(this);
- field_trial_synchronizer_ = NULL;
-}
-
void FieldTrialSynchronizer::NotifyAllRenderers(
const std::string& field_trial_name,
const std::string& group_name) {
@@ -55,6 +60,7 @@ void FieldTrialSynchronizer::OnFieldTrialGroupFinalized(
experiments_helper::SetChildProcessLoggingExperimentList();
}
-// static
-FieldTrialSynchronizer*
- FieldTrialSynchronizer::field_trial_synchronizer_ = NULL;
+FieldTrialSynchronizer::~FieldTrialSynchronizer() {
+ base::FieldTrialList::RemoveObserver(this);
+ g_field_trial_synchronizer = NULL;
+}
« no previous file with comments | « chrome/browser/metrics/field_trial_synchronizer.h ('k') | chrome/browser/notifications/notification_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698