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

Side by Side Diff: chrome/browser/metrics/field_trial_synchronizer.h

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, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/memory_purger.cc ('k') | chrome/browser/metrics/field_trial_synchronizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_BROWSER_METRICS_FIELD_TRIAL_SYNCHRONIZER_H_ 5 #ifndef CHROME_BROWSER_METRICS_FIELD_TRIAL_SYNCHRONIZER_H_
6 #define CHROME_BROWSER_METRICS_FIELD_TRIAL_SYNCHRONIZER_H_ 6 #define CHROME_BROWSER_METRICS_FIELD_TRIAL_SYNCHRONIZER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 17 matching lines...) Expand all
28 public base::FieldTrialList::Observer { 28 public base::FieldTrialList::Observer {
29 public: 29 public:
30 // Construction also sets up the global singleton instance. This instance is 30 // Construction also sets up the global singleton instance. This instance is
31 // used to communicate between the UI and other threads, and is destroyed only 31 // used to communicate between the UI and other threads, and is destroyed only
32 // as the main thread (browser_main) terminates, which means all other threads 32 // as the main thread (browser_main) terminates, which means all other threads
33 // have completed, and will not need this instance any further. It adds itself 33 // have completed, and will not need this instance any further. It adds itself
34 // as an observer of FieldTrialList so that it gets notified whenever a group 34 // as an observer of FieldTrialList so that it gets notified whenever a group
35 // is finalized in the browser process. 35 // is finalized in the browser process.
36 FieldTrialSynchronizer(); 36 FieldTrialSynchronizer();
37 37
38 virtual ~FieldTrialSynchronizer();
39
40 // Notify all renderer processes about the |group_name| that is finalized for 38 // Notify all renderer processes about the |group_name| that is finalized for
41 // the given field trail (|field_trial_name|). This is called on UI thread. 39 // the given field trail (|field_trial_name|). This is called on UI thread.
42 void NotifyAllRenderers(const std::string& field_trial_name, 40 void NotifyAllRenderers(const std::string& field_trial_name,
43 const std::string& group_name); 41 const std::string& group_name);
44 42
45 // FieldTrialList::Observer methods: 43 // FieldTrialList::Observer methods:
46 44
47 // This method is called by the FieldTrialList singleton when a trial's group 45 // This method is called by the FieldTrialList singleton when a trial's group
48 // is finalized. This method contacts all renderers (by calling 46 // is finalized. This method contacts all renderers (by calling
49 // NotifyAllRenderers) to create a FieldTrial that carries the randomly 47 // NotifyAllRenderers) to create a FieldTrial that carries the randomly
50 // selected state from the browser process into all the renderer processes. 48 // selected state from the browser process into all the renderer processes.
51 virtual void OnFieldTrialGroupFinalized( 49 virtual void OnFieldTrialGroupFinalized(
52 const std::string& name, 50 const std::string& name,
53 const std::string& group_name) OVERRIDE; 51 const std::string& group_name) OVERRIDE;
54 52
55 private: 53 private:
56 // This singleton instance should be constructed during the single threaded 54 friend class base::RefCountedThreadSafe<FieldTrialSynchronizer>;
57 // portion of main(). It initializes globals to provide support for all future 55 virtual ~FieldTrialSynchronizer();
58 // calls. This object is created on the UI thread, and it is destroyed after
59 // all the other threads have gone away.
60 static FieldTrialSynchronizer* field_trial_synchronizer_;
61 56
62 DISALLOW_COPY_AND_ASSIGN(FieldTrialSynchronizer); 57 DISALLOW_COPY_AND_ASSIGN(FieldTrialSynchronizer);
63 }; 58 };
64 59
65 #endif // CHROME_BROWSER_METRICS_FIELD_TRIAL_SYNCHRONIZER_H_ 60 #endif // CHROME_BROWSER_METRICS_FIELD_TRIAL_SYNCHRONIZER_H_
OLDNEW
« no previous file with comments | « chrome/browser/memory_purger.cc ('k') | chrome/browser/metrics/field_trial_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698