OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ | 5 #ifndef CONTENT_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ |
6 #define CONTENT_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ | 6 #define CONTENT_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 static void FetchHistogramsAsynchronously(base::MessageLoop* callback_thread, | 73 static void FetchHistogramsAsynchronously(base::MessageLoop* callback_thread, |
74 const base::Closure& callback, | 74 const base::Closure& callback, |
75 base::TimeDelta wait_time); | 75 base::TimeDelta wait_time); |
76 | 76 |
77 private: | 77 private: |
78 friend struct DefaultSingletonTraits<HistogramSynchronizer>; | 78 friend struct DefaultSingletonTraits<HistogramSynchronizer>; |
79 | 79 |
80 class RequestContext; | 80 class RequestContext; |
81 | 81 |
82 HistogramSynchronizer(); | 82 HistogramSynchronizer(); |
83 virtual ~HistogramSynchronizer(); | 83 ~HistogramSynchronizer() override; |
84 | 84 |
85 // Establish a new sequence number, and use it to notify all processes | 85 // Establish a new sequence number, and use it to notify all processes |
86 // (renderers, plugins, GPU, etc) of the need to supply, to the browser, | 86 // (renderers, plugins, GPU, etc) of the need to supply, to the browser, |
87 // any/all changes to their histograms. |wait_time| specifies the amount of | 87 // any/all changes to their histograms. |wait_time| specifies the amount of |
88 // time to wait before cancelling the requests for non-responsive processes. | 88 // time to wait before cancelling the requests for non-responsive processes. |
89 void RegisterAndNotifyAllProcesses(ProcessHistogramRequester requester, | 89 void RegisterAndNotifyAllProcesses(ProcessHistogramRequester requester, |
90 base::TimeDelta wait_time); | 90 base::TimeDelta wait_time); |
91 | 91 |
92 // ------------------------------------------------------- | 92 // ------------------------------------------------------- |
93 // HistogramSubscriber methods for browser child processes | 93 // HistogramSubscriber methods for browser child processes |
94 // ------------------------------------------------------- | 94 // ------------------------------------------------------- |
95 | 95 |
96 // Update the number of pending processes for the given |sequence_number|. | 96 // Update the number of pending processes for the given |sequence_number|. |
97 // This is called on UI thread. | 97 // This is called on UI thread. |
98 virtual void OnPendingProcesses(int sequence_number, | 98 void OnPendingProcesses(int sequence_number, |
99 int pending_processes, | 99 int pending_processes, |
100 bool end) override; | 100 bool end) override; |
101 | 101 |
102 // Send histogram_data back to caller and also record that we are waiting | 102 // Send histogram_data back to caller and also record that we are waiting |
103 // for one less histogram data from child process for the given sequence | 103 // for one less histogram data from child process for the given sequence |
104 // number. This method is accessible on UI thread. | 104 // number. This method is accessible on UI thread. |
105 virtual void OnHistogramDataCollected( | 105 void OnHistogramDataCollected( |
106 int sequence_number, | 106 int sequence_number, |
107 const std::vector<std::string>& pickled_histograms) override; | 107 const std::vector<std::string>& pickled_histograms) override; |
108 | 108 |
109 // Set the callback_thread_ and callback_ members. If these members already | 109 // Set the callback_thread_ and callback_ members. If these members already |
110 // had values, then as a side effect, post the old callback_ to the old | 110 // had values, then as a side effect, post the old callback_ to the old |
111 // callaback_thread_. This side effect should not generally happen, but is in | 111 // callaback_thread_. This side effect should not generally happen, but is in |
112 // place to assure correctness (that any tasks that were set, are eventually | 112 // place to assure correctness (that any tasks that were set, are eventually |
113 // called, and never merely discarded). | 113 // called, and never merely discarded). |
114 void SetCallbackTaskAndThread(base::MessageLoop* callback_thread, | 114 void SetCallbackTaskAndThread(base::MessageLoop* callback_thread, |
115 const base::Closure& callback); | 115 const base::Closure& callback); |
(...skipping 29 matching lines...) Expand all Loading... |
145 // The sequence number used by the most recent asynchronous update request to | 145 // The sequence number used by the most recent asynchronous update request to |
146 // contact all processes. | 146 // contact all processes. |
147 int async_sequence_number_; | 147 int async_sequence_number_; |
148 | 148 |
149 DISALLOW_COPY_AND_ASSIGN(HistogramSynchronizer); | 149 DISALLOW_COPY_AND_ASSIGN(HistogramSynchronizer); |
150 }; | 150 }; |
151 | 151 |
152 } // namespace content | 152 } // namespace content |
153 | 153 |
154 #endif // CONTENT_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ | 154 #endif // CONTENT_BROWSER_HISTOGRAM_SYNCHRONIZER_H_ |
OLD | NEW |