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

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, 5 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
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
13 namespace content {
14
15 class HistogramSubscriber;
16
17 // HistogramController is used on the browser process to collect histogram data.
18 // Only the browser UI thread is allowed to interact with the
19 // HistogramController object.
20 class HistogramController {
21 public:
22 // Returns the HistogramController object for the current process, or NULL if
23 // none.
24 static HistogramController* GetInstance();
25
26 // Normally instantiated when the child process is launched. Only one instance
27 // should be created per process.
28 HistogramController();
29 virtual ~HistogramController();
30
31 // Register the subscriber so that it will be called when for example
32 // OnHistogramDataCollected is returning histogram data from a child process.
33 // This is called on UI thread.
34 void Register(HistogramSubscriber* subscriber);
35
36 // Unregister the subscriber so that it will not be called when for example
37 // OnHistogramDataCollected is returning histogram data from a child process.
38 // Safe to call even if caller is not the current subscriber.
39 void Unregister(const HistogramSubscriber* subscriber);
40
41 // Contact all processes and get their histogram data.
42 void GetHistogramData(int sequence_number);
43
44 // Notify the |subscriber_| that it should expect at least |pending_processes|
45 // additional calls to OnHistogramDataCollected(). OnPendingProcess() may be
46 // called repeatedly; the last call will have |end| set to true, indicating
47 // that there is no longer a possibility for the count of pending processes to
48 // increase. This is called on the UI thread.
49 void OnPendingProcesses(int sequence_number, int pending_processes, bool end);
50
51 // Send the |histogram| back to the |subscriber_|.
52 // This can be called from any thread.
53 void OnHistogramDataCollected(
54 int sequence_number,
55 const std::vector<std::string>& pickled_histograms);
56
57 private:
58 friend struct DefaultSingletonTraits<HistogramController>;
59
60 // Contact child processes and get their histogram data.
61 void GetHistogramDataFromChildProcesses(int sequence_number);
62
63 HistogramSubscriber* subscriber_;
64
65 DISALLOW_COPY_AND_ASSIGN(HistogramController);
66 };
67
68 } // namespace content
69
70 #endif // CONTENT_BROWSER_HISTOGRAM_CONTROLLER_H_
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host_impl.cc ('k') | content/browser/histogram_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698