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

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

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: Rebasing the fixes... Created 3 years, 10 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 {% filter format_blink_cpp_source_code %} 1 {% filter format_blink_cpp_source_code %}
2 2
3 {% include 'copyright_block.txt' %} 3 {% include 'copyright_block.txt' %}
4 #include "{{v8_class}}.h" 4 #include "{{v8_class}}.h"
5 5
6 {% for filename in cpp_includes %} 6 {% for filename in cpp_includes %}
7 #include "{{filename}}" 7 #include "{{filename}}"
8 {% endfor %} 8 {% endfor %}
9 9
10 namespace blink { 10 namespace blink {
11 11
12 {{v8_class}}::{{v8_class}}(v8::Local<v8::Function> callback, ScriptState* script State) 12 {{v8_class}}::{{v8_class}}(v8::Local<v8::Function> callback, ScriptState* script State)
13 : m_scriptState(scriptState) { 13 : m_scriptState(scriptState) {
14 m_callback.set(scriptState->isolate(), callback); 14 m_callback.Set(scriptState->GetIsolate(), callback);
15 } 15 }
16 16
17 {{v8_class}}::~{{v8_class}}() {} 17 {{v8_class}}::~{{v8_class}}() {}
18 18
19 DEFINE_TRACE({{v8_class}}) { 19 DEFINE_TRACE({{v8_class}}) {
20 {{cpp_class}}::trace(visitor); 20 {{cpp_class}}::Trace(visitor);
21 } 21 }
22 22
23 {% for method in methods if not method.is_custom %} 23 {% for method in methods if not method.is_custom %}
24 {{method.cpp_type}} {{v8_class}}::{{method.name}}({{method.argument_declarations | join(', ')}}) { 24 {{method.cpp_type}} {{v8_class}}::{{method.name}}({{method.argument_declarations | join(', ')}}) {
25 {% set return_default = 'return true' 25 {% set return_default = 'return true'
26 if method.idl_type == 'boolean' else 'return' %}{# void #} 26 if method.idl_type == 'boolean' else 'return' %}{# void #}
27 ExecutionContext* executionContext = m_scriptState->getExecutionContext(); 27 ExecutionContext* executionContext = m_scriptState->GetExecutionContext();
28 if (!executionContext || executionContext->isContextSuspended() || 28 if (!executionContext || executionContext->IsContextSuspended() ||
29 executionContext->isContextDestroyed()) 29 executionContext->IsContextDestroyed())
30 {{return_default}}; 30 {{return_default}};
31 if (!m_scriptState->contextIsValid()) 31 if (!m_scriptState->ContextIsValid())
32 {{return_default}}; 32 {{return_default}};
33 ScriptState::Scope scope(m_scriptState.get()); 33 ScriptState::Scope scope(m_scriptState.Get());
34 {% if method.call_with_this_handle %} 34 {% if method.call_with_this_handle %}
35 v8::Local<v8::Value> thisHandle = thisValue.v8Value(); 35 v8::Local<v8::Value> thisHandle = thisValue.V8Value();
36 {% endif %} 36 {% endif %}
37 {% for argument in method.arguments %} 37 {% for argument in method.arguments %}
38 v8::Local<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value}}; 38 v8::Local<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value}};
39 {% endfor %} 39 {% endfor %}
40 {% if method.arguments %} 40 {% if method.arguments %}
41 v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} }; 41 v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} };
42 {% else %} 42 {% else %}
43 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} 43 {# Empty array initializers are illegal, and don\'t compile in MSVC. #}
44 v8::Local<v8::Value> *argv = 0; 44 v8::Local<v8::Value> *argv = 0;
45 {% endif %} 45 {% endif %}
46 46
47 {% set this_handle_parameter = 'thisHandle, ' if method.call_with_this_handle else 'v8::Undefined(m_scriptState->isolate()), ' %} 47 {% set this_handle_parameter = 'thisHandle, ' if method.call_with_this_handle else 'v8::Undefined(m_scriptState->GetIsolate()), ' %}
48 {% if method.idl_type == 'boolean' %} 48 {% if method.idl_type == 'boolean' %}
49 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); 49 v8::TryCatch exceptionCatcher(m_scriptState->GetIsolate());
50 exceptionCatcher.SetVerbose(true); 50 exceptionCatcher.SetVerbose(true);
51 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_ scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.arguments | length}}, argv, m_scriptState->isolate()); 51 V8ScriptRunner::CallFunction(m_callback.NewLocal(m_scriptState->GetIsolate()), m_scriptState->GetExecutionContext(), {{this_handle_parameter}}{{method.argumen ts | length}}, argv, m_scriptState->GetIsolate());
52 return !exceptionCatcher.HasCaught(); 52 return !exceptionCatcher.HasCaught();
53 {% else %}{# void #} 53 {% else %}{# void #}
54 V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_ scriptState->getExecutionContext(), {{this_handle_parameter}}{{method.arguments | length}}, argv, m_scriptState->isolate()); 54 V8ScriptRunner::CallFunction(m_callback.NewLocal(m_scriptState->GetIsolate()), m_scriptState->GetExecutionContext(), {{this_handle_parameter}}{{method.argumen ts | length}}, argv, m_scriptState->GetIsolate());
55 {% endif %} 55 {% endif %}
56 } 56 }
57 57
58 {% endfor %} 58 {% endfor %}
59 } // namespace blink 59 } // namespace blink
60 60
61 {% endfilter %}{# format_blink_cpp_source_code #} 61 {% endfilter %}{# format_blink_cpp_source_code #}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698