Title: [93055] trunk/Source
Revision
93055
Author
a...@chromium.org
Date
2011-08-15 12:52:19 -0700 (Mon, 15 Aug 2011)

Log Message

Pass additional details to client in didCreateIsolatedContext
https://bugs.webkit.org/show_bug.cgi?id=66037

Reviewed by Darin Fisher.

Source/WebCore:

* bindings/v8/IsolatedWorld.cpp:
(WebCore::IsolatedWorld::IsolatedWorld):
* bindings/v8/IsolatedWorld.h:
(WebCore::IsolatedWorld::create):
(WebCore::IsolatedWorld::id):
* bindings/v8/V8IsolatedContext.cpp:
(WebCore::V8IsolatedContext::V8IsolatedContext):
* bindings/v8/V8IsolatedContext.h:
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::evaluateInIsolatedWorld):
* loader/EmptyClients.h:
(WebCore::EmptyFrameLoaderClient::didCreateIsolatedScriptContext):
* loader/FrameLoaderClient.h:

Source/WebKit/chromium:

* public/WebFrameClient.h:
(WebKit::WebFrameClient::didCreateIsolatedScriptContext):
* src/FrameLoaderClientImpl.cpp:
(WebKit::FrameLoaderClientImpl::didCreateIsolatedScriptContext):
* src/FrameLoaderClientImpl.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93054 => 93055)


--- trunk/Source/WebCore/ChangeLog	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebCore/ChangeLog	2011-08-15 19:52:19 UTC (rev 93055)
@@ -1,3 +1,24 @@
+2011-08-15  Aaron Boodman  <a...@chromium.org>
+
+        Pass additional details to client in didCreateIsolatedContext
+        https://bugs.webkit.org/show_bug.cgi?id=66037
+
+        Reviewed by Darin Fisher.
+
+        * bindings/v8/IsolatedWorld.cpp:
+        (WebCore::IsolatedWorld::IsolatedWorld):
+        * bindings/v8/IsolatedWorld.h:
+        (WebCore::IsolatedWorld::create):
+        (WebCore::IsolatedWorld::id):
+        * bindings/v8/V8IsolatedContext.cpp:
+        (WebCore::V8IsolatedContext::V8IsolatedContext):
+        * bindings/v8/V8IsolatedContext.h:
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::evaluateInIsolatedWorld):
+        * loader/EmptyClients.h:
+        (WebCore::EmptyFrameLoaderClient::didCreateIsolatedScriptContext):
+        * loader/FrameLoaderClient.h:
+
 2011-08-15  Chris Rogers  <crog...@google.com>
 
         Add shell implementation for Web Audio API's MediaElementAudioSourceNode

Modified: trunk/Source/WebCore/bindings/v8/IsolatedWorld.cpp (93054 => 93055)


--- trunk/Source/WebCore/bindings/v8/IsolatedWorld.cpp	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebCore/bindings/v8/IsolatedWorld.cpp	2011-08-15 19:52:19 UTC (rev 93055)
@@ -35,9 +35,10 @@
 
 int IsolatedWorld::isolatedWorldCount = 0;
 
-IsolatedWorld::IsolatedWorld()
+IsolatedWorld::IsolatedWorld(int id)
 {
     ++isolatedWorldCount;
+    m_id = id;
 }
 
 IsolatedWorld::~IsolatedWorld()

Modified: trunk/Source/WebCore/bindings/v8/IsolatedWorld.h (93054 => 93055)


--- trunk/Source/WebCore/bindings/v8/IsolatedWorld.h	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebCore/bindings/v8/IsolatedWorld.h	2011-08-15 19:52:19 UTC (rev 93055)
@@ -39,16 +39,19 @@
 // An DOMWrapperWorld other than the thread's normal world.
 class IsolatedWorld : public DOMWrapperWorld {
 public:
-    static PassRefPtr<IsolatedWorld> create() { return adoptRef(new IsolatedWorld()); }
+    static PassRefPtr<IsolatedWorld> create(int id) { return adoptRef(new IsolatedWorld(id)); }
     static int count() { return isolatedWorldCount; }
 
+    int id() const { return m_id; }
     DOMDataStore* domDataStore() const { return m_domDataStore.getStore(); }
 
 protected:
-    IsolatedWorld();
+    explicit IsolatedWorld(int id);
     ~IsolatedWorld();
 
 private:
+    int m_id;
+
     // The backing store for the isolated world's DOM wrappers.  This class
     // doesn't have visibility into the wrappers.  This handle simply helps
     // manage their lifetime.

Modified: trunk/Source/WebCore/bindings/v8/V8IsolatedContext.cpp (93054 => 93055)


--- trunk/Source/WebCore/bindings/v8/V8IsolatedContext.cpp	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebCore/bindings/v8/V8IsolatedContext.cpp	2011-08-15 19:52:19 UTC (rev 93055)
@@ -48,8 +48,8 @@
     delete context;
 }
 
