| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_RENDERER_DEVTOOLS_AGENT_H_ | 5 #ifndef CHROME_RENDERER_DEVTOOLS_AGENT_H_ |
| 6 #define CHROME_RENDERER_DEVTOOLS_AGENT_H_ | 6 #define CHROME_RENDERER_DEVTOOLS_AGENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 virtual ~DevToolsAgent(); | 31 virtual ~DevToolsAgent(); |
| 32 | 32 |
| 33 // WebDevToolsAgentDelegate implementation | 33 // WebDevToolsAgentDelegate implementation |
| 34 virtual void SendMessageToClient(const std::string& raw_msg); | 34 virtual void SendMessageToClient(const std::string& raw_msg); |
| 35 | 35 |
| 36 // DevToolsAgent is created by RenderView which is supposed to call this | 36 // DevToolsAgent is created by RenderView which is supposed to call this |
| 37 // method from its destructor. | 37 // method from its destructor. |
| 38 void RenderViewDestroyed(); | 38 void RenderViewDestroyed(); |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // Sends message to DevToolsClient. May be called on any thread. | 41 // Sends message to DevToolsClient. Should be called on the render thread. |
| 42 void Send(const IPC::Message& tools_client_message); | 42 void Send(const IPC::Message& tools_client_message); |
| 43 | 43 |
| 44 // Sends message to DevToolsClient. Must be called on IO thread. Takes | |
| 45 // ownership of the message. | |
| 46 void SendFromIOThread(IPC::Message* message); | |
| 47 | |
| 48 // IPC::ChannelProxy::MessageFilter overrides. Called on IO thread. | 44 // IPC::ChannelProxy::MessageFilter overrides. Called on IO thread. |
| 49 virtual void OnFilterAdded(IPC::Channel* channel); | 45 virtual void OnFilterAdded(IPC::Channel* channel); |
| 50 virtual bool OnMessageReceived(const IPC::Message& message); | 46 virtual bool OnMessageReceived(const IPC::Message& message); |
| 51 virtual void OnFilterRemoved(); | 47 virtual void OnFilterRemoved(); |
| 52 | 48 |
| 53 void Attach(); | 49 void Attach(); |
| 54 void Detach(); | 50 void Detach(); |
| 55 void DispatchRpcMessage(const std::string& raw_msg); | 51 void DispatchRpcMessage(const std::string& raw_msg); |
| 56 void InspectElement(int x, int y); | 52 void InspectElement(int x, int y); |
| 57 WebDevToolsAgent* GetWebAgent(); | 53 WebDevToolsAgent* GetWebAgent(); |
| 58 | 54 |
| 59 // Evaluate javascript URL in the renderer | 55 // Evaluate javascript URL in the renderer |
| 60 void EvaluateScript(const std::wstring& script); | 56 void EvaluateScript(const std::wstring& script); |
| 61 | 57 |
| 62 // All these OnXXX methods will be executed in IO thread so that we can | 58 // All these OnXXX methods will be executed in IO thread so that we can |
| 63 // handle debug messages even when v8 is stopped. | 59 // handle debug messages even when v8 is stopped. |
| 64 void OnAttach(); | 60 void OnAttach(); |
| 65 void OnDetach(); | 61 void OnDetach(); |
| 66 void OnRpcMessage(const std::string& raw_msg); | 62 void OnRpcMessage(const std::string& raw_msg); |
| 67 void OnDebuggerCommand(const std::string& command); | 63 void OnDebuggerCommand(const std::string& command); |
| 68 void OnInspectElement(int x, int y); | 64 void OnInspectElement(int x, int y); |
| 69 | 65 |
| 70 int routing_id_; // View routing id that we can access from IO thread. | 66 int routing_id_; // View routing id that we can access from IO thread. |
| 71 RenderView* view_; | 67 RenderView* view_; |
| 72 MessageLoop* view_loop_; | 68 MessageLoop* view_loop_; |
| 73 | 69 |
| 74 IPC::Channel* channel_; | |
| 75 MessageLoop* io_loop_; | 70 MessageLoop* io_loop_; |
| 76 | 71 |
| 77 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); | 72 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); |
| 78 }; | 73 }; |
| 79 | 74 |
| 80 #endif // CHROME_RENDERER_DEVTOOLS_AGENT_H_ | 75 #endif // CHROME_RENDERER_DEVTOOLS_AGENT_H_ |
| OLD | NEW |