Title: [128123] trunk/Source
Revision
128123
Author
[email protected]
Date
2012-09-10 16:21:37 -0700 (Mon, 10 Sep 2012)

Log Message

[V8] Inline firstFrame and currentFrame into their unique callers
https://bugs.webkit.org/show_bug.cgi?id=96309

Patch by Adam Barth <[email protected]> on 2012-09-10
Reviewed by Eric Seidel.

Source/WebCore: 

These functions have only one caller. We'd prefer not to have more
callers (because there's usually no reason to indirect through the
Frame), so we should inline them into their one caller (which is the
Chromium WebKit API).

* bindings/js/BindingState.h:
(WebCore):
* bindings/v8/BindingState.cpp:
* bindings/v8/BindingState.h:
(WebCore):
* bindings/v8/ScriptController.cpp:
* bindings/v8/ScriptController.h:
(ScriptController):

Source/WebKit/chromium: 

This patch just lines these WebCore functions because we only call them
from here.

* src/WebFrameImpl.cpp:
(WebKit::WebFrame::frameForEnteredContext):
(WebKit::WebFrame::frameForCurrentContext):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (128122 => 128123)


--- trunk/Source/WebCore/ChangeLog	2012-09-10 23:13:47 UTC (rev 128122)
+++ trunk/Source/WebCore/ChangeLog	2012-09-10 23:21:37 UTC (rev 128123)
@@ -1,3 +1,24 @@
+2012-09-10  Adam Barth  <[email protected]>
+
+        [V8] Inline firstFrame and currentFrame into their unique callers
+        https://bugs.webkit.org/show_bug.cgi?id=96309
+
+        Reviewed by Eric Seidel.
+
+        These functions have only one caller. We'd prefer not to have more
+        callers (because there's usually no reason to indirect through the
+        Frame), so we should inline them into their one caller (which is the
+        Chromium WebKit API).
+
+        * bindings/js/BindingState.h:
+        (WebCore):
+        * bindings/v8/BindingState.cpp:
+        * bindings/v8/BindingState.h:
+        (WebCore):
+        * bindings/v8/ScriptController.cpp:
+        * bindings/v8/ScriptController.h:
+        (ScriptController):
+
 2012-09-10  Justin Novosad  <[email protected]>
 
         Implement canvas v5 line dash feature

Modified: trunk/Source/WebCore/bindings/js/BindingState.h (128122 => 128123)


--- trunk/Source/WebCore/bindings/js/BindingState.h	2012-09-10 23:13:47 UTC (rev 128122)
+++ trunk/Source/WebCore/bindings/js/BindingState.h	2012-09-10 23:21:37 UTC (rev 128123)
@@ -44,10 +44,6 @@
 DOMWindow* activeDOMWindow(BindingState*);
 DOMWindow* firstDOMWindow(BindingState*);
 
-// FIXME: Implement these functions.
-inline Frame* activeFrame(BindingState*) { return 0; }
-inline Frame* firstFrame(BindingState*) { return 0; }
-
 }
 
 #endif

Modified: trunk/Source/WebCore/bindings/v8/BindingState.cpp (128122 => 128123)


--- trunk/Source/WebCore/bindings/v8/BindingState.cpp	2012-09-10 23:13:47 UTC (rev 128122)
+++ trunk/Source/WebCore/bindings/v8/BindingState.cpp	2012-09-10 23:21:37 UTC (rev 128123)
@@ -66,22 +66,6 @@
     return toDOMWindow(v8::Context::GetEntered());
 }
 
