|
OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_PUBLIC_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ | |
6 #define CONTENT_PUBLIC_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "base/callback.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/time.h" | |
13 #include "content/common/content_export.h" | |
14 | |
15 class MessageLoop; | |
16 | |
17 namespace content { | |
18 | |
19 // This class is used to fecth histogram data from the various renderer and | |
jam
2012/06/07 03:34:33
nit: ditto re "renderer and child" -> "child"
ramant (doing other things)
2012/06/07 23:39:25
Done.
| |
20 // child processes, into the browser process. Such transactions are usually | |
21 // instigated by the browser. | |
22 // | |
23 // There are actually two modes for getting histograms. One is synchronous (and | |
24 // blocks the UI thread, waiting to populate an about:histograms tab) and the | |
25 // other is asynchronous, and used by the metrics services in preparation for a | |
26 // log upload. | |
27 | |
28 class CONTENT_EXPORT HistogramSynchronizer : public | |
29 base::RefCountedThreadSafe<HistogramSynchronizer> { | |
jam
2012/06/07 03:34:33
do you really need to expose that this is ref coun
ramant (doing other things)
2012/06/07 23:39:25
Done.
| |
30 public: | |
31 // Returns the HistogramSynchronizer object for the current process, or NULL | |
32 // if none. | |
33 static HistogramSynchronizer* GetInstance(); | |
34 | |
35 HistogramSynchronizer() {} | |
jam
2012/06/07 03:34:33
nit: not needed so just take out
ramant (doing other things)
2012/06/07 23:39:25
Done.
| |
36 | |
37 // Contact all processes, and get them to upload to the browser any/all | |
38 // changes to histograms. This method is called from about:histograms. | |
39 static void FetchHistograms(); | |
jam
2012/06/07 03:34:33
this function is only called by code in content, s
ramant (doing other things)
2012/06/07 23:39:25
Done.
| |
40 | |
41 // Contact all processes, and get them to upload to the browser any/all | |
42 // changes to histograms. When all changes have been acquired, or when the | |
43 // wait time expires (whichever is sooner), post the callback to the | |
44 // specified message loop. Note the callback is posted exactly once. | |
45 static void FetchHistogramsAsynchronously(MessageLoop* callback_thread, | |
jam
2012/06/07 03:34:33
if all these methods are just static, what's the p
ramant (doing other things)
2012/06/07 23:39:25
Done.
| |
46 const base::Closure& callback, | |
47 base::TimeDelta wait_time); | |
48 | |
49 protected: | |
50 friend class base::RefCountedThreadSafe<HistogramSynchronizer>; | |
51 | |
52 virtual ~HistogramSynchronizer() {} | |
53 | |
54 private: | |
55 DISALLOW_COPY_AND_ASSIGN(HistogramSynchronizer); | |
56 }; | |
57 | |
58 } // namespace content | |
59 | |
60 #endif // CONTENT_PUBLIC_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ | |
OLD | NEW |