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

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

Issue 340443004: IDL: reuse more code between CG for methods and constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rename scriptContext -> executionContext Created 6 years, 6 months 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/templates/attributes.cpp ('k') | Source/bindings/tests/idls/TestInterfaceEventTarget.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index ae5bfbd527bd6b238a2662ce2f2303b54adba2ed..5589f916aa3e72aa81071907cde7f77b4c6d2348 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -235,7 +235,7 @@ if (!{{argument.name}}.isUndefinedOrNull() && !{{argument.name}}.isObject()) {
ScriptState* scriptState = ScriptState::current(info.GetIsolate());
{% endif %}
{% if method.is_call_with_execution_context %}
-ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
+ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
{% endif %}
{% if method.is_call_with_script_arguments %}
RefPtrWillBeRawPtr<ScriptArguments> scriptArguments(createScriptArguments(scriptState, info, {{method.number_of_arguments}}));
@@ -489,12 +489,12 @@ static void constructor{{constructor.overload_index}}(const v8::FunctionCallback
{{generate_arguments(constructor) | indent}}
{% endif %}
{% if is_constructor_call_with_execution_context %}
- ExecutionContext* context = currentExecutionContext(isolate);
+ ExecutionContext* executionContext = currentExecutionContext(isolate);
{% endif %}
{% if is_constructor_call_with_document %}
Document& document = *toDocument(currentExecutionContext(isolate));
{% endif %}
- {{constructor.cpp_type}} impl = {{cpp_class}}::create({{constructor.argument_list | join(', ')}});
+ {{constructor.cpp_type}} impl = {{constructor.cpp_value}};
{% if is_constructor_raises_exception %}
if (exceptionState.throwIfNeeded())
return;
@@ -535,12 +535,13 @@ static void {{v8_class}}ConstructorCallback(const v8::FunctionCallbackInfo<v8::V
return;
}
- Document* document = currentDOMWindow(isolate)->document();
- ASSERT(document);
+ Document* documentPtr = currentDOMWindow(isolate)->document();
+ ASSERT(documentPtr);
+ Document& document = *documentPtr;
// Make sure the document is added to the DOM Node map. Otherwise, the {{cpp_class}} instance
// may end up being the only node in the map and get garbage-collected prematurely.
- toV8(document, info.Holder(), isolate);
+ toV8(documentPtr, info.Holder(), isolate);
{% if constructor.has_exception_state %}
ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interface_name}}", info.Holder(), isolate);
@@ -554,7 +555,7 @@ static void {{v8_class}}ConstructorCallback(const v8::FunctionCallbackInfo<v8::V
{% if constructor.arguments %}
{{generate_arguments(constructor) | indent}}
{% endif %}
- {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{constructor.argument_list | join(', ')}});
+ {{constructor.cpp_type}} impl = {{constructor.cpp_value}};
{% if is_constructor_raises_exception %}
if (exceptionState.throwIfNeeded())
return;
« no previous file with comments | « Source/bindings/templates/attributes.cpp ('k') | Source/bindings/tests/idls/TestInterfaceEventTarget.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698