-Frame* firstFrame(BindingState*)
-{
-    v8::Handle<v8::Context> context = v8::Context::GetEntered();
-    if (context.IsEmpty())
-        return 0;
-    return toFrameIfNotDetached(context);
-}
-
-Frame* currentFrame(BindingState*)
-{
-    v8::Handle<v8::Context> context = v8::Context::GetCurrent();
-    if (context.IsEmpty())
-        return 0;
-    return toFrameIfNotDetached(context);
-}
-
 Document* currentDocument(BindingState*)
 {
     DOMWindow* current = toDOMWindow(v8::Context::GetCurrent());

Modified: trunk/Source/WebCore/bindings/v8/BindingState.h (128122 => 128123)


--- trunk/Source/WebCore/bindings/v8/BindingState.h	2012-09-10 23:13:47 UTC (rev 128122)
+++ trunk/Source/WebCore/bindings/v8/BindingState.h	2012-09-10 23:21:37 UTC (rev 128123)
@@ -49,11 +49,8 @@
 DOMWindow* activeDOMWindow(BindingState*);
 DOMWindow* firstDOMWindow(BindingState*);
 
-Frame* firstFrame(BindingState*);
-
 // FIXME: When implementing this function for JSC, we need to understand if there
 // are any subtle differences between the currentFrame and the lexicalGlobalObject.
-Frame* currentFrame(BindingState*);
 Document* currentDocument(BindingState*);
 
 // FIXME: This function is redundant with the copy in JSDOMBinding.cpp.

Modified: trunk/Source/WebCore/bindings/v8/ScriptController.cpp (128122 => 128123)


--- trunk/Source/WebCore/bindings/v8/ScriptController.cpp	2012-09-10 23:13:47 UTC (rev 128122)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.cpp	2012-09-10 23:21:37 UTC (rev 128123)
@@ -92,16 +92,6 @@
     v8::V8::SetFlagsFromString(string, length);
 }
 
-Frame* ScriptController::retrieveFrameForEnteredContext()
-{
-    return firstFrame(BindingState::instance());
-}
-
-Frame* ScriptController::retrieveFrameForCurrentContext()
-{
-    return currentFrame(BindingState::instance());
-}
-
 bool ScriptController::canAccessFromCurrentOrigin(Frame *frame)
 {
     return !v8::Context::InContext() || BindingSecurity::shouldAllowAccessToFrame(BindingState::instance(), frame);

Modified: trunk/Source/WebCore/bindings/v8/ScriptController.h (128122 => 128123)


--- trunk/Source/WebCore/bindings/v8/ScriptController.h	2012-09-10 23:13:47 UTC (rev 128122)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.h	2012-09-10 23:21:37 UTC (rev 128123)
@@ -157,15 +157,6 @@
     // FIXME: void* is a compile hack.
     void attachDebugger(void*);
 
-    // --- Static methods assume we are running VM in single thread, ---
-    // --- and there is only one VM instance.                        ---
-
-    // Returns the frame for the entered context. See comments in
-    static Frame* retrieveFrameForEnteredContext();
-
-    // Returns the frame for the current context. See comments in
-    static Frame* retrieveFrameForCurrentContext();
-
     // Returns V8 Context. If none exists, creates a new context.
     // It is potentially slow and consumes memory.
     static v8::Local<v8::Context> mainWorldContext(Frame*);

Modified: trunk/Source/WebKit/chromium/ChangeLog (128122 => 128123)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-09-10 23:13:47 UTC (rev 128122)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-09-10 23:21:37 UTC (rev 128123)
@@ -1,3 +1,17 @@
+2012-09-10  Adam Barth  <[email protected]>
+
+        [V8] Inline firstFrame and currentFrame into their unique callers
+        https://bugs.webkit.org/show_bug.cgi?id=96309
+
+        Reviewed by Eric Seidel.
+
+        This patch just lines these WebCore functions because we only call them
+        from here.
+
+        * src/WebFrameImpl.cpp:
+        (WebKit::WebFrame::frameForEnteredContext):
+        (WebKit::WebFrame::frameForCurrentContext):
+
 2012-09-10  Rick Byers  <[email protected]>
 
         [chromium] Add unused GestureTapCancel

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (128122 => 128123)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2012-09-10 23:13:47 UTC (rev 128122)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2012-09-10 23:21:37 UTC (rev 128123)
@@ -571,16 +571,18 @@
 
 WebFrame* WebFrame::frameForEnteredContext()
 {
-    Frame* frame =
-        ScriptController::retrieveFrameForEnteredContext();
-    return WebFrameImpl::fromFrame(frame);
+    v8::Handle<v8::Context> context = v8::Context::GetEntered();
+    if (context.IsEmpty())
+        return 0;
+    return frameForContext(context);
 }
 
 WebFrame* WebFrame::frameForCurrentContext()
 {
-    Frame* frame =
-        ScriptController::retrieveFrameForCurrentContext();
-    return WebFrameImpl::fromFrame(frame);
+    v8::Handle<v8::Context> context = v8::Context::GetCurrent();
+    if (context.IsEmpty())
+        return 0;
+    return frameForContext(context);
 }
 
 #if WEBKIT_USING_V8
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to