| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_agent_filter.h" | 5 #include "content/renderer/devtools_agent_filter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "content/common/devtools_messages.h" | 9 #include "content/common/devtools_messages.h" |
| 10 #include "content/renderer/devtools_agent.h" | 10 #include "content/renderer/devtools_agent.h" |
| 11 #include "content/renderer/plugin_channel_host.h" | 11 #include "content/renderer/plugin_channel_host.h" |
| 12 #include "content/renderer/render_thread.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 14 | 15 |
| 15 using WebKit::WebDevToolsAgent; | 16 using WebKit::WebDevToolsAgent; |
| 16 using WebKit::WebString; | 17 using WebKit::WebString; |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 class MessageImpl : public WebDevToolsAgent::MessageDescriptor { | 21 class MessageImpl : public WebDevToolsAgent::MessageDescriptor { |
| 21 public: | 22 public: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 IPC_END_MESSAGE_MAP() | 62 IPC_END_MESSAGE_MAP() |
| 62 return message_handled_; | 63 return message_handled_; |
| 63 } | 64 } |
| 64 | 65 |
| 65 void DevToolsAgentFilter::OnFilterAdded(IPC::Channel* channel) { | 66 void DevToolsAgentFilter::OnFilterAdded(IPC::Channel* channel) { |
| 66 channel_ = channel; | 67 channel_ = channel; |
| 67 } | 68 } |
| 68 | 69 |
| 69 void DevToolsAgentFilter::OnDispatchOnInspectorBackend( | 70 void DevToolsAgentFilter::OnDispatchOnInspectorBackend( |
| 70 const std::string& message) { | 71 const std::string& message) { |
| 72 RenderThread::current()->EnsureWebKitInitialized(); |
| 71 if (!WebDevToolsAgent::shouldInterruptForMessage( | 73 if (!WebDevToolsAgent::shouldInterruptForMessage( |
| 72 WebString::fromUTF8(message))) { | 74 WebString::fromUTF8(message))) { |
| 73 message_handled_ = false; | 75 message_handled_ = false; |
| 74 return; | 76 return; |
| 75 } | 77 } |
| 76 WebDevToolsAgent::interruptAndDispatch( | 78 WebDevToolsAgent::interruptAndDispatch( |
| 77 new MessageImpl(message, current_routing_id_)); | 79 new MessageImpl(message, current_routing_id_)); |
| 78 | 80 |
| 79 render_thread_loop_->PostTask( | 81 render_thread_loop_->PostTask( |
| 80 FROM_HERE, base::Bind(&WebDevToolsAgent::processPendingMessages)); | 82 FROM_HERE, base::Bind(&WebDevToolsAgent::processPendingMessages)); |
| 81 } | 83 } |
| OLD | NEW |