| 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_IMPL_H_ | 5 #ifndef WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_IMPL_H_ |
| 6 #define WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_IMPL_H_ | 6 #define WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <wtf/HashSet.h> | 8 #include <wtf/HashSet.h> |
| 9 | 9 |
| 10 #include "v8.h" | 10 #include "v8.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class String; | 21 class String; |
| 22 } | 22 } |
| 23 | 23 |
| 24 class DebuggerAgentImpl : public DebuggerAgent { | 24 class DebuggerAgentImpl : public DebuggerAgent { |
| 25 public: | 25 public: |
| 26 DebuggerAgentImpl(WebViewImpl* web_view_impl, | 26 DebuggerAgentImpl(WebViewImpl* web_view_impl, |
| 27 DebuggerAgentDelegate* delegate, | 27 DebuggerAgentDelegate* delegate, |
| 28 WebDevToolsAgentImpl* webdevtools_agent); | 28 WebDevToolsAgentImpl* webdevtools_agent); |
| 29 virtual ~DebuggerAgentImpl(); | 29 virtual ~DebuggerAgentImpl(); |
| 30 | 30 |
| 31 // Initializes dom agent with the given document. | 31 // Creates utility context with injected js agent. |
| 32 void SetDocument(WebCore::Document* document); | 32 void CreateUtilityContext(WebCore::Document* document, |
| 33 v8::Persistent<v8::Context>* context); |
| 33 | 34 |
| 34 // DebuggerAgent implementation. | 35 // DebuggerAgent implementation. |
| 35 virtual void DebugBreak(); | 36 virtual void DebugBreak(); |
| 36 | 37 |
| 37 void DebuggerOutput(const std::string& out); | 38 void DebuggerOutput(const std::string& out); |
| 38 | 39 |
| 39 // Executes utility function with the given node and json | 40 // Executes function with the given name in the utility context. Passes node |
| 40 // args as parameters. These functions must be implemented in | 41 // and json args as parameters. Note that the function called must be |
| 41 // the inject.js file. | 42 // implemented in the inject.js file. |
| 42 WebCore::String ExecuteUtilityFunction( | 43 WebCore::String ExecuteUtilityFunction( |
| 44 v8::Handle<v8::Context> context, |
| 43 const WebCore::String& function_name, | 45 const WebCore::String& function_name, |
| 44 WebCore::Node* node, | 46 WebCore::Node* node, |
| 45 const WebCore::String& json_args, | 47 const WebCore::String& json_args, |
| 46 WebCore::String* exception); | 48 WebCore::String* exception); |
| 47 | 49 |
| 48 static void RunWithDeferredMessages( | 50 static void RunWithDeferredMessages( |
| 49 const HashSet<DebuggerAgentImpl*>& agents, | 51 const HashSet<DebuggerAgentImpl*>& agents, |
| 50 WebDevToolsAgent::MessageLoopDispatchHandler handler); | 52 WebDevToolsAgent::MessageLoopDispatchHandler handler); |
| 51 | 53 |
| 52 WebCore::Page* GetPage(); | 54 WebCore::Page* GetPage(); |
| 53 WebDevToolsAgentImpl* webdevtools_agent() { return webdevtools_agent_; }; | 55 WebDevToolsAgentImpl* webdevtools_agent() { return webdevtools_agent_; }; |
| 54 | 56 |
| 55 WebViewImpl* web_view() { return web_view_impl_; } | 57 WebViewImpl* web_view() { return web_view_impl_; } |
| 56 | 58 |
| 57 private: | 59 private: |
| 58 v8::Persistent<v8::Context> context_; | |
| 59 WebViewImpl* web_view_impl_; | 60 WebViewImpl* web_view_impl_; |
| 60 DebuggerAgentDelegate* delegate_; | 61 DebuggerAgentDelegate* delegate_; |
| 61 WebDevToolsAgentImpl* webdevtools_agent_; | 62 WebDevToolsAgentImpl* webdevtools_agent_; |
| 62 | 63 |
| 63 DISALLOW_COPY_AND_ASSIGN(DebuggerAgentImpl); | 64 DISALLOW_COPY_AND_ASSIGN(DebuggerAgentImpl); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 #endif // WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_IMPL_H_ | 67 #endif // WEBKIT_GLUE_DEVTOOLS_DEBUGGER_AGENT_IMPL_H_ |
| OLD | NEW |