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 "content/browser/histogram_subscriber.h" | 9 #include "content/browser/histogram_subscriber.h" |
10 #include "content/common/child_process_messages.h" | 10 #include "content/common/child_process_messages.h" |
11 #include "content/public/browser/browser_child_process_host_iterator.h" | 11 #include "content/public/browser/browser_child_process_host_iterator.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/child_process_data.h" | 13 #include "content/public/browser/child_process_data.h" |
14 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 15 #include "content/public/common/process_type.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 HistogramController* HistogramController::GetInstance() { | 19 HistogramController* HistogramController::GetInstance() { |
19 return Singleton<HistogramController>::get(); | 20 return Singleton<HistogramController>::get(); |
20 } | 21 } |
21 | 22 |
22 HistogramController::HistogramController() : subscriber_(NULL) { | 23 HistogramController::HistogramController() : subscriber_(NULL) { |
23 } | 24 } |
24 | 25 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 DCHECK_EQ(subscriber_, subscriber); | 65 DCHECK_EQ(subscriber_, subscriber); |
65 subscriber_ = NULL; | 66 subscriber_ = NULL; |
66 } | 67 } |
67 | 68 |
68 void HistogramController::GetHistogramDataFromChildProcesses( | 69 void HistogramController::GetHistogramDataFromChildProcesses( |
69 int sequence_number) { | 70 int sequence_number) { |
70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
71 | 72 |
72 int pending_processes = 0; | 73 int pending_processes = 0; |
73 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { | 74 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) { |
74 ProcessType type = iter.GetData().type; | 75 int type = iter.GetData().process_type; |
75 if (type != PROCESS_TYPE_PLUGIN && type != PROCESS_TYPE_GPU) | 76 if (type != PROCESS_TYPE_PLUGIN && type != PROCESS_TYPE_GPU) |
76 continue; | 77 continue; |
77 ++pending_processes; | 78 ++pending_processes; |
78 if (!iter.Send(new ChildProcessMsg_GetChildHistogramData(sequence_number))) | 79 if (!iter.Send(new ChildProcessMsg_GetChildHistogramData(sequence_number))) |
79 --pending_processes; | 80 --pending_processes; |
80 } | 81 } |
81 | 82 |
82 BrowserThread::PostTask( | 83 BrowserThread::PostTask( |
83 BrowserThread::UI, | 84 BrowserThread::UI, |
84 FROM_HERE, | 85 FROM_HERE, |
(...skipping 21 matching lines...) Expand all Loading... |
106 | 107 |
107 BrowserThread::PostTask( | 108 BrowserThread::PostTask( |
108 BrowserThread::IO, | 109 BrowserThread::IO, |
109 FROM_HERE, | 110 FROM_HERE, |
110 base::Bind(&HistogramController::GetHistogramDataFromChildProcesses, | 111 base::Bind(&HistogramController::GetHistogramDataFromChildProcesses, |
111 base::Unretained(this), | 112 base::Unretained(this), |
112 sequence_number)); | 113 sequence_number)); |
113 } | 114 } |
114 | 115 |
115 } // namespace content | 116 } // namespace content |
OLD | NEW |