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

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

Issue 114813006: IDL compiler: [SetReference] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: gclw Created 7 years 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
« no previous file with comments | « Source/bindings/scripts/unstable/v8_interface.py ('k') | Source/bindings/tests/idls/TestInterface.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/interface.cpp
diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp
index 2e491773b17fa3dba81db57b82063cc510df54e8..440c327d7e16753ff5888b986f042a6a6e2783ab 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -260,14 +260,28 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{##############################################################################}
{% block visit_dom_wrapper %}
-{% if generate_visit_dom_wrapper_function %}
+{% if reachable_node_function or set_reference_list %}
void {{v8_class}}::visitDOMWrapper(void* object, const v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate)
{
{{cpp_class}}* impl = fromInternalPointer(object);
- if (Node* owner = impl->{{generate_visit_dom_wrapper_function}}()) {
+ {% if set_reference_list %}
+ v8::Local<v8::Object> creationContext = v8::Local<v8::Object>::New(isolate, wrapper);
+ V8WrapperInstantiationScope scope(creationContext, isolate);
+ {% for set_reference in set_reference_list %}
+ {{set_reference.idl_type}}* {{set_reference.name}} = impl->{{set_reference.name}}();
+ if ({{set_reference.name}}) {
+ if (!DOMDataStore::containsWrapper<{{set_reference.v8_type}}>({{set_reference.name}}, isolate))
+ wrap({{set_reference.name}}, creationContext, isolate);
+ DOMDataStore::setWrapperReference<{{set_reference.v8_type}}>(wrapper, {{set_reference.name}}, isolate);
+ }
+ {% endfor %}
+ {% endif %}
+ {% if reachable_node_function %}
+ if (Node* owner = impl->{{reachable_node_function}}()) {
setObjectGroup(V8GCController::opaqueRootForGC(owner, isolate), wrapper, isolate);
return;
}
+ {% endif %}
setObjectGroup(object, wrapper, isolate);
}
« no previous file with comments | « Source/bindings/scripts/unstable/v8_interface.py ('k') | Source/bindings/tests/idls/TestInterface.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698