-V8IsolatedContext::V8IsolatedContext(V8Proxy* proxy, int extensionGroup)
-    : m_world(IsolatedWorld::create())
+V8IsolatedContext::V8IsolatedContext(V8Proxy* proxy, int extensionGroup, int worldId)
+    : m_world(IsolatedWorld::create(worldId))
 {
     v8::HandleScope scope;
     // FIXME: We should be creating a new V8DOMWindowShell here instead of riping out the context.
@@ -74,7 +74,7 @@
     //        changes.
     m_context->get()->UseDefaultSecurityToken();
 
-    proxy->frame()->loader()->client()->didCreateIsolatedScriptContext();
+    proxy->frame()->loader()->client()->didCreateIsolatedScriptContext(this);
 }
 
 void V8IsolatedContext::destroy()

Modified: trunk/Source/WebCore/bindings/v8/V8IsolatedContext.h (93054 => 93055)


--- trunk/Source/WebCore/bindings/v8/V8IsolatedContext.h	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebCore/bindings/v8/V8IsolatedContext.h	2011-08-15 19:52:19 UTC (rev 93055)
@@ -59,7 +59,7 @@
 public:
     // Creates an isolated world. To destroy it, call destroy().
     // This will delete the isolated world when the context it owns is GC'd.
-    V8IsolatedContext(V8Proxy*, int extensionGroup);
+    V8IsolatedContext(V8Proxy*, int extensionGroup, int worldId);
     ~V8IsolatedContext();
 
     // Call this to destroy the isolated world. It will be deleted sometime

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (93054 => 93055)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-08-15 19:52:19 UTC (rev 93055)
@@ -256,7 +256,7 @@
         if (iter != m_isolatedWorlds.end()) {
             isolatedContext = iter->second;
         } else {
-            isolatedContext = new V8IsolatedContext(this, extensionGroup);
+            isolatedContext = new V8IsolatedContext(this, extensionGroup, worldID);
             if (isolatedContext->context().IsEmpty()) {
                 delete isolatedContext;
                 return;
@@ -277,7 +277,7 @@
         if (securityOriginIter != m_isolatedWorldSecurityOrigins.end())
             isolatedContext->setSecurityOrigin(securityOriginIter->second);
     } else {
-        isolatedContext = new V8IsolatedContext(this, extensionGroup);
+        isolatedContext = new V8IsolatedContext(this, extensionGroup, worldID);
         if (isolatedContext->context().IsEmpty()) {
             delete isolatedContext;
             return;

Modified: trunk/Source/WebCore/loader/EmptyClients.h (93054 => 93055)


--- trunk/Source/WebCore/loader/EmptyClients.h	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2011-08-15 19:52:19 UTC (rev 93055)
@@ -46,6 +46,10 @@
 #include "ResourceError.h"
 #include "SearchPopupMenu.h"
 
+#if USE(V8)
+#include "V8IsolatedContext.h"
+#endif
+
 /*
  This file holds empty Client stubs for use by WebCore.
  Viewless element needs to create a dummy Page->Frame->FrameView tree for use in parsing or executing _javascript_.
@@ -397,7 +401,7 @@
 #if USE(V8)
     virtual void didCreateScriptContextForFrame() { }
     virtual void didDestroyScriptContextForFrame() { }
-    virtual void didCreateIsolatedScriptContext() { }
+    virtual void didCreateIsolatedScriptContext(V8IsolatedContext*) { }
     virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) { return false; }
 #endif
 

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (93054 => 93055)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2011-08-15 19:52:19 UTC (rev 93055)
@@ -87,6 +87,9 @@
     class SharedBuffer;
     class StringWithDirection;
     class SubstituteData;
+#if USE(V8)
+    class V8IsolatedContext;
+#endif
     class Widget;
 
     typedef void (PolicyChecker::*FramePolicyFunction)(PolicyAction);
@@ -273,7 +276,7 @@
 #if USE(V8)
         virtual void didCreateScriptContextForFrame() = 0;
         virtual void didDestroyScriptContextForFrame() = 0;
-        virtual void didCreateIsolatedScriptContext() = 0;
+        virtual void didCreateIsolatedScriptContext(V8IsolatedContext*) = 0;
         virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) = 0;
 #endif
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (93054 => 93055)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-08-15 19:52:19 UTC (rev 93055)
@@ -1,3 +1,16 @@
+2011-08-10  Aaron Boodman  <a...@chromium.org>
+
+        Pass additional details to client in didCreateIsolatedContext
+        https://bugs.webkit.org/show_bug.cgi?id=66037
+
+        Reviewed by Darin Fisher.
+
+        * public/WebFrameClient.h:
+        (WebKit::WebFrameClient::didCreateIsolatedScriptContext):
+        * src/FrameLoaderClientImpl.cpp:
+        (WebKit::FrameLoaderClientImpl::didCreateIsolatedScriptContext):
+        * src/FrameLoaderClientImpl.h:
+
 2011-08-10  Adam Roben  <aro...@apple.com>
 
         Clear up scale factor terminology

Modified: trunk/Source/WebKit/chromium/DEPS (93054 => 93055)


--- trunk/Source/WebKit/chromium/DEPS	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebKit/chromium/DEPS	2011-08-15 19:52:19 UTC (rev 93055)
@@ -32,7 +32,7 @@
 
 vars = {
   'chromium_svn': 'http://src.chromium.org/svn/trunk/src',
-  'chromium_rev': '96244'
+  'chromium_rev': '96618'
 }
 
 deps = {

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (93054 => 93055)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2011-08-15 19:52:19 UTC (rev 93055)
@@ -71,10 +71,12 @@
                 '<(chromium_src_dir)/skia/skia.gyp:skia',
                 '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi',
                 '<(chromium_src_dir)/third_party/angle/src/build_angle.gyp:translator_glsl',
+                '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
             ],
             'export_dependent_settings': [
                 '<(chromium_src_dir)/skia/skia.gyp:skia',
                 '<(chromium_src_dir)/third_party/npapi/npapi.gyp:npapi',
+                '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8',
             ],
             'include_dirs': [
                 'public',

Modified: trunk/Source/WebKit/chromium/public/WebFrameClient.h (93054 => 93055)


--- trunk/Source/WebKit/chromium/public/WebFrameClient.h	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebKit/chromium/public/WebFrameClient.h	2011-08-15 19:52:19 UTC (rev 93055)
@@ -40,6 +40,10 @@
 #include "WebTextDirection.h"
 #include "WebURLError.h"
 
+#if WEBKIT_USING_V8
+#include <v8.h>
+#endif
+
 namespace WebKit {
 
 class WebApplicationCacheHost;
@@ -302,9 +306,12 @@
 
     // Notifies that a garbage-collected context was created - content
     // scripts.
+    // FIXME: Remove this first overload when Chromium switches to the second.
     virtual void didCreateIsolatedScriptContext(WebFrame*) { }
+#if WEBKIT_USING_V8
+    virtual void didCreateIsolatedScriptContext(WebFrame*, int worldID, v8::Handle<v8::Context>) { }
+#endif
 
-
     // Geometry notifications ----------------------------------------------
 
     // The frame's document finished the initial layout of a page.

Modified: trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp (93054 => 93055)


--- trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp	2011-08-15 19:52:19 UTC (rev 93055)
@@ -82,6 +82,10 @@
 #include "WrappedResourceResponse.h"
 #include <wtf/text/CString.h>
 
+#if USE(V8)
+#include "V8IsolatedContext.h"
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -146,11 +150,15 @@
         m_webFrame->client()->didDestroyScriptContext(m_webFrame);
 }
 
-void FrameLoaderClientImpl::didCreateIsolatedScriptContext()
+#if USE(V8)
+void FrameLoaderClientImpl::didCreateIsolatedScriptContext(V8IsolatedContext* isolatedContext)
 {
-    if (m_webFrame->client())
+    if (m_webFrame->client()) {
         m_webFrame->client()->didCreateIsolatedScriptContext(m_webFrame);
+        m_webFrame->client()->didCreateIsolatedScriptContext(m_webFrame, isolatedContext->world()->id(), isolatedContext->context());
+    }
 }
+#endif
 
 bool FrameLoaderClientImpl::allowScriptExtension(const String& extensionName,
                                                  int extensionGroup)

Modified: trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h (93054 => 93055)


--- trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h	2011-08-15 19:37:22 UTC (rev 93054)
+++ trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h	2011-08-15 19:52:19 UTC (rev 93055)
@@ -65,10 +65,12 @@
     virtual void didCreateScriptContextForFrame();
     virtual void didDestroyScriptContextForFrame();
 
+#if USE(V8)
     // A context untied to a frame was created (through evaluateInIsolatedWorld).
     // This context is not tied to the lifetime of its frame, and is destroyed
     // in garbage collection.
-    virtual void didCreateIsolatedScriptContext();
+    virtual void didCreateIsolatedScriptContext(WebCore::V8IsolatedContext*);
+#endif
 
     // Returns true if we should allow the given V8 extension to be added to
     // the script context at the currently loading page and given extension group.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to