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/renderer/devtools/devtools_agent.h" | 5 #include "content/renderer/devtools/devtools_agent.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 reinterpret_cast<base::subtle::AtomicWord>(cb)); | 164 reinterpret_cast<base::subtle::AtomicWord>(cb)); |
165 if (!!cb) { | 165 if (!!cb) { |
166 trace_log->SetEventCallbackEnabled(base::debug::CategoryFilter( | 166 trace_log->SetEventCallbackEnabled(base::debug::CategoryFilter( |
167 category_filter.utf8()), TraceEventCallbackWrapper); | 167 category_filter.utf8()), TraceEventCallbackWrapper); |
168 } else { | 168 } else { |
169 trace_log->SetEventCallbackDisabled(); | 169 trace_log->SetEventCallbackDisabled(); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void DevToolsAgent::enableTracing(const WebString& category_filter) { | 173 void DevToolsAgent::enableTracing(const WebString& category_filter) { |
| 174 Send(new DevToolsHostMsg_EnableTracing(routing_id(), category_filter.utf8())); |
174 TraceLog* trace_log = TraceLog::GetInstance(); | 175 TraceLog* trace_log = TraceLog::GetInstance(); |
175 trace_log->SetEnabled(base::debug::CategoryFilter(category_filter.utf8()), | 176 trace_log->SetEnabled(base::debug::CategoryFilter(category_filter.utf8()), |
176 TraceLog::RECORDING_MODE, | 177 TraceLog::RECORDING_MODE, |
177 TraceOptions()); | 178 TraceOptions()); |
178 } | 179 } |
179 | 180 |
180 void DevToolsAgent::disableTracing() { | 181 void DevToolsAgent::disableTracing() { |
181 TraceLog::GetInstance()->SetDisabled(); | 182 TraceLog::GetInstance()->SetDisabled(); |
| 183 Send(new DevToolsHostMsg_DisableTracing(routing_id())); |
182 } | 184 } |
183 | 185 |
184 // static | 186 // static |
185 void DevToolsAgent::TraceEventCallbackWrapper( | 187 void DevToolsAgent::TraceEventCallbackWrapper( |
186 base::TimeTicks timestamp, | 188 base::TimeTicks timestamp, |
187 char phase, | 189 char phase, |
188 const unsigned char* category_group_enabled, | 190 const unsigned char* category_group_enabled, |
189 const char* name, | 191 const char* name, |
190 unsigned long long id, | 192 unsigned long long id, |
191 int num_args, | 193 int num_args, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 if (!web_view) | 356 if (!web_view) |
355 return NULL; | 357 return NULL; |
356 return web_view->devToolsAgent(); | 358 return web_view->devToolsAgent(); |
357 } | 359 } |
358 | 360 |
359 bool DevToolsAgent::IsAttached() { | 361 bool DevToolsAgent::IsAttached() { |
360 return is_attached_; | 362 return is_attached_; |
361 } | 363 } |
362 | 364 |
363 } // namespace content | 365 } // namespace content |
OLD | NEW |