Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: bindings/v8/V8DOMMap.h

Issue 118189: Upstream changes to run content scripts in their own world. (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/WebCore/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bindings/v8/ScriptController.cpp ('k') | bindings/v8/V8DOMMap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bindings/v8/V8DOMMap.h
===================================================================
--- bindings/v8/V8DOMMap.h (revision 44597)
+++ bindings/v8/V8DOMMap.h (working copy)
@@ -32,6 +32,7 @@
#define V8DOMMap_h
#include <wtf/HashMap.h>
+#include <wtf/OwnPtr.h>
#include <v8.h>
namespace WebCore {
@@ -89,23 +90,45 @@
v8::WeakReferenceCallback m_weakReferenceCallback;
};
-
template <class KeyType> class DOMWrapperMap : public WeakReferenceMap<KeyType, v8::Object> {
public:
DOMWrapperMap(v8::WeakReferenceCallback callback) : WeakReferenceMap<KeyType, v8::Object>(callback) { }
+
+ class Visitor {
+ public:
+ virtual void visitDOMWrapper(KeyType* key, v8::Persistent<v8::Object> object) = 0;
+ };
};
+ // An opaque class that represents a set of DOM wrappers.
+ class DOMDataStore;
+
+ // A utility class to manage the lifetime of set of DOM wrappers.
+ class DOMDataStoreHandle {
+ public:
+ DOMDataStoreHandle();
+ ~DOMDataStoreHandle();
+
+ DOMDataStore* getStore() const { return m_store.get(); }
+
+ private:
+ OwnPtr<DOMDataStore> m_store;
+ };
+
// Callback when JS wrapper of active DOM object is dead.
void weakActiveDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject);
// A map from DOM node to its JS wrapper.
DOMWrapperMap<Node>& getDOMNodeMap();
+ void visitDOMNodesInCurrentThread(DOMWrapperMap<Node>::Visitor*);
// A map from a DOM object (non-node) to its JS wrapper. This map does not contain the DOM objects which can have pending activity (active dom objects).
DOMWrapperMap<void>& getDOMObjectMap();
+ void visitDOMObjectsInCurrentThread(DOMWrapperMap<void>::Visitor*);
// A map from a DOM object to its JS wrapper for DOM objects which can have pending activity.
DOMWrapperMap<void>& getActiveDOMObjectMap();
+ void visitActiveDOMObjectsInCurrentThread(DOMWrapperMap<void>::Visitor*);
// This should be called to remove all DOM objects associated with the current thread when it is tearing down.
void removeAllDOMObjectsInCurrentThread();
@@ -113,9 +136,11 @@
#if ENABLE(SVG)
// A map for SVGElementInstances to its JS wrapper.
DOMWrapperMap<SVGElementInstance>& getDOMSVGElementInstanceMap();
+ void visitSVGElementInstancesInCurrentThread(DOMWrapperMap<SVGElementInstance>::Visitor*);
// Map of SVG objects with contexts to V8 objects.
DOMWrapperMap<void>& getDOMSVGObjectWithContextMap();
+ void visitDOMSVGObjectsInCurrentThread(DOMWrapperMap<void>::Visitor*);
#endif
} // namespace WebCore
« no previous file with comments | « bindings/v8/ScriptController.cpp ('k') | bindings/v8/V8DOMMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698