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

Side by Side Diff: content/browser/histogram_controller.h

Issue 10454086: Histograms - Support histograms for Plugins, GPU (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
OLDNEW
(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_BROWSER_HISTOGRAM_CONTROLLER_H_
6 #define CONTENT_BROWSER_HISTOGRAM_CONTROLLER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/memory/singleton.h"
12 #include "base/process.h"
13 #include "content/common/content_export.h"
14 #include "content/public/common/process_type.h"
jam 2012/06/07 03:34:33 nit: i don't think any of these 4 headers are need
ramant (doing other things) 2012/06/07 23:39:25 Deleted all includes except for singleton.h Done.
15
16 namespace content {
17
18 class HistogramSubscriber;
19
20 // HistogramController is used on the browser process to collect histogram data.
21 // Only the browser UI thread is allowed to interact with the
22 // HistogramController object.
23 class HistogramController {
24 public:
25 // Returns the HistogramController object for the current process, or NULL if
26 // none.
27 static HistogramController* GetInstance();
28
29 // Normally instantiated when the child process is launched. Only one instance
30 // should be created per process.
31 HistogramController();
32 virtual ~HistogramController();
33
34 // Register the subscriber so that it will be called when for example
35 // OnHistogramDataCollected is returning histogram data from a child process.
36 // This is called on UI thread.
37 void Register(HistogramSubscriber* subscriber);
38
39 // Unregister the subscriber so that it will not be called when for example
40 // OnHistogramDataCollected is returning histogram data from a child process.
41 // Safe to call even if caller is not the current subscriber.
42 void Unregister(const HistogramSubscriber* subscriber);
43
44 // Contact all processes and get their histogram data.
45 void GetHistogramData(int sequence_number);
46
47 // Notify the |subscriber_| that it should expect at least |pending_processes|
48 // additional calls to OnHistogramDataCollected(). OnPendingProcess() may be
49 // called repeatedly; the last call will have |end| set to true, indicating
50 // that there is no longer a possibility for the count of pending processes to
51 // increase. This is called on the UI thread.
52 void OnPendingProcesses(int sequence_number, int pending_processes, bool end);
53
54 // Send the |histogram| back to the |subscriber_|.
55 // This can be called from any thread.
56 void OnHistogramDataCollected(
57 int sequence_number,
58 const std::vector<std::string>& pickled_histograms);
59
60 private:
61 friend struct DefaultSingletonTraits<HistogramController>;
62
63 // Contact child processes and get their histogram data.
64 void GetHistogramDataFromChildProcesses(int sequence_number);
65
66 HistogramSubscriber* subscriber_;
67
68 DISALLOW_COPY_AND_ASSIGN(HistogramController);
69 };
70
71 } // namespace content
72
73 #endif // CONTENT_BROWSER_HISTOGRAM_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698