diff options
Diffstat (limited to 'WebCore/bindings/v8/V8DOMWindowShell.h')
-rw-r--r-- | WebCore/bindings/v8/V8DOMWindowShell.h | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.h b/WebCore/bindings/v8/V8DOMWindowShell.h index 6b8952d..f4eaff2 100644 --- a/WebCore/bindings/v8/V8DOMWindowShell.h +++ b/WebCore/bindings/v8/V8DOMWindowShell.h @@ -31,7 +31,8 @@ #ifndef V8DOMWindowShell_h #define V8DOMWindowShell_h -#include "V8Index.h" +#include "WrapperTypeInfo.h" +#include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -73,16 +74,15 @@ public: static v8::Handle<v8::Value> getHiddenObjectPrototype(v8::Handle<v8::Context>); // WARNING: Call |installHiddenObjectPrototype| only on fresh contexts! - static void installHiddenObjectPrototype(v8::Handle<v8::Context>); + static bool installHiddenObjectPrototype(v8::Handle<v8::Context>); // To create JS Wrapper objects, we create a cache of a 'boiler plate' // object, and then simply Clone that object each time we need a new one. // This is faster than going through the full object creation process. - v8::Local<v8::Object> createWrapperFromCache(V8ClassIndex::V8WrapperType type) + v8::Local<v8::Object> createWrapperFromCache(WrapperTypeInfo* type) { - int classIndex = V8ClassIndex::ToInt(type); - v8::Local<v8::Object> clone(m_wrapperBoilerplates->CloneElementAt(classIndex)); - return clone.IsEmpty() ? createWrapperFromCacheSlowCase(type) : clone; + v8::Persistent<v8::Object> boilerplate = m_wrapperBoilerplates.get(type); + return boilerplate.IsEmpty() ? createWrapperFromCacheSlowCase(type) : boilerplate->Clone(); } static void setLocation(DOMWindow*, const String& relativeURL); @@ -102,15 +102,14 @@ private: void updateDocumentWrapperCache(); void clearDocumentWrapperCache(); - v8::Local<v8::Object> createWrapperFromCacheSlowCase(V8ClassIndex::V8WrapperType); + v8::Local<v8::Object> createWrapperFromCacheSlowCase(WrapperTypeInfo*); Frame* m_frame; // For each possible type of wrapper, we keep a boilerplate object. - // The boilerplate is used to create additional wrappers of the same - // type. We keep a single persistent handle to an array of the - // activated boilerplates. - v8::Persistent<v8::Array> m_wrapperBoilerplates; + // The boilerplate is used to create additional wrappers of the same type. + typedef WTF::HashMap<WrapperTypeInfo*, v8::Persistent<v8::Object> > WrapperBoilerplateMap; + WrapperBoilerplateMap m_wrapperBoilerplates; v8::Persistent<v8::Context> m_context; v8::Persistent<v8::Object> m_global; |