Chromium Code Reviews| Index: Source/bindings/templates/interface.h |
| diff --git a/Source/bindings/templates/interface.h b/Source/bindings/templates/interface.h |
| index 7a681bfee44926ca573d73f8baf866d54154e7a7..7c125540dbe0f8838b37d19fc2465e8eb723ea60 100644 |
| --- a/Source/bindings/templates/interface.h |
| +++ b/Source/bindings/templates/interface.h |
| @@ -97,8 +97,10 @@ public: |
| {% endif %} |
| private: |
| + {% if not has_custom_to_v8 %} |
| friend v8::Handle<v8::Object> wrap({{cpp_class_name}}*, v8::Handle<v8::Object> creationContext, v8::Isolate*); |
| static v8::Handle<v8::Object> createWrapper(PassRefPtr<{{cpp_class_name}}>, v8::Handle<v8::Object> creationContext, v8::Isolate*); |
| + {% endif %} |
| }; |
| template<> |
| @@ -107,6 +109,28 @@ public: |
| static const WrapperTypeInfo* wrapperTypeInfo() { return &{{v8_class_name}}::wrapperTypeInfo; } |
| }; |
| +{% if has_custom_to_v8 %} |
| +class {{cpp_class_name}}; |
| +v8::Handle<v8::Value> toV8({{cpp_class_name}}*, v8::Handle<v8::Object> creationContext, v8::Isolate*); |
| + |
| +template<class CallbackInfo> |
| +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{cpp_class_name}}* impl) |
|
haraken
2013/11/22 07:14:04
Where are these methods used? If this is used only
Nils Barth (inactive)
2013/12/03 02:52:28
They're used for disambiguation (in the generated
haraken
2013/12/03 03:21:26
Makes sense.
|
| +{ |
| + v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| +} |
| + |
| +template<class CallbackInfo> |
| +inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, {{cpp_class_name}}* impl) |
| +{ |
| + v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| +} |
| + |
| +template<class CallbackInfo, class Wrappable> |
| +inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, {{cpp_class_name}}* impl, Wrappable*) |
| +{ |
| + v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| +} |
| +{% else %}{# has_custom_to_v8 #} |
| {% if has_custom_wrap %} |
| v8::Handle<v8::Object> wrap({{cpp_class_name}}* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*); |
| {% else %} |
| @@ -167,6 +191,7 @@ inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, {{cpp_class_n |
| v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()); |
| v8SetReturnValue(callbackInfo, wrapper); |
| } |
| +{% endif %}{# has_custom_to_v8 #} |
|
Nils Barth (inactive)
2013/11/22 06:10:48
*Really* long {% if %} block (almost half the file
|
| inline v8::Handle<v8::Value> toV8(PassRefPtr<{{cpp_class_name}} > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| { |