| 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 WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_MANAGER_H_ | 5 #ifndef WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_MANAGER_H_ |
| 6 #define WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_MANAGER_H_ | 6 #define WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <wtf/HashMap.h> | 8 #include <wtf/HashMap.h> |
| 9 #include <wtf/Noncopyable.h> | 9 #include <wtf/Noncopyable.h> |
| 10 | 10 |
| 11 #include "v8/include/v8-debug.h" | 11 #include "v8/include/v8-debug.h" |
| 12 #include "webkit/api/public/WebDevToolsAgent.h" | 12 #include "webkit/api/public/WebDevToolsAgent.h" |
| 13 | 13 |
| 14 namespace WebCore { | 14 namespace WebCore { |
| 15 class PageGroupLoadDeferrer; | 15 class PageGroupLoadDeferrer; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace WebKit { |
| 19 class WebFrameImpl; |
| 20 class WebViewImpl; |
| 21 } |
| 22 |
| 18 class DebuggerAgentImpl; | 23 class DebuggerAgentImpl; |
| 19 class DictionaryValue; | 24 class DictionaryValue; |
| 20 class WebFrameImpl; | |
| 21 class WebViewImpl; | |
| 22 | 25 |
| 23 // There is single v8 instance per render process. Also there may be several | 26 // There is single v8 instance per render process. Also there may be several |
| 24 // RenderViews and consequently devtools agents in the process that want to talk | 27 // RenderViews and consequently devtools agents in the process that want to talk |
| 25 // to the v8 debugger. This class coordinates communication between the debug | 28 // to the v8 debugger. This class coordinates communication between the debug |
| 26 // agents and v8 debugger. It will set debug output handler as long as at least | 29 // agents and v8 debugger. It will set debug output handler as long as at least |
| 27 // one debugger agent is attached and remove it when last debugger agent is | 30 // one debugger agent is attached and remove it when last debugger agent is |
| 28 // detached. When message is received from debugger it will route it to the | 31 // detached. When message is received from debugger it will route it to the |
| 29 // right debugger agent if there is one otherwise the message will be ignored. | 32 // right debugger agent if there is one otherwise the message will be ignored. |
| 30 // | 33 // |
| 31 // v8 may send a message(e.g. exception event) after which it | 34 // v8 may send a message(e.g. exception event) after which it |
| 32 // would expect some actions from the handler. If there is no appropriate | 35 // would expect some actions from the handler. If there is no appropriate |
| 33 // debugger agent to handle such messages the manager will perform the action | 36 // debugger agent to handle such messages the manager will perform the action |
| 34 // itself, otherwise v8 may hang waiting for the action. | 37 // itself, otherwise v8 may hang waiting for the action. |
| 35 class DebuggerAgentManager : public Noncopyable { | 38 class DebuggerAgentManager : public Noncopyable { |
| 36 public: | 39 public: |
| 37 static void DebugAttach(DebuggerAgentImpl* debugger_agent); | 40 static void DebugAttach(DebuggerAgentImpl* debugger_agent); |
| 38 static void DebugDetach(DebuggerAgentImpl* debugger_agent); | 41 static void DebugDetach(DebuggerAgentImpl* debugger_agent); |
| 39 static void DebugBreak(DebuggerAgentImpl* debugger_agent); | 42 static void DebugBreak(DebuggerAgentImpl* debugger_agent); |
| 40 static void DebugCommand(const WebCore::String& command); | 43 static void DebugCommand(const WebCore::String& command); |
| 41 | 44 |
| 42 static void ExecuteDebuggerCommand(const WebCore::String& command, | 45 static void ExecuteDebuggerCommand(const WebCore::String& command, |
| 43 int caller_id); | 46 int caller_id); |
| 44 static void SetMessageLoopDispatchHandler( | 47 static void SetMessageLoopDispatchHandler( |
| 45 WebKit::WebDevToolsAgent::MessageLoopDispatchHandler handler); | 48 WebKit::WebDevToolsAgent::MessageLoopDispatchHandler handler); |
| 46 | 49 |
| 47 // Sets |host_id| as the frame context data. This id is used to filter scripts | 50 // Sets |host_id| as the frame context data. This id is used to filter scripts |
| 48 // related to the inspected page. | 51 // related to the inspected page. |
| 49 static void SetHostId(WebFrameImpl* webframe, int host_id); | 52 static void SetHostId(WebKit::WebFrameImpl* webframe, int host_id); |
| 50 | 53 |
| 51 static void OnWebViewClosed(WebViewImpl* webview); | 54 static void OnWebViewClosed(WebKit::WebViewImpl* webview); |
| 52 | 55 |
| 53 static void OnNavigate(); | 56 static void OnNavigate(); |
| 54 | 57 |
| 55 class UtilityContextScope : public Noncopyable { | 58 class UtilityContextScope : public Noncopyable { |
| 56 public: | 59 public: |
| 57 UtilityContextScope() { | 60 UtilityContextScope() { |
| 58 ASSERT(!in_utility_context_); | 61 ASSERT(!in_utility_context_); |
| 59 in_utility_context_ = true; | 62 in_utility_context_ = true; |
| 60 } | 63 } |
| 61 ~UtilityContextScope() { | 64 ~UtilityContextScope() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 79 | 82 |
| 80 static DebuggerAgentImpl* FindAgentForCurrentV8Context(); | 83 static DebuggerAgentImpl* FindAgentForCurrentV8Context(); |
| 81 static DebuggerAgentImpl* DebuggerAgentForHostId(int host_id); | 84 static DebuggerAgentImpl* DebuggerAgentForHostId(int host_id); |
| 82 | 85 |
| 83 typedef HashMap<int, DebuggerAgentImpl*> AttachedAgentsMap; | 86 typedef HashMap<int, DebuggerAgentImpl*> AttachedAgentsMap; |
| 84 static AttachedAgentsMap* attached_agents_map_; | 87 static AttachedAgentsMap* attached_agents_map_; |
| 85 | 88 |
| 86 static WebKit::WebDevToolsAgent::MessageLoopDispatchHandler | 89 static WebKit::WebDevToolsAgent::MessageLoopDispatchHandler |
| 87 message_loop_dispatch_handler_; | 90 message_loop_dispatch_handler_; |
| 88 static bool in_host_dispatch_handler_; | 91 static bool in_host_dispatch_handler_; |
| 89 typedef HashMap<WebViewImpl*, WebCore::PageGroupLoadDeferrer*> | 92 typedef HashMap<WebKit::WebViewImpl*, WebCore::PageGroupLoadDeferrer*> |
| 90 DeferrersMap; | 93 DeferrersMap; |
| 91 static DeferrersMap page_deferrers_; | 94 static DeferrersMap page_deferrers_; |
| 92 | 95 |
| 93 static bool in_utility_context_; | 96 static bool in_utility_context_; |
| 94 static bool debug_break_delayed_; | 97 static bool debug_break_delayed_; |
| 95 }; | 98 }; |
| 96 | 99 |
| 97 #endif // WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_MANAGER_H_ | 100 #endif // WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_MANAGER_H_ |
| OLD | NEW |