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 #include "content/browser/histogram_controller.h" | 5 #include "content/browser/histogram_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/process/process_handle.h" | 9 #include "base/process/process_handle.h" |
10 #include "content/browser/histogram_subscriber.h" | 10 #include "content/browser/histogram_subscriber.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 // In some cases, there may be no child process of the given type (for | 85 // In some cases, there may be no child process of the given type (for |
86 // example, the GPU process may not exist and there may instead just be a | 86 // example, the GPU process may not exist and there may instead just be a |
87 // GPU thread in the browser process). If that's the case, then the process | 87 // GPU thread in the browser process). If that's the case, then the process |
88 // handle will be base::kNullProcessHandle and we shouldn't ask it for data. | 88 // handle will be base::kNullProcessHandle and we shouldn't ask it for data. |
89 if (data.handle == base::kNullProcessHandle) | 89 if (data.handle == base::kNullProcessHandle) |
90 continue; | 90 continue; |
91 | 91 |
92 ++pending_processes; | 92 ++pending_processes; |
93 if (!iter.Send(new ChildProcessMsg_GetChildHistogramData(sequence_number))) | 93 if (!iter.Send(new ChildProcessMsg_GetChildNonPersistentHistogramData( |
| 94 sequence_number))) { |
94 --pending_processes; | 95 --pending_processes; |
| 96 } |
95 } | 97 } |
96 | 98 |
97 BrowserThread::PostTask( | 99 BrowserThread::PostTask( |
98 BrowserThread::UI, | 100 BrowserThread::UI, |
99 FROM_HERE, | 101 FROM_HERE, |
100 base::Bind( | 102 base::Bind( |
101 &HistogramController::OnPendingProcesses, | 103 &HistogramController::OnPendingProcesses, |
102 base::Unretained(this), | 104 base::Unretained(this), |
103 sequence_number, | 105 sequence_number, |
104 pending_processes, | 106 pending_processes, |
105 true)); | 107 true)); |
106 } | 108 } |
107 | 109 |
108 void HistogramController::GetHistogramData(int sequence_number) { | 110 void HistogramController::GetHistogramData(int sequence_number) { |
109 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 111 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
110 | 112 |
111 int pending_processes = 0; | 113 int pending_processes = 0; |
112 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); | 114 for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); |
113 !it.IsAtEnd(); it.Advance()) { | 115 !it.IsAtEnd(); it.Advance()) { |
114 ++pending_processes; | 116 ++pending_processes; |
115 if (!it.GetCurrentValue()->Send( | 117 if (!it.GetCurrentValue()->Send( |
116 new ChildProcessMsg_GetChildHistogramData(sequence_number))) { | 118 new ChildProcessMsg_GetChildNonPersistentHistogramData( |
| 119 sequence_number))) { |
117 --pending_processes; | 120 --pending_processes; |
118 } | 121 } |
119 } | 122 } |
120 OnPendingProcesses(sequence_number, pending_processes, false); | 123 OnPendingProcesses(sequence_number, pending_processes, false); |
121 | 124 |
122 BrowserThread::PostTask( | 125 BrowserThread::PostTask( |
123 BrowserThread::IO, | 126 BrowserThread::IO, |
124 FROM_HERE, | 127 FROM_HERE, |
125 base::Bind(&HistogramController::GetHistogramDataFromChildProcesses, | 128 base::Bind(&HistogramController::GetHistogramDataFromChildProcesses, |
126 base::Unretained(this), | 129 base::Unretained(this), |
127 sequence_number)); | 130 sequence_number)); |
128 } | 131 } |
129 | 132 |
130 } // namespace content | 133 } // namespace content |
OLD | NEW |