| OLD | NEW |
| 1 // Copyright (c) 2011 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/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(bool enable) { | 124 void ProfilerControllerImpl::SetProfilerStatusInChildProcesses( |
| 125 tracked_objects::ThreadData::Status status) { |
| 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 126 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 126 | 127 |
| 127 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) | 128 for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) |
| 128 iter.Send(new ChildProcessMsg_SetProfilerStatus(enable)); | 129 iter.Send(new ChildProcessMsg_SetProfilerStatus(status)); |
| 129 } | 130 } |
| 130 | 131 |
| 131 void ProfilerControllerImpl::SetProfilerStatus(bool enable) { | 132 void ProfilerControllerImpl::SetProfilerStatus( |
| 133 tracked_objects::ThreadData::Status status) { |
| 132 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 133 | 135 |
| 134 BrowserThread::PostTask( | 136 BrowserThread::PostTask( |
| 135 BrowserThread::IO, | 137 BrowserThread::IO, |
| 136 FROM_HERE, | 138 FROM_HERE, |
| 137 base::Bind(&ProfilerControllerImpl::SetProfilerStatusInChildProcesses, | 139 base::Bind(&ProfilerControllerImpl::SetProfilerStatusInChildProcesses, |
| 138 base::Unretained(this), | 140 base::Unretained(this), |
| 139 enable)); | 141 status)); |
| 140 | 142 |
| 141 for (content::RenderProcessHost::iterator it( | 143 for (content::RenderProcessHost::iterator it( |
| 142 content::RenderProcessHost::AllHostsIterator()); | 144 content::RenderProcessHost::AllHostsIterator()); |
| 143 !it.IsAtEnd(); it.Advance()) { | 145 !it.IsAtEnd(); it.Advance()) { |
| 144 it.GetCurrentValue()->Send(new ChildProcessMsg_SetProfilerStatus(enable)); | 146 it.GetCurrentValue()->Send(new ChildProcessMsg_SetProfilerStatus(status)); |
| 145 } | 147 } |
| 146 } | 148 } |
| 147 } // namespace content | 149 } // namespace content |
| OLD | NEW |