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

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

Issue 114813006: IDL compiler: [SetReference] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 5a2703cb96fb14e1f70308e095403f91b40922d6..73c32915e6f7a85369fb72e84c621cd52fed2ead 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -258,14 +258,28 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{##############################################################################}
{% block visit_dom_wrapper %}
-{% if generate_visit_dom_wrapper_function %}
+{% if check_reachable_method 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);
haraken 2013/12/17 09:13:09 kouhei: Why do we need to create a new Local handl
kouhei (in TOK) 2013/12/17 09:15:00 I don't remember if there was a specific reason. I
+ 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 check_reachable_method %}
+ if (Node* owner = impl->{{check_reachable_method}}()) {
haraken 2013/12/17 09:13:09 check_reachable_method => reachable_node_function
Nils Barth (inactive) 2013/12/18 01:57:49 Good point, fixed!
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