Index: content/public/browser/histogram_synchronizer.h |
=================================================================== |
--- content/public/browser/histogram_synchronizer.h (revision 0) |
+++ content/public/browser/histogram_synchronizer.h (working copy) |
@@ -0,0 +1,60 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_PUBLIC_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ |
+#define CONTENT_PUBLIC_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ |
+#pragma once |
+ |
+#include "base/basictypes.h" |
+#include "base/callback.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/time.h" |
+#include "content/common/content_export.h" |
+ |
+class MessageLoop; |
+ |
+namespace content { |
+ |
+// 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.
|
+// child processes, into the browser process. Such transactions are usually |
+// instigated by the browser. |
+// |
+// There are actually two modes for getting histograms. One is synchronous (and |
+// blocks the UI thread, waiting to populate an about:histograms tab) and the |
+// other is asynchronous, and used by the metrics services in preparation for a |
+// log upload. |
+ |
+class CONTENT_EXPORT HistogramSynchronizer : public |
+ 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.
|
+ public: |
+ // Returns the HistogramSynchronizer object for the current process, or NULL |
+ // if none. |
+ static HistogramSynchronizer* GetInstance(); |
+ |
+ 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.
|
+ |
+ // Contact all processes, and get them to upload to the browser any/all |
+ // changes to histograms. This method is called from about:histograms. |
+ 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.
|
+ |
+ // Contact all processes, and get them to upload to the browser any/all |
+ // changes to histograms. When all changes have been acquired, or when the |
+ // wait time expires (whichever is sooner), post the callback to the |
+ // specified message loop. Note the callback is posted exactly once. |
+ 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.
|
+ const base::Closure& callback, |
+ base::TimeDelta wait_time); |
+ |
+ protected: |
+ friend class base::RefCountedThreadSafe<HistogramSynchronizer>; |
+ |
+ virtual ~HistogramSynchronizer() {} |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(HistogramSynchronizer); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_PUBLIC_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ |
Property changes on: content/public/browser/histogram_synchronizer.h |
___________________________________________________________________ |
Added: svn:executable |
## -0,0 +1 ## |
+* |
Added: svn:eol-style |
## -0,0 +1 ## |
+LF |