Changeset 126363 in webkit
- Timestamp:
- Aug 22, 2012 3:52:16 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r126362 r126363 1 2012-08-22 Kentaro Hara <haraken@chromium.org> 2 3 [V8] Move context() from V8Proxy to ScriptController 4 https://bugs.webkit.org/show_bug.cgi?id=94593 5 6 Reviewed by Adam Barth. 7 8 - This patch removes V8Proxy::context(Frame*). 9 - This patch moves V8Proxy::context() to ScriptController::context(). 10 - This patch renames ScriptController::context() to ScriptController::currentWorldContext(), 11 for naming consistency with ScriptController::maintWorldContext(). 12 13 No tests. No change in behavior. 14 15 * bindings/scripts/CodeGeneratorV8.pm: 16 (GenerateToV8Converters): 17 * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: 18 (WebCore::V8TestActiveDOMObject::wrapSlow): 19 * bindings/scripts/test/V8/V8TestNode.cpp: 20 (WebCore::V8TestNode::wrapSlow): 21 * bindings/v8/ScriptController.cpp: 22 (WebCore::ScriptController::context): 23 (WebCore): 24 * bindings/v8/ScriptController.h: 25 (ScriptController): 26 * bindings/v8/V8DOMWrapper.cpp: 27 (WebCore::V8DOMWrapper::setNamedHiddenWindowReference): 28 * bindings/v8/V8Proxy.cpp: 29 * bindings/v8/V8Proxy.h: 30 (V8Proxy): 31 * bindings/v8/custom/V8DOMWindowCustom.cpp: 32 (WebCore::WindowSetTimeoutImpl): 33 (WebCore::V8DOMWindow::eventAccessorGetter): 34 (WebCore::V8DOMWindow::eventAccessorSetter): 35 (WebCore::DialogHandler::dialogCreated): 36 (WebCore::toV8): 37 * bindings/v8/custom/V8HTMLDocumentCustom.cpp: 38 (WebCore::V8HTMLDocument::openCallback): 39 1 40 2012-08-22 Kentaro Hara <haraken@chromium.org> 2 41 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r126362 r126363 3398 3398 // For performance, we enter the context only if the currently running context 3399 3399 // is different from the context that we are about to enter. 3400 context = proxy-> context();3400 context = proxy->frame()->script()->currentWorldContext(); 3401 3401 if (!context.IsEmpty()) 3402 3402 context->Enter(); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp
r126362 r126363 192 192 // For performance, we enter the context only if the currently running context 193 193 // is different from the context that we are about to enter. 194 context = proxy-> context();194 context = proxy->frame()->script()->currentWorldContext(); 195 195 if (!context.IsEmpty()) 196 196 context->Enter(); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp
r126362 r126363 122 122 // For performance, we enter the context only if the currently running context 123 123 // is different from the context that we are about to enter. 124 context = proxy-> context();124 context = proxy->frame()->script()->currentWorldContext(); 125 125 if (!context.IsEmpty()) 126 126 context->Enter(); -
trunk/Source/WebCore/bindings/v8/ScriptController.cpp
r126123 r126363 377 377 } 378 378 379 v8::Local<v8::Context> ScriptController::currentWorldContext() 380 { 381 if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) { 382 RefPtr<SharedPersistent<v8::Context> > context = isolatedContext->sharedContext(); 383 if (m_frame != toFrameIfNotDetached(context->get())) 384 return v8::Local<v8::Context>(); 385 return v8::Local<v8::Context>::New(context->get()); 386 } 387 return mainWorldContext(); 388 } 389 379 390 v8::Local<v8::Context> ScriptController::mainWorldContext() 380 391 { -
trunk/Source/WebCore/bindings/v8/ScriptController.h
r126222 r126363 155 155 static Frame* retrieveFrameForCurrentContext(); 156 156 157 // Returns V8 Context of a frame. If none exists, creates158 // a new context.It is potentially slow and consumes memory.157 // Returns V8 Context. If none exists, creates a new context. 158 // It is potentially slow and consumes memory. 159 159 static v8::Local<v8::Context> mainWorldContext(Frame*); 160 160 v8::Local<v8::Context> mainWorldContext(); 161 v8::Local<v8::Context> currentWorldContext(); 161 162 162 163 // Pass command-line flags to the JS engine. -
trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp
r126362 r126363 130 130 if (!frame) 131 131 return; // Object might be detached from window 132 v8::Handle<v8::Context> context = V8Proxy::context(frame);132 v8::Handle<v8::Context> context = frame->script()->currentWorldContext(); 133 133 if (context.IsEmpty()) 134 134 return; -
trunk/Source/WebCore/bindings/v8/V8Proxy.cpp
r126360 r126363 179 179 } 180 180 181 v8::Local<v8::Context> V8Proxy::context(Frame* frame)182 {183 v8::Local<v8::Context> context = ScriptController::mainWorldContext(frame);184 if (context.IsEmpty())185 return v8::Local<v8::Context>();186 187 if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) {188 context = v8::Local<v8::Context>::New(isolatedContext->context());189 if (frame != toFrameIfNotDetached(context))190 return v8::Local<v8::Context>();191 }192 193 return context;194 }195 196 v8::Local<v8::Context> V8Proxy::context()197 {198 if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) {199 RefPtr<SharedPersistent<v8::Context> > context = isolatedContext->sharedContext();200 if (m_frame != toFrameIfNotDetached(context->get()))201 return v8::Local<v8::Context>();202 return v8::Local<v8::Context>::New(context->get());203 }204 return frame()->script()->mainWorldContext();205 }206 207 181 v8::Local<v8::Context> V8Proxy::isolatedWorldContext(int worldId) 208 182 { -
trunk/Source/WebCore/bindings/v8/V8Proxy.h
r126360 r126363 98 98 v8::Local<v8::Value> runScript(v8::Handle<v8::Script>); 99 99 100 // Returns V8 Context of a frame. If none exists, creates101 // a new context. It is potentially slow and consumes memory.102 static v8::Local<v8::Context> context(Frame*);103 104 v8::Local<v8::Context> context();105 100 v8::Local<v8::Context> isolatedWorldContext(int worldId); 106 101 bool matchesCurrentContext(); -
trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
r125615 r126363 62 62 #include "V8HTMLCollection.h" 63 63 #include "V8Node.h" 64 #include "V8Proxy.h"65 64 #include "V8Utilities.h" 66 65 #include "WindowFeatures.h" … … 122 121 123 122 // params is passed to action, and released in action's destructor 124 OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(V8Proxy::context(imp->frame()), v8::Handle<v8::Function>::Cast(function), paramCount, params)); 123 ASSERT(imp->frame()); 124 OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), v8::Handle<v8::Function>::Cast(function), paramCount, params)); 125 125 126 126 // FIXME: We should use OwnArrayPtr for params. … … 132 132 if (imp->document() && !imp->document()->contentSecurityPolicy()->allowEval(callStack.release())) 133 133 return v8Integer(0, args.GetIsolate()); 134 id = DOMTimer::install(scriptContext, adoptPtr(new ScheduledAction(V8Proxy::context(imp->frame()), functionString)), timeout, singleShot); 134 ASSERT(imp->frame()); 135 id = DOMTimer::install(scriptContext, adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), functionString)), timeout, singleShot); 135 136 } 136 137 … … 155 156 return v8::Undefined(); 156 157 157 v8::Local<v8::Context> context = V8Proxy::context(frame); 158 ASSERT(frame); 159 v8::Local<v8::Context> context = frame->script()->currentWorldContext(); 158 160 if (context.IsEmpty()) 159 161 return v8::Undefined(); … … 176 178 return; 177 179 178 v8::Local<v8::Context> context = V8Proxy::context(frame); 180 ASSERT(frame); 181 v8::Local<v8::Context> context = frame->script()->currentWorldContext(); 179 182 if (context.IsEmpty()) 180 183 return; … … 403 406 inline void DialogHandler::dialogCreated(DOMWindow* dialogFrame) 404 407 { 405 m_dialogContext = V8Proxy::context(dialogFrame->frame());408 m_dialogContext = dialogFrame->frame() ? dialogFrame->frame()->script()->currentWorldContext() : v8::Local<v8::Context>(); 406 409 if (m_dialogContext.IsEmpty()) 407 410 return; … … 622 625 623 626 // Otherwise, return the global object associated with this frame. 624 v8::Handle<v8::Context> context = V8Proxy::context(frame);627 v8::Handle<v8::Context> context = frame->script()->currentWorldContext(); 625 628 if (context.IsEmpty()) 626 629 return v8Undefined(); -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
r125998 r126363 45 45 #include "V8IsolatedContext.h" 46 46 #include "V8Node.h" 47 #include "V8Proxy.h"48 47 #include "V8RecursionScope.h" 49 48 #include <wtf/text/StringBuilder.h> … … 143 142 if (RefPtr<Frame> frame = htmlDocument->frame()) { 144 143 // Fetch the global object for the frame. 145 v8::Local<v8::Context> context = V8Proxy::context(frame.get());144 v8::Local<v8::Context> context = frame->script()->currentWorldContext(); 146 145 // Bail out if we cannot get the context. 147 146 if (context.IsEmpty()) -
trunk/Source/WebKit/chromium/ChangeLog
r126359 r126363 1 2012-08-22 Kentaro Hara <haraken@chromium.org> 2 3 [V8] Move context() from V8Proxy to ScriptController 4 https://bugs.webkit.org/show_bug.cgi?id=94593 5 6 Reviewed by Adam Barth. 7 8 To kill V8Proxy, we can move context() from V8Proxy to ScriptController. 9 10 No tests. No change in behavior. 11 12 * src/InspectorFrontendClientImpl.cpp: 13 (WebKit::InspectorFrontendClientImpl::windowObjectCleared): 14 * src/WebDevToolsFrontendImpl.cpp: 15 (WebKit::WebDevToolsFrontendImpl::dispatchOnInspectorFrontend): 16 1 17 2012-08-22 Nikhil Bhargava <nbhargava@google.com> 2 18 -
trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
r124765 r126363 37 37 #include "Page.h" 38 38 #include "PlatformString.h" 39 #include "ScriptController.h" 39 40 #include "V8InspectorFrontendHost.h" 40 #include "V8Proxy.h"41 41 #include "WebDevToolsFrontendClient.h" 42 42 #include "WebDevToolsFrontendImpl.h" … … 64 64 { 65 65 v8::HandleScope handleScope; 66 v8::Handle<v8::Context> frameContext = V8Proxy::context(m_frontendPage->mainFrame());66 v8::Handle<v8::Context> frameContext = m_frontendPage->mainFrame() ? m_frontendPage->mainFrame()->script()->currentWorldContext() : v8::Local<v8::Context>(); 67 67 v8::Context::Scope contextScope(frameContext); 68 68 -
trunk/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp
r126109 r126363 45 45 #include "Pasteboard.h" 46 46 #include "PlatformString.h" 47 #include "ScriptController.h" 47 48 #include "SecurityOrigin.h" 48 49 #include "Settings.h" … … 52 53 #include "V8MouseEvent.h" 53 54 #include "V8Node.h" 54 #include "V8Proxy.h"55 55 #include "V8Utilities.h" 56 56 #include "WebDevToolsFrontendClient.h" … … 108 108 WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); 109 109 v8::HandleScope scope; 110 v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame());110 v8::Handle<v8::Context> frameContext = frame->frame() ? frame->frame()->script()->currentWorldContext() : v8::Local<v8::Context>(); 111 111 v8::Context::Scope contextScope(frameContext); 112 112 v8::Handle<v8::Value> inspectorBackendValue = frameContext->Global()->Get(v8::String::New("InspectorBackend"));
Note: See TracChangeset
for help on using the changeset viewer.