Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 , m_world(DOMWrapperWorld::current()) | 47 , m_world(DOMWrapperWorld::current()) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 {{v8_class_name}}::~{{v8_class_name}}() | 51 {{v8_class_name}}::~{{v8_class_name}}() |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 {% for method in methods %} | 55 {% for method in methods %} |
| 56 {% if not method.custom %} | 56 {% if not method.custom %} |
| 57 {{method.return_cpp_type}} {{v8_class_name}}::{{method.name}}({{method.argument_ declaration}}) | 57 {% set this_value_param = 'ScriptValue thisValue, ' if method.call_with_this_han dle else '' %} |
| 58 {{method.return_cpp_type}} {{v8_class_name}}::{{method.name}}({{this_value_param }}{{method.argument_declaration}}) | |
|
haraken
2013/08/06 05:02:03
How about putting 'ScriptValue thisValue, ' into m
alancutter (OOO until 2018)
2013/08/07 00:40:24
Done.
| |
| 58 { | 59 { |
| 59 if (!canInvokeCallback()) | 60 if (!canInvokeCallback()) |
| 60 return true; | 61 return true; |
| 61 | 62 |
| 62 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 63 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 63 v8::HandleScope handleScope(isolate); | 64 v8::HandleScope handleScope(isolate); |
| 64 | 65 |
| 65 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_ world.get()); | 66 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_ world.get()); |
| 66 if (v8Context.IsEmpty()) | 67 if (v8Context.IsEmpty()) |
| 67 return true; | 68 return true; |
| 68 | 69 |
| 69 v8::Context::Scope scope(v8Context); | 70 v8::Context::Scope scope(v8Context); |
| 70 | 71 |
| 72 {% if method.call_with_this_handle %} | |
| 73 v8::Handle<v8::Value> thisHandle = thisValue.v8Value(); | |
| 74 if (thisHandle.IsEmpty()) { | |
| 75 if (!isScriptControllerTerminating()) | |
| 76 CRASH(); | |
| 77 return true; | |
| 78 } | |
| 79 ASSERT(thisHandle->IsObject()); | |
| 80 {% endif %} | |
| 71 {% for argument in method.arguments %} | 81 {% for argument in method.arguments %} |
| 72 {{argument.cpp_to_js_conversion | indent(4)}} | 82 {{argument.cpp_to_js_conversion | indent(4)}} |
| 73 if ({{argument.name}}Handle.IsEmpty()) { | 83 if ({{argument.name}}Handle.IsEmpty()) { |
| 74 if (!isScriptControllerTerminating()) | 84 if (!isScriptControllerTerminating()) |
| 75 CRASH(); | 85 CRASH(); |
| 76 return true; | 86 return true; |
| 77 } | 87 } |
| 78 {% endfor %} | 88 {% endfor %} |
| 79 {% if method.arguments | length > 0 %} | 89 {% if method.arguments | length > 0 %} |
| 80 v8::Handle<v8::Value> argv[] = { {{method.handles}} }; | 90 v8::Handle<v8::Value> argv[] = { {{method.handles}} }; |
| 81 {% else %} | 91 {% else %} |
| 82 v8::Handle<v8::Value> *argv = 0; | 92 v8::Handle<v8::Value> *argv = 0; |
| 83 {% endif %} | 93 {% endif %} |
| 84 | 94 |
| 85 bool callbackReturnValue = false; | 95 bool callbackReturnValue = false; |
| 86 return !invokeCallback(m_callback.newLocal(isolate), {{method.arguments | le ngth}}, argv, callbackReturnValue, scriptExecutionContext()); | 96 {% set this_handle_param = 'v8::Handle<v8::Object>::Cast(thisHandle), ' if metho d.call_with_this_handle else '' %} |
| 97 return !invokeCallback(m_callback.newLocal(isolate), {{this_handle_param}}{{ method.arguments | length}}, argv, callbackReturnValue, scriptExecutionContext() ); | |
|
haraken
2013/08/06 05:02:03
Ditto. You might want to put 'v8::Handle<v8::Objec
alancutter (OOO until 2018)
2013/08/07 00:40:24
This will change the value of {{method.arguments |
| |
| 87 } | 98 } |
| 88 | 99 |
| 89 {% endif %} | 100 {% endif %} |
| 90 {% endfor %}{# for method in methods #} | 101 {% endfor %}{# for method in methods #} |
| 91 } // namespace WebCore | 102 } // namespace WebCore |
| 92 | 103 |
| 93 {% if conditional_string %} | 104 {% if conditional_string %} |
| 94 #endif // {{conditional_string}} | 105 #endif // {{conditional_string}} |
| 95 {% endif %} | 106 {% endif %} |
| OLD | NEW |