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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include <wtf/HashSet.h> | 7 #include <wtf/HashSet.h> |
8 #include <wtf/RefPtr.h> | 8 #include <wtf/RefPtr.h> |
9 #include <wtf/Vector.h> | 9 #include <wtf/Vector.h> |
10 | 10 |
11 #include "Document.h" | 11 #include "Document.h" |
12 #include "Page.h" | 12 #include "Page.h" |
| 13 #include "V8Binding.h" |
| 14 #include "V8DOMWindow.h" |
| 15 #include "V8Index.h" |
| 16 #include "V8Proxy.h" |
13 #undef LOG | 17 #undef LOG |
14 | 18 |
15 #include "base/string_piece.h" | 19 #include "base/string_piece.h" |
16 #include "grit/webkit_resources.h" | 20 #include "grit/webkit_resources.h" |
17 #include "V8Binding.h" | |
18 #include "V8DOMWindow.h" | |
19 #include "V8Index.h" | |
20 #include "v8_binding.h" | |
21 #include "v8_proxy.h" | |
22 #include "webkit/glue/devtools/debugger_agent_impl.h" | 21 #include "webkit/glue/devtools/debugger_agent_impl.h" |
23 #include "webkit/glue/devtools/debugger_agent_manager.h" | 22 #include "webkit/glue/devtools/debugger_agent_manager.h" |
24 #include "webkit/glue/glue_util.h" | 23 #include "webkit/glue/glue_util.h" |
25 #include "webkit/glue/webdevtoolsagent_impl.h" | 24 #include "webkit/glue/webdevtoolsagent_impl.h" |
26 #include "webkit/glue/webkit_glue.h" | 25 #include "webkit/glue/webkit_glue.h" |
27 #include "webkit/glue/webview_impl.h" | 26 #include "webkit/glue/webview_impl.h" |
28 | 27 |
29 using WebCore::DOMWindow; | 28 using WebCore::DOMWindow; |
30 using WebCore::Document; | 29 using WebCore::Document; |
31 using WebCore::Frame; | 30 using WebCore::Frame; |
(...skipping 23 matching lines...) Expand all Loading... |
55 DebuggerAgentManager::DebugBreak(this); | 54 DebuggerAgentManager::DebugBreak(this); |
56 } | 55 } |
57 | 56 |
58 void DebuggerAgentImpl::GetContextId() { | 57 void DebuggerAgentImpl::GetContextId() { |
59 delegate_->DidGetContextId(webdevtools_agent_->host_id()); | 58 delegate_->DidGetContextId(webdevtools_agent_->host_id()); |
60 } | 59 } |
61 | 60 |
62 void DebuggerAgentImpl::StartProfiling() { | 61 void DebuggerAgentImpl::StartProfiling() { |
63 v8::HandleScope scope; | 62 v8::HandleScope scope; |
64 WebCore::V8Proxy* proxy = V8Proxy::retrieve(GetPage()->mainFrame()); | 63 WebCore::V8Proxy* proxy = V8Proxy::retrieve(GetPage()->mainFrame()); |
65 DCHECK(proxy && proxy->ContextInitialized()); | 64 DCHECK(proxy && proxy->isContextInitialized()); |
66 v8::Context::Scope context_scope(proxy->GetContext()); | 65 v8::Context::Scope context_scope(proxy->context()); |
67 v8::V8::ResumeProfiler(); | 66 v8::V8::ResumeProfiler(); |
68 } | 67 } |
69 | 68 |
70 void DebuggerAgentImpl::StopProfiling() { | 69 void DebuggerAgentImpl::StopProfiling() { |
71 v8::V8::PauseProfiler(); | 70 v8::V8::PauseProfiler(); |
72 } | 71 } |
73 | 72 |
74 void DebuggerAgentImpl::IsProfilingStarted() { | 73 void DebuggerAgentImpl::IsProfilingStarted() { |
75 delegate_->DidIsProfilingStarted(!v8::V8::IsProfilerPaused()); | 74 delegate_->DidIsProfilingStarted(!v8::V8::IsProfilerPaused()); |
76 } | 75 } |
(...skipping 21 matching lines...) Expand all Loading... |
98 context->Clear(); | 97 context->Clear(); |
99 } | 98 } |
100 if (!document) { | 99 if (!document) { |
101 return; | 100 return; |
102 } | 101 } |
103 v8::HandleScope scope; | 102 v8::HandleScope scope; |
104 | 103 |
105 // TODO(pfeldman): Validate against Soeren. | 104 // TODO(pfeldman): Validate against Soeren. |
106 // Set up the DOM window as the prototype of the new global object. | 105 // Set up the DOM window as the prototype of the new global object. |
107 v8::Handle<v8::Context> window_context = | 106 v8::Handle<v8::Context> window_context = |
108 V8Proxy::GetContext(document->frame()); | 107 V8Proxy::context(document->frame()); |
109 v8::Handle<v8::Object> window_global = window_context->Global(); | 108 v8::Handle<v8::Object> window_global = window_context->Global(); |
110 v8::Handle<v8::Value> window_wrapper = | 109 v8::Handle<v8::Value> window_wrapper = |
111 V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, window_global); | 110 V8Proxy::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, window_global); |
112 | 111 |
113 ASSERT(V8Proxy::DOMWrapperToNative<DOMWindow>(window_wrapper) == | 112 ASSERT(V8Proxy::convertDOMWrapperToNative<DOMWindow>(window_wrapper) == |
114 document->frame()->domWindow()); | 113 document->frame()->domWindow()); |
115 | 114 |
116 // Create a new environment using an empty template for the shadow | 115 // Create a new environment using an empty template for the shadow |
117 // object. Reuse the global object if one has been created earlier. | 116 // object. Reuse the global object if one has been created earlier. |
118 v8::Handle<v8::ObjectTemplate> global_template = | 117 v8::Handle<v8::ObjectTemplate> global_template = |
119 V8DOMWindow::GetShadowObjectTemplate(); | 118 V8DOMWindow::GetShadowObjectTemplate(); |
120 | 119 |
121 // Install a security handler with V8. | 120 // Install a security handler with V8. |
122 global_template->SetAccessCheckCallbacks( | 121 global_template->SetAccessCheckCallbacks( |
123 V8Custom::v8DOMWindowNamedSecurityCheck, | 122 V8Custom::v8DOMWindowNamedSecurityCheck, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return ""; | 179 return ""; |
181 } else { | 180 } else { |
182 v8::Handle<v8::String> res_json = v8::Handle<v8::String>::Cast(res_obj); | 181 v8::Handle<v8::String> res_json = v8::Handle<v8::String>::Cast(res_obj); |
183 return WebCore::toWebCoreString(res_json); | 182 return WebCore::toWebCoreString(res_json); |
184 } | 183 } |
185 } | 184 } |
186 | 185 |
187 WebCore::Page* DebuggerAgentImpl::GetPage() { | 186 WebCore::Page* DebuggerAgentImpl::GetPage() { |
188 return web_view_impl_->page(); | 187 return web_view_impl_->page(); |
189 } | 188 } |
OLD | NEW |