OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_METRICS_HISTOGRAM_SYNCHRONIZER_H_ | 5 #ifndef CHROME_BROWSER_METRICS_HISTOGRAM_SYNCHRONIZER_H_ |
6 #define CHROME_BROWSER_METRICS_HISTOGRAM_SYNCHRONIZER_H_ | 6 #define CHROME_BROWSER_METRICS_HISTOGRAM_SYNCHRONIZER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // main UI thread from about:histograms. | 73 // main UI thread from about:histograms. |
74 void FetchRendererHistogramsSynchronously(base::TimeDelta wait_time); | 74 void FetchRendererHistogramsSynchronously(base::TimeDelta wait_time); |
75 | 75 |
76 // Contact all renderers, and get them to upload to the browser any/all | 76 // Contact all renderers, and get them to upload to the browser any/all |
77 // changes to histograms. When all changes have been acquired, or when the | 77 // changes to histograms. When all changes have been acquired, or when the |
78 // wait time expires (whichever is sooner), post the callback to the | 78 // wait time expires (whichever is sooner), post the callback to the |
79 // specified message loop. Note the callback is posted exactly once. | 79 // specified message loop. Note the callback is posted exactly once. |
80 static void FetchRendererHistogramsAsynchronously( | 80 static void FetchRendererHistogramsAsynchronously( |
81 MessageLoop* callback_thread, | 81 MessageLoop* callback_thread, |
82 const base::Closure& callback, | 82 const base::Closure& callback, |
83 base::TimeDelta wait_time); | 83 int wait_time); |
84 | 84 |
85 // This method is called on the IO thread. Deserializes the histograms and | 85 // This method is called on the IO thread. Deserializes the histograms and |
86 // records that we have received histograms from a renderer process. | 86 // records that we have received histograms from a renderer process. |
87 static void DeserializeHistogramList( | 87 static void DeserializeHistogramList( |
88 int sequence_number, const std::vector<std::string>& histograms); | 88 int sequence_number, const std::vector<std::string>& histograms); |
89 | 89 |
90 private: | 90 private: |
91 friend class base::RefCountedThreadSafe<HistogramSynchronizer>; | 91 friend class base::RefCountedThreadSafe<HistogramSynchronizer>; |
92 | 92 |
93 ~HistogramSynchronizer(); | 93 ~HistogramSynchronizer(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // portion of main(). It initializes globals to provide support for all future | 172 // portion of main(). It initializes globals to provide support for all future |
173 // calls. This object is created on the UI thread, and it is destroyed after | 173 // calls. This object is created on the UI thread, and it is destroyed after |
174 // all the other threads have gone away. As a result, it is ok to call it | 174 // all the other threads have gone away. As a result, it is ok to call it |
175 // from the UI thread (for UMA uploads), or for about:histograms. | 175 // from the UI thread (for UMA uploads), or for about:histograms. |
176 static HistogramSynchronizer* histogram_synchronizer_; | 176 static HistogramSynchronizer* histogram_synchronizer_; |
177 | 177 |
178 DISALLOW_COPY_AND_ASSIGN(HistogramSynchronizer); | 178 DISALLOW_COPY_AND_ASSIGN(HistogramSynchronizer); |
179 }; | 179 }; |
180 | 180 |
181 #endif // CHROME_BROWSER_METRICS_HISTOGRAM_SYNCHRONIZER_H_ | 181 #endif // CHROME_BROWSER_METRICS_HISTOGRAM_SYNCHRONIZER_H_ |
OLD | NEW |