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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 using blink::WebConsoleMessage; | 36 using blink::WebConsoleMessage; |
37 using blink::WebDevToolsAgent; | 37 using blink::WebDevToolsAgent; |
38 using blink::WebDevToolsAgentClient; | 38 using blink::WebDevToolsAgentClient; |
39 using blink::WebFrame; | 39 using blink::WebFrame; |
40 using blink::WebPoint; | 40 using blink::WebPoint; |
41 using blink::WebString; | 41 using blink::WebString; |
42 using blink::WebCString; | 42 using blink::WebCString; |
43 using blink::WebVector; | 43 using blink::WebVector; |
44 using blink::WebView; | 44 using blink::WebView; |
45 | 45 |
46 using base::debug::TraceLog; | 46 using base::trace_event::TraceLog; |
47 using base::debug::TraceOptions; | 47 using base::trace_event::TraceOptions; |
48 | 48 |
49 namespace content { | 49 namespace content { |
50 | 50 |
51 base::subtle::AtomicWord DevToolsAgent::event_callback_; | 51 base::subtle::AtomicWord DevToolsAgent::event_callback_; |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
55 const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; | 55 const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; |
56 | 56 |
57 class WebKitClientMessageLoopImpl | 57 class WebKitClientMessageLoopImpl |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 TraceLog::GetInstance()->SetEventCallbackDisabled(); | 156 TraceLog::GetInstance()->SetEventCallbackDisabled(); |
157 base::subtle::NoBarrier_Store(&event_callback_, 0); | 157 base::subtle::NoBarrier_Store(&event_callback_, 0); |
158 } | 158 } |
159 | 159 |
160 void DevToolsAgent::setTraceEventCallback(const WebString& category_filter, | 160 void DevToolsAgent::setTraceEventCallback(const WebString& category_filter, |
161 TraceEventCallback cb) { | 161 TraceEventCallback cb) { |
162 TraceLog* trace_log = TraceLog::GetInstance(); | 162 TraceLog* trace_log = TraceLog::GetInstance(); |
163 base::subtle::NoBarrier_Store(&event_callback_, | 163 base::subtle::NoBarrier_Store(&event_callback_, |
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( |
167 category_filter.utf8()), TraceEventCallbackWrapper); | 167 base::trace_event::CategoryFilter(category_filter.utf8()), |
| 168 TraceEventCallbackWrapper); |
168 } else { | 169 } else { |
169 trace_log->SetEventCallbackDisabled(); | 170 trace_log->SetEventCallbackDisabled(); |
170 } | 171 } |
171 } | 172 } |
172 | 173 |
173 void DevToolsAgent::enableTracing(const WebString& category_filter) { | 174 void DevToolsAgent::enableTracing(const WebString& category_filter) { |
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( |
176 TraceLog::RECORDING_MODE, | 177 base::trace_event::CategoryFilter(category_filter.utf8()), |
177 TraceOptions()); | 178 TraceLog::RECORDING_MODE, TraceOptions()); |
178 } | 179 } |
179 | 180 |
180 void DevToolsAgent::disableTracing() { | 181 void DevToolsAgent::disableTracing() { |
181 TraceLog::GetInstance()->SetDisabled(); | 182 TraceLog::GetInstance()->SetDisabled(); |
182 } | 183 } |
183 | 184 |
184 // static | 185 // static |
185 void DevToolsAgent::TraceEventCallbackWrapper( | 186 void DevToolsAgent::TraceEventCallbackWrapper( |
186 base::TimeTicks timestamp, | 187 base::TimeTicks timestamp, |
187 char phase, | 188 char phase, |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 390 |
390 RenderViewImpl* DevToolsAgent::GetRenderViewImpl() { | 391 RenderViewImpl* DevToolsAgent::GetRenderViewImpl() { |
391 return static_cast<RenderViewImpl*>(main_render_frame_->GetRenderView()); | 392 return static_cast<RenderViewImpl*>(main_render_frame_->GetRenderView()); |
392 } | 393 } |
393 | 394 |
394 bool DevToolsAgent::IsAttached() { | 395 bool DevToolsAgent::IsAttached() { |
395 return is_attached_; | 396 return is_attached_; |
396 } | 397 } |
397 | 398 |
398 } // namespace content | 399 } // namespace content |
OLD | NEW |