| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_DEVTOOLS_AGENT_FILTER_H_ | |
| 6 #define CONTENT_RENDERER_DEVTOOLS_AGENT_FILTER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "ipc/ipc_channel_proxy.h" | |
| 11 | |
| 12 class MessageLoop; | |
| 13 struct DevToolsMessageData; | |
| 14 | |
| 15 namespace content { | |
| 16 | |
| 17 // DevToolsAgentFilter is registered as an IPC filter in order to be able to | |
| 18 // dispatch messages while on the IO thread. The reason for that is that while | |
| 19 // debugging, Render thread is being held by the v8 and hence no messages | |
| 20 // are being dispatched there. While holding the thread in a tight loop, | |
| 21 // v8 provides thread-safe Api for controlling debugger. In our case v8's Api | |
| 22 // is being used from this communication agent on the IO thread. | |
| 23 class DevToolsAgentFilter : public IPC::ChannelProxy::MessageFilter { | |
| 24 public: | |
| 25 // There is a single instance of this class instantiated by the RenderThread. | |
| 26 DevToolsAgentFilter(); | |
| 27 | |
| 28 static void SendRpcMessage(const DevToolsMessageData& data); | |
| 29 | |
| 30 // IPC::ChannelProxy::MessageFilter override. Called on IO thread. | |
| 31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 32 | |
| 33 protected: | |
| 34 virtual ~DevToolsAgentFilter(); | |
| 35 | |
| 36 private: | |
| 37 void OnDispatchOnInspectorBackend(const std::string& message); | |
| 38 | |
| 39 bool message_handled_; | |
| 40 MessageLoop* render_thread_loop_; | |
| 41 int current_routing_id_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(DevToolsAgentFilter); | |
| 44 }; | |
| 45 | |
| 46 } // namespace content | |
| 47 | |
| 48 #endif // CONTENT_RENDERER_DEVTOOLS_AGENT_FILTER_H_ | |
| OLD | NEW |