Chromium Code Reviews| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 base::subtle::NoBarrier_Store(&event_callback_, | 154 base::subtle::NoBarrier_Store(&event_callback_, |
| 155 reinterpret_cast<base::subtle::AtomicWord>(cb)); | 155 reinterpret_cast<base::subtle::AtomicWord>(cb)); |
| 156 if (!!cb) { | 156 if (!!cb) { |
| 157 trace_log->SetEventCallbackEnabled(base::debug::CategoryFilter( | 157 trace_log->SetEventCallbackEnabled(base::debug::CategoryFilter( |
| 158 category_filter.utf8()), TraceEventCallbackWrapper); | 158 category_filter.utf8()), TraceEventCallbackWrapper); |
| 159 } else { | 159 } else { |
| 160 trace_log->SetEventCallbackDisabled(); | 160 trace_log->SetEventCallbackDisabled(); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 void DevToolsAgent::enableTracing(const WebString& category_filter) { | |
| 165 TraceLog* trace_log = TraceLog::GetInstance(); | |
| 166 trace_log->SetEnabled(base::debug::CategoryFilter(category_filter.utf8()), | |
| 167 TraceLog::RECORDING_MODE, | |
| 168 TraceLog::RECORD_UNTIL_FULL); | |
|
pfeldman
2014/04/21 17:50:52
nit: do you want to pass this as a parameter?
| |
| 169 } | |
| 170 | |
| 171 void DevToolsAgent::disableTracing() { | |
| 172 TraceLog::GetInstance()->SetDisabled(); | |
| 173 } | |
| 174 | |
| 164 // static | 175 // static |
| 165 void DevToolsAgent::TraceEventCallbackWrapper( | 176 void DevToolsAgent::TraceEventCallbackWrapper( |
| 166 base::TimeTicks timestamp, | 177 base::TimeTicks timestamp, |
| 167 char phase, | 178 char phase, |
| 168 const unsigned char* category_group_enabled, | 179 const unsigned char* category_group_enabled, |
| 169 const char* name, | 180 const char* name, |
| 170 unsigned long long id, | 181 unsigned long long id, |
| 171 int num_args, | 182 int num_args, |
| 172 const char* const arg_names[], | 183 const char* const arg_names[], |
| 173 const unsigned char arg_types[], | 184 const unsigned char arg_types[], |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 if (!web_view) | 381 if (!web_view) |
| 371 return NULL; | 382 return NULL; |
| 372 return web_view->devToolsAgent(); | 383 return web_view->devToolsAgent(); |
| 373 } | 384 } |
| 374 | 385 |
| 375 bool DevToolsAgent::IsAttached() { | 386 bool DevToolsAgent::IsAttached() { |
| 376 return is_attached_; | 387 return is_attached_; |
| 377 } | 388 } |
| 378 | 389 |
| 379 } // namespace content | 390 } // namespace content |
| OLD | NEW |