[V8] We should hide the DOMWrapperMaps inside DOMDataStore
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2012 18:59:52 +0000 (18:59 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2012 18:59:52 +0000 (18:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=101430

Reviewed by Kentaro Hara.

Source/WebCore:

This is yet another incremental step towards landing the patch in bug
101110. In this patch, we hide the existence of DOMWrapperMaps inside
DOMDataStore. In the process, we can remove V8DOMMap.cpp.

* UseV8.cmake:
* WebCore.gypi:
* bindings/v8/DOMDataStore.h:
(WebCore::DOMDataStore::set):
* bindings/v8/DOMWrapperWorld.h:
* bindings/v8/ScriptProfiler.cpp:
* bindings/v8/SerializedScriptValue.cpp:
(WebCore::neuterBinding):
* bindings/v8/V8DOMMap.cpp: Removed.
* bindings/v8/V8DOMMap.h: Removed.
* bindings/v8/V8DOMWindowShell.cpp:
* bindings/v8/V8DOMWrapper.h:
(WebCore::V8DOMWrapper::getCachedWrapper):
(WebCore::V8DOMWrapper::setWrapperClass):
(WebCore::V8DOMWrapper::setJSWrapperForDOMObject):
* bindings/v8/V8NPObject.cpp:
* bindings/v8/WorkerContextExecutionProxy.cpp:
* bindings/v8/WorkerScriptController.cpp:

Source/WebKit/chromium:

Remove unneeded header includes.

* src/WebScriptController.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@133783 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/UseV8.cmake
Source/WebCore/WebCore.gypi
Source/WebCore/bindings/v8/DOMDataStore.h
Source/WebCore/bindings/v8/DOMWrapperWorld.h
Source/WebCore/bindings/v8/ScriptProfiler.cpp
Source/WebCore/bindings/v8/SerializedScriptValue.cpp
Source/WebCore/bindings/v8/V8DOMMap.cpp [deleted file]
Source/WebCore/bindings/v8/V8DOMMap.h [deleted file]
Source/WebCore/bindings/v8/V8DOMWindowShell.cpp
Source/WebCore/bindings/v8/V8DOMWrapper.h
Source/WebCore/bindings/v8/V8NPObject.cpp
Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
Source/WebCore/bindings/v8/WorkerScriptController.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebScriptController.cpp

index 9cf0936..9e0f70a 100644 (file)
@@ -1,3 +1,33 @@
+2012-11-07  Adam Barth  <abarth@webkit.org>
+
+        [V8] We should hide the DOMWrapperMaps inside DOMDataStore
+        https://bugs.webkit.org/show_bug.cgi?id=101430
+
+        Reviewed by Kentaro Hara.
+
+        This is yet another incremental step towards landing the patch in bug
+        101110. In this patch, we hide the existence of DOMWrapperMaps inside
+        DOMDataStore. In the process, we can remove V8DOMMap.cpp.
+
+        * UseV8.cmake:
+        * WebCore.gypi:
+        * bindings/v8/DOMDataStore.h:
+        (WebCore::DOMDataStore::set):
+        * bindings/v8/DOMWrapperWorld.h:
+        * bindings/v8/ScriptProfiler.cpp:
+        * bindings/v8/SerializedScriptValue.cpp:
+        (WebCore::neuterBinding):
+        * bindings/v8/V8DOMMap.cpp: Removed.
+        * bindings/v8/V8DOMMap.h: Removed.
+        * bindings/v8/V8DOMWindowShell.cpp:
+        * bindings/v8/V8DOMWrapper.h:
+        (WebCore::V8DOMWrapper::getCachedWrapper):
+        (WebCore::V8DOMWrapper::setWrapperClass):
+        (WebCore::V8DOMWrapper::setJSWrapperForDOMObject):
+        * bindings/v8/V8NPObject.cpp:
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        * bindings/v8/WorkerScriptController.cpp:
+
 2012-11-07  Varun Jain  <varunjain@chromium.org>
 
         Add new gesture type, LongTap, which is basically the completion of a GestureLongPress
index b6358f7..7de094c 100644 (file)
@@ -48,7 +48,6 @@ LIST(APPEND WebCore_SOURCES
     bindings/v8/V8Binding.cpp
     bindings/v8/V8Collection.cpp
     bindings/v8/V8DOMConfiguration.cpp,
-    bindings/v8/V8DOMMap.cpp
     bindings/v8/V8DOMWindowShell.cpp
     bindings/v8/V8DOMWrapper.cpp
     bindings/v8/V8EventListener.cpp
index 4e006e8..2cd2bea 100644 (file)
             'bindings/v8/V8DependentRetained.h',
             'bindings/v8/V8DOMConfiguration.cpp',
             'bindings/v8/V8DOMConfiguration.h',
-            'bindings/v8/V8DOMMap.cpp',
-            'bindings/v8/V8DOMMap.h',
             'bindings/v8/V8DOMWindowShell.cpp',
             'bindings/v8/V8DOMWindowShell.h',
             'bindings/v8/V8DOMWrapper.cpp',
index ea83f41..12b89c6 100644 (file)
@@ -62,8 +62,8 @@ public:
     inline v8::Handle<v8::Object> get(void* object) const { return m_domObjectMap->get(object); }
     inline v8::Handle<v8::Object> get(Node* object) const { return m_domNodeMap->get(object); }
 
-    DOMWrapperMap<Node>& domNodeMap() { return *m_domNodeMap; }
-    DOMWrapperMap<void>& domObjectMap() { return *m_domObjectMap; }
+    inline void set(void* object, v8::Persistent<v8::Object> wrapper) { return m_domObjectMap->set(object, wrapper); }
+    inline void set(Node* object, v8::Persistent<v8::Object> wrapper) { return m_domNodeMap->set(object, wrapper); }
 
     void reportMemoryUsage(MemoryObjectInfo*) const;
 
index 68ee6e9..5df3058 100644 (file)
@@ -33,7 +33,6 @@
 
 #include "DOMDataStore.h"
 #include "SecurityOrigin.h"
-#include "V8DOMMap.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
index c840f22..ff57c3c 100644 (file)
@@ -37,7 +37,6 @@
 #include "ScriptObject.h"
 #include "V8ArrayBufferView.h"
 #include "V8Binding.h"
-#include "V8DOMMap.h"
 #include "V8Node.h"
 #include "WebCoreMemoryInstrumentation.h"
 #include "WrapperTypeInfo.h"
index 5b6c398..d12d085 100644 (file)
@@ -2211,7 +2211,7 @@ inline void neuterBinding(T* object)
 {
     Vector<DOMDataStore*>& allStores = V8PerIsolateData::current()->allStores();
     for (size_t i = 0; i < allStores.size(); i++) {
-        v8::Handle<v8::Object> wrapper = allStores[i]->domObjectMap().get(object);
+        v8::Handle<v8::Object> wrapper = allStores[i]->get(object);
         if (!wrapper.IsEmpty())
             wrapper->SetIndexedPropertiesToExternalArrayData(0, v8::kExternalByteArray, 0);
     }
diff --git a/Source/WebCore/bindings/v8/V8DOMMap.cpp b/Source/WebCore/bindings/v8/V8DOMMap.cpp
deleted file mode 100644 (file)
index 34337e0..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "V8DOMMap.h"
-
-#include "DOMDataStore.h"
-#include "V8Binding.h"
-#include "V8Node.h"
-#include <wtf/MainThread.h>
-
-namespace WebCore {
-
-DOMWrapperMap<Node>& getDOMNodeMap(v8::Isolate* isolate)
-{
-    if (!isolate)
-        isolate = v8::Isolate::GetCurrent();
-    return DOMDataStore::current(isolate)->domNodeMap();
-}
-
-DOMWrapperMap<void>& getDOMObjectMap(v8::Isolate* isolate)
-{
-    if (!isolate)
-        isolate = v8::Isolate::GetCurrent();
-    return DOMDataStore::current(isolate)->domObjectMap();
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/bindings/v8/V8DOMMap.h b/Source/WebCore/bindings/v8/V8DOMMap.h
deleted file mode 100644 (file)
index d8c7d28..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef V8DOMMap_h
-#define V8DOMMap_h
-
-#include "DOMWrapperMap.h"
-#include "Node.h"
-#include "WebCoreMemoryInstrumentation.h"
-#include <wtf/Forward.h>
-#include <wtf/HashMap.h>
-#include <wtf/MemoryInstrumentationHashMap.h>
-#include <wtf/OwnPtr.h>
-#include <v8.h>
-
-namespace WebCore {
-
-DOMWrapperMap<Node>& getDOMNodeMap(v8::Isolate* = 0);
-DOMWrapperMap<void>& getDOMObjectMap(v8::Isolate* = 0);
-
-} // namespace WebCore
-
-#endif // V8DOMMap_h
index 4d37fc9..02b347d 100644 (file)
@@ -51,7 +51,6 @@
 #include "StylePropertySet.h"
 #include "V8Binding.h"
 #include "V8Collection.h"
-#include "V8DOMMap.h"
 #include "V8DOMWindow.h"
 #include "V8Document.h"
 #include "V8GCController.h"
index ade3143..ab6c2cd 100644 (file)
@@ -37,7 +37,6 @@
 #include "Node.h"
 #include "NodeFilter.h"
 #include "V8CustomXPathNSResolver.h"
-#include "V8DOMMap.h"
 #include "V8DOMWindowShell.h"
 #include "V8Utilities.h"
 #include "WrapperTypeInfo.h"
@@ -123,20 +122,18 @@ namespace WebCore {
             if (LIKELY(!context))
                 return node->wrapper();
 
-            return context->world()->domDataStore()->domNodeMap().get(node);
+            return context->world()->domDataStore()->get(node);
         }
 
     private:
-        static void setJSWrapperPrivate(void* object, v8::Persistent<v8::Object> wrapper, v8::Isolate* isolate)
+        static void setWrapperClass(void*, v8::Persistent<v8::Object> wrapper)
         {
             wrapper.SetWrapperClassId(v8DOMObjectClassId);
-            getDOMObjectMap(isolate).set(object, wrapper);
         }
 
-        static void setJSWrapperPrivate(Node* object, v8::Persistent<v8::Object> wrapper, v8::Isolate* isolate)
+        static void setWrapperClass(Node*, v8::Persistent<v8::Object> wrapper)
         {
             wrapper.SetWrapperClassId(v8DOMNodeClassId);
-            getDOMNodeMap(isolate).set(object, wrapper);
         }
     };
 
@@ -145,7 +142,8 @@ namespace WebCore {
     {
         v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
         ASSERT(maybeDOMWrapper(wrapperHandle));
-        setJSWrapperPrivate(object.leakRef(), wrapperHandle, isolate);
+        setWrapperClass(object.get(), wrapperHandle);
+        DOMDataStore::current(isolate)->set(object.leakRef(), wrapperHandle);
         return wrapperHandle;
     }
 
index 676a672..c488516 100644 (file)
@@ -35,7 +35,6 @@
 #include "HTMLPlugInElement.h"
 #include "NPV8Object.h"
 #include "V8Binding.h"
-#include "V8DOMMap.h"
 #include "V8HTMLAppletElement.h"
 #include "V8HTMLEmbedElement.h"
 #include "V8HTMLObjectElement.h"
index 99aa09e..15c5e90 100644 (file)
@@ -43,7 +43,6 @@
 #include "SharedWorker.h"
 #include "SharedWorkerContext.h"
 #include "V8Binding.h"
-#include "V8DOMMap.h"
 #include "V8DOMWindowShell.h"
 #include "V8DedicatedWorkerContext.h"
 #include "V8GCController.h"
index 5bacb5a..628f51b 100644 (file)
@@ -38,7 +38,6 @@
 #include "ScriptCallStack.h"
 #include "ScriptSourceCode.h"
 #include "ScriptValue.h"
-#include "V8DOMMap.h"
 #include "V8WorkerContext.h"
 #include "WorkerContext.h"
 #include "WorkerContextExecutionProxy.h"
index 8f58e4d..2cb4ec5 100644 (file)
@@ -1,3 +1,14 @@
+2012-11-07  Adam Barth  <abarth@webkit.org>
+
+        [V8] We should hide the DOMWrapperMaps inside DOMDataStore
+        https://bugs.webkit.org/show_bug.cgi?id=101430
+
+        Reviewed by Kentaro Hara.
+
+        Remove unneeded header includes.
+
+        * src/WebScriptController.cpp:
+
 2012-11-07  Varun Jain  <varunjain@chromium.org>
 
         Add new gesture type, LongTap, which is basically the completion of a GestureLongPress
index cdff75a..2984804 100644 (file)
@@ -32,9 +32,6 @@
 #include "WebScriptController.h"
 
 #include "ScriptController.h"
-#include "V8Binding.h"
-#include "V8DOMMap.h"
-#include <public/WebString.h>
 
 using namespace WebCore;