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())); | |
175 TraceLog* trace_log = TraceLog::GetInstance(); | 174 TraceLog* trace_log = TraceLog::GetInstance(); |
176 trace_log->SetEnabled(base::debug::CategoryFilter(category_filter.utf8()), | 175 trace_log->SetEnabled(base::debug::CategoryFilter(category_filter.utf8()), |
177 TraceLog::RECORDING_MODE, | 176 TraceLog::RECORDING_MODE, |
178 TraceOptions()); | 177 TraceOptions()); |
179 } | 178 } |
180 | 179 |
181 void DevToolsAgent::disableTracing() { | 180 void DevToolsAgent::disableTracing() { |
182 TraceLog::GetInstance()->SetDisabled(); | 181 TraceLog::GetInstance()->SetDisabled(); |
183 Send(new DevToolsHostMsg_DisableTracing(routing_id())); | |
184 } | 182 } |
185 | 183 |
186 // static | 184 // static |
187 void DevToolsAgent::TraceEventCallbackWrapper( | 185 void DevToolsAgent::TraceEventCallbackWrapper( |
188 base::TimeTicks timestamp, | 186 base::TimeTicks timestamp, |
189 char phase, | 187 char phase, |
190 const unsigned char* category_group_enabled, | 188 const unsigned char* category_group_enabled, |
191 const char* name, | 189 const char* name, |
192 unsigned long long id, | 190 unsigned long long id, |
193 int num_args, | 191 int num_args, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 if (!web_view) | 354 if (!web_view) |
357 return NULL; | 355 return NULL; |
358 return web_view->devToolsAgent(); | 356 return web_view->devToolsAgent(); |
359 } | 357 } |
360 | 358 |
361 bool DevToolsAgent::IsAttached() { | 359 bool DevToolsAgent::IsAttached() { |
362 return is_attached_; | 360 return is_attached_; |
363 } | 361 } |
364 | 362 |
365 } // namespace content | 363 } // namespace content |
OLD | NEW |