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

Unified Diff: Source/bindings/templates/interface.h

Issue 82693003: IDL compiler: [CustomToV8] interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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
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)
{

Powered by Google App Engine
This is Rietveld 408576698