Chromium Code Reviews| Index: Source/bindings/core/v8/ScriptWrappable.h |
| diff --git a/Source/bindings/core/v8/ScriptWrappable.h b/Source/bindings/core/v8/ScriptWrappable.h |
| index 25b78c388227f5a1fc276c2796ee0bbe960e1796..eb9b3fe1086024f6ca5d951c182d7896ddcd27ef 100644 |
| --- a/Source/bindings/core/v8/ScriptWrappable.h |
| +++ b/Source/bindings/core/v8/ScriptWrappable.h |
| @@ -148,6 +148,14 @@ public: |
| initializeScriptWrappableHelper(object); |
| } |
| + // Returns the WrapperTypeInfo of the instance. |
| + // |
| + // This method must be overridden by DEFINE_WRAPPERTYPEINFO macro. |
| + virtual const WrapperTypeInfo* wrapperTypeInfo() const = 0; |
| + |
| + // Creates and returns a new wrapper object. |
| + virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*); |
| + |
| void setWrapper(v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const WrapperTypeInfo* wrapperTypeInfo) |
| { |
| ASSERT(!containsWrapper()); |
| @@ -338,6 +346,29 @@ private: |
| } |
| }; |
| +// Defines 'wrapperTypeInfo' virtual method which returns the WrapperTypeInfo of |
| +// the instance. Also declares a static member of type WrapperTypeInfo, of which |
| +// the definition is given by the IDL code generator. |
| +// |
| +// All the derived classes of ScriptWrappable, regardless of directly or |
| +// indirectly, must write this macro in the class definition except for the case |
| +// that the class is [NoInterfaceObject]. In the case of [NoInterfaceObject], |
| +// the IDL code generator does not generate V8T.cpp, so the definition of |
| +// T::s_wrapperTypeInfo will not be generated, either. |
| +// |
| +// If a DOM class T does not inherit from ScriptWrappable, you have to write |
| +// [NotScriptWrappable] in the IDL file as an extended attribute in order to let |
| +// IDL code generator know that T does not inherit from ScriptWrappable. Note |
| +// that [NotScriptWrappable] is inheritable. |
|
haraken
2014/09/02 01:10:10
It might be worth adding the summary of the commen
Yuki
2014/09/02 04:35:49
Done.
|
| +#define DEFINE_WRAPPERTYPEINFO() \ |
| +public: \ |
| + virtual const WrapperTypeInfo* wrapperTypeInfo() const OVERRIDE \ |
| + { \ |
| + return &s_wrapperTypeInfo; \ |
| + } \ |
| +private: \ |
| + static const WrapperTypeInfo& s_wrapperTypeInfo |
| + |
| } // namespace blink |
| #endif // ScriptWrappable_h |