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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/callback_interface.cpp

Issue 2200263005: Remove ActiveDOMCallback::isScriptControllerTerminating (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 {% include 'copyright_block.txt' %} 1 {% include 'copyright_block.txt' %}
2 #include "{{v8_class}}.h" 2 #include "{{v8_class}}.h"
3 3
4 {% for filename in cpp_includes %} 4 {% for filename in cpp_includes %}
5 #include "{{filename}}" 5 #include "{{filename}}"
6 {% endfor %} 6 {% endfor %}
7 7
8 namespace blink { 8 namespace blink {
9 9
10 {{v8_class}}::{{v8_class}}(v8::Local<v8::Function> callback, ScriptState* script State) 10 {{v8_class}}::{{v8_class}}(v8::Local<v8::Function> callback, ScriptState* script State)
(...skipping 20 matching lines...) Expand all
31 if method.idl_type == 'boolean' else 'return' %}{# void #} 31 if method.idl_type == 'boolean' else 'return' %}{# void #}
32 if (!canInvokeCallback()) 32 if (!canInvokeCallback())
33 {{return_default}}; 33 {{return_default}};
34 34
35 if (!m_scriptState->contextIsValid()) 35 if (!m_scriptState->contextIsValid())
36 {{return_default}}; 36 {{return_default}};
37 37
38 ScriptState::Scope scope(m_scriptState.get()); 38 ScriptState::Scope scope(m_scriptState.get());
39 {% if method.call_with_this_handle %} 39 {% if method.call_with_this_handle %}
40 v8::Local<v8::Value> thisHandle = thisValue.v8Value(); 40 v8::Local<v8::Value> thisHandle = thisValue.v8Value();
41 if (thisHandle.IsEmpty()) {
42 if (!isScriptControllerTerminating())
43 CRASH();
44 {{return_default}};
45 }
46 {% endif %} 41 {% endif %}
47 {% for argument in method.arguments %} 42 {% for argument in method.arguments %}
48 v8::Local<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value} }; 43 v8::Local<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value} };
49 if ({{argument.handle}}.IsEmpty()) {
50 if (!isScriptControllerTerminating())
51 CRASH();
52 {{return_default}};
53 }
54 {% endfor %} 44 {% endfor %}
55 {% if method.arguments %} 45 {% if method.arguments %}
56 v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} }; 46 v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} };
57 {% else %} 47 {% else %}
58 {# Empty array initializers are illegal, and don't compile in MSVC. #} 48 {# Empty array initializers are illegal, and don't compile in MSVC. #}
59 v8::Local<v8::Value> *argv = 0; 49 v8::Local<v8::Value> *argv = 0;
60 {% endif %} 50 {% endif %}
61 51
62 {% set this_handle_parameter = 'thisHandle, ' if method.call_with_this_handl e else 'v8::Undefined(m_scriptState->isolate()), ' %} 52 {% set this_handle_parameter = 'thisHandle, ' if method.call_with_this_handl e else 'v8::Undefined(m_scriptState->isolate()), ' %}
63 {% if method.idl_type == 'boolean' %} 53 {% if method.idl_type == 'boolean' %}
64 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); 54 v8::TryCatch exceptionCatcher(m_scriptState->isolate());
65 exceptionCatcher.SetVerbose(true); 55 exceptionCatcher.SetVerbose(true);
66 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.argument s | length}}, argv, m_scriptState->isolate()); 56 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.argument s | length}}, argv, m_scriptState->isolate());
67 return !exceptionCatcher.HasCaught(); 57 return !exceptionCatcher.HasCaught();
68 {% else %}{# void #} 58 {% else %}{# void #}
69 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.argument s | length}}, argv, m_scriptState->isolate()); 59 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.argument s | length}}, argv, m_scriptState->isolate());
70 {% endif %} 60 {% endif %}
71 } 61 }
72 62
73 {% endfor %} 63 {% endfor %}
74 } // namespace blink 64 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698