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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 62 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
63 v8::HandleScope handleScope(isolate); | 63 v8::HandleScope handleScope(isolate); |
64 | 64 |
65 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
world.get()); | 65 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_
world.get()); |
66 if (v8Context.IsEmpty()) | 66 if (v8Context.IsEmpty()) |
67 return true; | 67 return true; |
68 | 68 |
69 v8::Context::Scope scope(v8Context); | 69 v8::Context::Scope scope(v8Context); |
70 | 70 |
| 71 {% if method.call_with_this_handle %} |
| 72 v8::Handle<v8::Value> thisHandle = thisValue.v8Value(); |
| 73 if (thisHandle.IsEmpty()) { |
| 74 if (!isScriptControllerTerminating()) |
| 75 CRASH(); |
| 76 return true; |
| 77 } |
| 78 ASSERT(thisHandle->IsObject()); |
| 79 {% endif %} |
71 {% for argument in method.arguments %} | 80 {% for argument in method.arguments %} |
72 {{argument.cpp_to_v8_conversion | indent}} | 81 {{argument.cpp_to_v8_conversion | indent}} |
73 if ({{argument.name}}Handle.IsEmpty()) { | 82 if ({{argument.name}}Handle.IsEmpty()) { |
74 if (!isScriptControllerTerminating()) | 83 if (!isScriptControllerTerminating()) |
75 CRASH(); | 84 CRASH(); |
76 return true; | 85 return true; |
77 } | 86 } |
78 {% endfor %} | 87 {% endfor %} |
79 {% if method.arguments %} | 88 {% if method.arguments %} |
80 v8::Handle<v8::Value> argv[] = { {{method.handles | join(', ')}} }; | 89 v8::Handle<v8::Value> argv[] = { {{method.handles | join(', ')}} }; |
81 {% else %} | 90 {% else %} |
82 v8::Handle<v8::Value> *argv = 0; | 91 v8::Handle<v8::Value> *argv = 0; |
83 {% endif %} | 92 {% endif %} |
84 | 93 |
85 bool callbackReturnValue = false; | 94 bool callbackReturnValue = false; |
86 return !invokeCallback(m_callback.newLocal(isolate), {{method.arguments | le
ngth}}, argv, callbackReturnValue, scriptExecutionContext(), isolate); | 95 {% set this_handle_parameter = 'v8::Handle<v8::Object>::Cast(thisHandle), ' if m
ethod.call_with_this_handle else '' %} |
| 96 return !invokeCallback(m_callback.newLocal(isolate), {{this_handle_parameter
}}{{method.arguments | length}}, argv, callbackReturnValue, scriptExecutionConte
xt(), isolate); |
87 } | 97 } |
88 | 98 |
89 {% endif %} | 99 {% endif %} |
90 {% endfor %}{# for method in methods #} | 100 {% endfor %}{# for method in methods #} |
91 } // namespace WebCore | 101 } // namespace WebCore |
92 | 102 |
93 {% if conditional_string %} | 103 {% if conditional_string %} |
94 #endif // {{conditional_string}} | 104 #endif // {{conditional_string}} |
95 {% endif %} | 105 {% endif %} |
OLD | NEW |