| Index: Source/bindings/core/v8/ScriptWrappable.h
|
| diff --git a/Source/bindings/core/v8/ScriptWrappable.h b/Source/bindings/core/v8/ScriptWrappable.h
|
| index b0e176c1f05a95e8a3b42cbfc1207c60a1992462..38ecd9bc24f6816dc9df1ac54e3368b84aded485 100644
|
| --- a/Source/bindings/core/v8/ScriptWrappable.h
|
| +++ b/Source/bindings/core/v8/ScriptWrappable.h
|
| @@ -46,6 +46,30 @@ template <class C> inline void initializeScriptWrappableHelper(C* object)
|
| namespace blink {
|
|
|
| /**
|
| + * The base class of all wrappable objects.
|
| + *
|
| + * This class provides the internal pointer to be stored in the wrapper objects,
|
| + * and its conversions from / to the DOM instances.
|
| + *
|
| + * Note that this class must not have vtbl (any virtual function) or any member
|
| + * variable which increase the size of instances. Some of the classes sensitive
|
| + * to the size inherit from this class. So this class must be zero size.
|
| + */
|
| +class ScriptWrappableBase {
|
| +public:
|
| + template <class T> static T* fromInternalPointer(void* internalPointer)
|
| + {
|
| + // Check if T* is castable to ScriptWrappableBase*, which means T
|
| + // doesn't have two or more ScriptWrappableBase as superclasses.
|
| + // If T has two ScriptWrappableBase as superclasses, conversions
|
| + // from T* to ScriptWrappableBase* are ambiguous.
|
| + ASSERT(static_cast<ScriptWrappableBase*>(static_cast<T*>(static_cast<ScriptWrappableBase*>(internalPointer))));
|
| + return static_cast<T*>(static_cast<ScriptWrappableBase*>(internalPointer));
|
| + }
|
| + void* toInternalPointer() { return this; }
|
| +};
|
| +
|
| +/**
|
| * ScriptWrappable wraps a V8 object and its WrapperTypeInfo.
|
| *
|
| * ScriptWrappable acts much like a v8::Persistent<> in that it keeps a
|
| @@ -74,7 +98,7 @@ namespace blink {
|
| * - disposeWrapper (via setWeakCallback, triggered by V8 garbage collecter):
|
| * remove v8::Persistent and install a TypeInfo of the previous value.
|
| */
|
| -class ScriptWrappable {
|
| +class ScriptWrappable : public ScriptWrappableBase {
|
| public:
|
| ScriptWrappable() : m_wrapperOrTypeInfo(0) { }
|
|
|
|
|