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