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 #include "content/browser/profiler_controller_impl.h" | 5 #include "content/browser/profiler_controller_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "content/common/child_process_messages.h" | 9 #include "content/common/child_process_messages.h" |
10 #include "content/public/browser/browser_child_process_host_iterator.h" | 10 #include "content/public/browser/browser_child_process_host_iterator.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 OnPendingProcesses(sequence_number, pending_processes, false); | 114 OnPendingProcesses(sequence_number, pending_processes, false); |
115 | 115 |
116 BrowserThread::PostTask( | 116 BrowserThread::PostTask( |
117 BrowserThread::IO, | 117 BrowserThread::IO, |
118 FROM_HERE, | 118 FROM_HERE, |
119 base::Bind(&ProfilerControllerImpl::GetProfilerDataFromChildProcesses, | 119 base::Bind(&ProfilerControllerImpl::GetProfilerDataFromChildProcesses, |
120 base::Unretained(this), | 120 base::Unretained(this), |
121 sequence_number)); | 121 sequence_number)); |
122 } | 122 } |
123 | 123 |
124 void ProfilerControllerImpl::SetProfilerStatusInChildProcesses( | 124 void ProfilerControllerImpl::SetProfilerStatusInChildProcesses(bool enable) { |
125 tracked_objects::ThreadData::Status status) { | |
126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
127 | 126 |
128 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) | 127 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) |
129 iter.Send(new ChildProcessMsg_SetProfilerStatus(status)); | 128 iter.Send(new ChildProcessMsg_SetProfilerStatus(enable)); |
130 } | 129 } |
131 | 130 |
132 void ProfilerControllerImpl::SetProfilerStatus( | 131 void ProfilerControllerImpl::SetProfilerStatus(bool enable) { |
133 tracked_objects::ThreadData::Status status) { | |
134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
135 | 133 |
136 BrowserThread::PostTask( | 134 BrowserThread::PostTask( |
137 BrowserThread::IO, | 135 BrowserThread::IO, |
138 FROM_HERE, | 136 FROM_HERE, |
139 base::Bind(&ProfilerControllerImpl::SetProfilerStatusInChildProcesses, | 137 base::Bind(&ProfilerControllerImpl::SetProfilerStatusInChildProcesses, |
140 base::Unretained(this), | 138 base::Unretained(this), |
141 status)); | 139 enable)); |
142 | 140 |
143 for (content::RenderProcessHost::iterator it( | 141 for (content::RenderProcessHost::iterator it( |
144 content::RenderProcessHost::AllHostsIterator()); | 142 content::RenderProcessHost::AllHostsIterator()); |
145 !it.IsAtEnd(); it.Advance()) { | 143 !it.IsAtEnd(); it.Advance()) { |
146 it.GetCurrentValue()->Send(new ChildProcessMsg_SetProfilerStatus(status)); | 144 it.GetCurrentValue()->Send(new ChildProcessMsg_SetProfilerStatus(enable)); |
147 } | 145 } |
148 } | 146 } |
149 } // namespace content | 147 } // namespace content |
OLD | NEW |