| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 | 6 |
| 7 #include "config.h" | 7 #include "config.h" |
| 8 #include "V8TestInterface2.h" | 8 #include "V8TestInterface2.h" |
| 9 | 9 |
| 10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 template <typename T> void V8_USE(T) { } | 51 template <typename T> void V8_USE(T) { } |
| 52 | 52 |
| 53 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 53 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 54 { | 54 { |
| 55 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes
tInterface2", info.Holder(), info.GetIsolate()); | 55 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes
tInterface2", info.Holder(), info.GetIsolate()); |
| 56 if (UNLIKELY(info.Length() < 1)) { | 56 if (UNLIKELY(info.Length() < 1)) { |
| 57 setMinimumArityTypeError(exceptionState, 1, info.Length()); | 57 setMinimumArityTypeError(exceptionState, 1, info.Length()); |
| 58 exceptionState.throwIfNeeded(); | 58 exceptionState.throwIfNeeded(); |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 61 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 62 unsigned index; | 62 unsigned index; |
| 63 { | 63 { |
| 64 v8::TryCatch block; | 64 v8::TryCatch block; |
| 65 V8RethrowTryCatchScope rethrow(block); | 65 V8RethrowTryCatchScope rethrow(block); |
| 66 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception
State), exceptionState); | 66 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception
State), exceptionState); |
| 67 } | 67 } |
| 68 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); | 68 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); |
| 69 if (exceptionState.hadException()) { | 69 if (exceptionState.hadException()) { |
| 70 exceptionState.throwIfNeeded(); | 70 exceptionState.throwIfNeeded(); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 v8SetReturnValue(info, result.release()); | 73 v8SetReturnValue(info, result.release()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 76 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 77 { | 77 { |
| 78 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 78 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 79 TestInterface2V8Internal::itemMethod(info); | 79 TestInterface2V8Internal::itemMethod(info); |
| 80 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 80 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 81 } | 81 } |
| 82 | 82 |
| 83 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 83 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 84 { | 84 { |
| 85 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", "
TestInterface2", info.Holder(), info.GetIsolate()); | 85 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", "
TestInterface2", info.Holder(), info.GetIsolate()); |
| 86 if (UNLIKELY(info.Length() < 2)) { | 86 if (UNLIKELY(info.Length() < 2)) { |
| 87 setMinimumArityTypeError(exceptionState, 2, info.Length()); | 87 setMinimumArityTypeError(exceptionState, 2, info.Length()); |
| 88 exceptionState.throwIfNeeded(); | 88 exceptionState.throwIfNeeded(); |
| 89 return; | 89 return; |
| 90 } | 90 } |
| 91 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 91 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 92 unsigned index; | 92 unsigned index; |
| 93 V8StringResource<> value; | 93 V8StringResource<> value; |
| 94 { | 94 { |
| 95 v8::TryCatch block; | 95 v8::TryCatch block; |
| 96 V8RethrowTryCatchScope rethrow(block); | 96 V8RethrowTryCatchScope rethrow(block); |
| 97 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception
State), exceptionState); | 97 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception
State), exceptionState); |
| 98 TOSTRING_VOID_INTERNAL(value, info[1]); | 98 TOSTRING_VOID_INTERNAL(value, info[1]); |
| 99 } | 99 } |
| 100 String result = impl->setItem(index, value, exceptionState); | 100 String result = impl->setItem(index, value, exceptionState); |
| 101 if (exceptionState.hadException()) { | 101 if (exceptionState.hadException()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 115 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 116 { | 116 { |
| 117 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem"
, "TestInterface2", info.Holder(), info.GetIsolate()); | 117 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem"
, "TestInterface2", info.Holder(), info.GetIsolate()); |
| 118 if (UNLIKELY(info.Length() < 1)) { | 118 if (UNLIKELY(info.Length() < 1)) { |
| 119 setMinimumArityTypeError(exceptionState, 1, info.Length()); | 119 setMinimumArityTypeError(exceptionState, 1, info.Length()); |
| 120 exceptionState.throwIfNeeded(); | 120 exceptionState.throwIfNeeded(); |
| 121 return; | 121 return; |
| 122 } | 122 } |
| 123 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 123 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 124 unsigned index; | 124 unsigned index; |
| 125 { | 125 { |
| 126 v8::TryCatch block; | 126 v8::TryCatch block; |
| 127 V8RethrowTryCatchScope rethrow(block); | 127 V8RethrowTryCatchScope rethrow(block); |
| 128 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception
State), exceptionState); | 128 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(index, toUInt32(info[0], exception
State), exceptionState); |
| 129 } | 129 } |
| 130 bool result = impl->deleteItem(index, exceptionState); | 130 bool result = impl->deleteItem(index, exceptionState); |
| 131 if (exceptionState.hadException()) { | 131 if (exceptionState.hadException()) { |
| 132 exceptionState.throwIfNeeded(); | 132 exceptionState.throwIfNeeded(); |
| 133 return; | 133 return; |
| 134 } | 134 } |
| 135 v8SetReturnValueBool(info, result); | 135 v8SetReturnValueBool(info, result); |
| 136 } | 136 } |
| 137 | 137 |
| 138 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | 138 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) |
| 139 { | 139 { |
| 140 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 140 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 141 TestInterface2V8Internal::deleteItemMethod(info); | 141 TestInterface2V8Internal::deleteItemMethod(info); |
| 142 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 142 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 143 } | 143 } |
| 144 | 144 |
| 145 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 145 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 146 { | 146 { |
| 147 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem",
"TestInterface2", info.Holder(), info.GetIsolate()); | 147 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem",
"TestInterface2", info.Holder(), info.GetIsolate()); |
| 148 if (UNLIKELY(info.Length() < 1)) { | 148 if (UNLIKELY(info.Length() < 1)) { |
| 149 setMinimumArityTypeError(exceptionState, 1, info.Length()); | 149 setMinimumArityTypeError(exceptionState, 1, info.Length()); |
| 150 exceptionState.throwIfNeeded(); | 150 exceptionState.throwIfNeeded(); |
| 151 return; | 151 return; |
| 152 } | 152 } |
| 153 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 153 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 154 V8StringResource<> name; | 154 V8StringResource<> name; |
| 155 { | 155 { |
| 156 TOSTRING_VOID_INTERNAL(name, info[0]); | 156 TOSTRING_VOID_INTERNAL(name, info[0]); |
| 157 } | 157 } |
| 158 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState); | 158 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState); |
| 159 if (exceptionState.hadException()) { | 159 if (exceptionState.hadException()) { |
| 160 exceptionState.throwIfNeeded(); | 160 exceptionState.throwIfNeeded(); |
| 161 return; | 161 return; |
| 162 } | 162 } |
| 163 v8SetReturnValue(info, result.release()); | 163 v8SetReturnValue(info, result.release()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 166 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
| 167 { | 167 { |
| 168 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 168 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 169 TestInterface2V8Internal::namedItemMethod(info); | 169 TestInterface2V8Internal::namedItemMethod(info); |
| 170 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 170 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 171 } | 171 } |
| 172 | 172 |
| 173 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 173 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 174 { | 174 { |
| 175 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte
m", "TestInterface2", info.Holder(), info.GetIsolate()); | 175 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte
m", "TestInterface2", info.Holder(), info.GetIsolate()); |
| 176 if (UNLIKELY(info.Length() < 2)) { | 176 if (UNLIKELY(info.Length() < 2)) { |
| 177 setMinimumArityTypeError(exceptionState, 2, info.Length()); | 177 setMinimumArityTypeError(exceptionState, 2, info.Length()); |
| 178 exceptionState.throwIfNeeded(); | 178 exceptionState.throwIfNeeded(); |
| 179 return; | 179 return; |
| 180 } | 180 } |
| 181 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 181 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 182 V8StringResource<> name; | 182 V8StringResource<> name; |
| 183 V8StringResource<> value; | 183 V8StringResource<> value; |
| 184 { | 184 { |
| 185 TOSTRING_VOID_INTERNAL(name, info[0]); | 185 TOSTRING_VOID_INTERNAL(name, info[0]); |
| 186 TOSTRING_VOID_INTERNAL(value, info[1]); | 186 TOSTRING_VOID_INTERNAL(value, info[1]); |
| 187 } | 187 } |
| 188 String result = impl->setNamedItem(name, value, exceptionState); | 188 String result = impl->setNamedItem(name, value, exceptionState); |
| 189 if (exceptionState.hadException()) { | 189 if (exceptionState.hadException()) { |
| 190 exceptionState.throwIfNeeded(); | 190 exceptionState.throwIfNeeded(); |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 v8SetReturnValueString(info, result, info.GetIsolate()); | 193 v8SetReturnValueString(info, result, info.GetIsolate()); |
| 194 } | 194 } |
| 195 | 195 |
| 196 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>
& info) | 196 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>
& info) |
| 197 { | 197 { |
| 198 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 198 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 199 TestInterface2V8Internal::setNamedItemMethod(info); | 199 TestInterface2V8Internal::setNamedItemMethod(info); |
| 200 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 200 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 201 } | 201 } |
| 202 | 202 |
| 203 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf
o) | 203 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf
o) |
| 204 { | 204 { |
| 205 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed
Item", "TestInterface2", info.Holder(), info.GetIsolate()); | 205 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed
Item", "TestInterface2", info.Holder(), info.GetIsolate()); |
| 206 if (UNLIKELY(info.Length() < 1)) { | 206 if (UNLIKELY(info.Length() < 1)) { |
| 207 setMinimumArityTypeError(exceptionState, 1, info.Length()); | 207 setMinimumArityTypeError(exceptionState, 1, info.Length()); |
| 208 exceptionState.throwIfNeeded(); | 208 exceptionState.throwIfNeeded(); |
| 209 return; | 209 return; |
| 210 } | 210 } |
| 211 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 211 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 212 V8StringResource<> name; | 212 V8StringResource<> name; |
| 213 { | 213 { |
| 214 TOSTRING_VOID_INTERNAL(name, info[0]); | 214 TOSTRING_VOID_INTERNAL(name, info[0]); |
| 215 } | 215 } |
| 216 bool result = impl->deleteNamedItem(name, exceptionState); | 216 bool result = impl->deleteNamedItem(name, exceptionState); |
| 217 if (exceptionState.hadException()) { | 217 if (exceptionState.hadException()) { |
| 218 exceptionState.throwIfNeeded(); | 218 exceptionState.throwIfNeeded(); |
| 219 return; | 219 return; |
| 220 } | 220 } |
| 221 v8SetReturnValueBool(info, result); | 221 v8SetReturnValueBool(info, result); |
| 222 } | 222 } |
| 223 | 223 |
| 224 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) | 224 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) |
| 225 { | 225 { |
| 226 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 226 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 227 TestInterface2V8Internal::deleteNamedItemMethod(info); | 227 TestInterface2V8Internal::deleteNamedItemMethod(info); |
| 228 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 228 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 229 } | 229 } |
| 230 | 230 |
| 231 static void stringifierMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | 231 static void stringifierMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) |
| 232 { | 232 { |
| 233 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 233 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 234 v8SetReturnValueString(info, impl->stringifierMethod(), info.GetIsolate()); | 234 v8SetReturnValueString(info, impl->stringifierMethod(), info.GetIsolate()); |
| 235 } | 235 } |
| 236 | 236 |
| 237 static void stringifierMethodMethodCallback(const v8::FunctionCallbackInfo<v8::V
alue>& info) | 237 static void stringifierMethodMethodCallback(const v8::FunctionCallbackInfo<v8::V
alue>& info) |
| 238 { | 238 { |
| 239 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 239 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 240 TestInterface2V8Internal::stringifierMethodMethod(info); | 240 TestInterface2V8Internal::stringifierMethodMethod(info); |
| 241 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 241 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 242 } | 242 } |
| 243 | 243 |
| 244 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | 244 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 245 { | 245 { |
| 246 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 246 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 247 v8SetReturnValueString(info, impl->stringifierMethod(), info.GetIsolate()); | 247 v8SetReturnValueString(info, impl->stringifierMethod(), info.GetIsolate()); |
| 248 } | 248 } |
| 249 | 249 |
| 250 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in
fo) | 250 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in
fo) |
| 251 { | 251 { |
| 252 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 252 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 253 TestInterface2V8Internal::toStringMethod(info); | 253 TestInterface2V8Internal::toStringMethod(info); |
| 254 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 254 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 255 } | 255 } |
| 256 | 256 |
| 257 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 257 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 258 { | 258 { |
| 259 RefPtr<TestInterface2> impl = TestInterface2::create(); | 259 RefPtr<TestInterface2> impl = TestInterface2::create(); |
| 260 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIso
late()); | 260 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIso
late()); |
| 261 v8SetReturnValue(info, wrapper); | 261 v8SetReturnValue(info, wrapper); |
| 262 } | 262 } |
| 263 | 263 |
| 264 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 264 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
| 265 { | 265 { |
| 266 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 266 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 267 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestInt
erface2", info.Holder(), info.GetIsolate()); | 267 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestInt
erface2", info.Holder(), info.GetIsolate()); |
| 268 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); | 268 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); |
| 269 if (exceptionState.throwIfNeeded()) | 269 if (exceptionState.throwIfNeeded()) |
| 270 return; | 270 return; |
| 271 if (!result) | 271 if (!result) |
| 272 return; | 272 return; |
| 273 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); | 273 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); |
| 274 } | 274 } |
| 275 | 275 |
| 276 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) | 276 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 277 { | 277 { |
| 278 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); | 278 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| 279 TestInterface2V8Internal::indexedPropertyGetter(index, info); | 279 TestInterface2V8Internal::indexedPropertyGetter(index, info); |
| 280 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 280 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 281 } | 281 } |
| 282 | 282 |
| 283 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) | 283 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 284 { | 284 { |
| 285 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 285 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 286 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value); | 286 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value); |
| 287 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestInt
erface2", info.Holder(), info.GetIsolate()); | 287 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestInt
erface2", info.Holder(), info.GetIsolate()); |
| 288 bool result = impl->setItem(index, propertyValue, exceptionState); | 288 bool result = impl->setItem(index, propertyValue, exceptionState); |
| 289 if (exceptionState.throwIfNeeded()) | 289 if (exceptionState.throwIfNeeded()) |
| 290 return; | 290 return; |
| 291 if (!result) | 291 if (!result) |
| 292 return; | 292 return; |
| 293 v8SetReturnValue(info, v8Value); | 293 v8SetReturnValue(info, v8Value); |
| 294 } | 294 } |
| 295 | 295 |
| 296 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 296 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 297 { | 297 { |
| 298 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); | 298 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| 299 TestInterface2V8Internal::indexedPropertySetter(index, v8Value, info); | 299 TestInterface2V8Internal::indexedPropertySetter(index, v8Value, info); |
| 300 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 300 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 301 } | 301 } |
| 302 | 302 |
| 303 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Boolean>& info) | 303 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Boolean>& info) |
| 304 { | 304 { |
| 305 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 305 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 306 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestI
nterface2", info.Holder(), info.GetIsolate()); | 306 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestI
nterface2", info.Holder(), info.GetIsolate()); |
| 307 DeleteResult result = impl->deleteItem(index, exceptionState); | 307 DeleteResult result = impl->deleteItem(index, exceptionState); |
| 308 if (exceptionState.throwIfNeeded()) | 308 if (exceptionState.throwIfNeeded()) |
| 309 return; | 309 return; |
| 310 if (result != DeleteUnknownProperty) | 310 if (result != DeleteUnknownProperty) |
| 311 return v8SetReturnValueBool(info, result == DeleteSuccess); | 311 return v8SetReturnValueBool(info, result == DeleteSuccess); |
| 312 } | 312 } |
| 313 | 313 |
| 314 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | 314 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) |
| 315 { | 315 { |
| 316 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); | 316 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMIndexedProperty"); |
| 317 TestInterface2V8Internal::indexedPropertyDeleter(index, info); | 317 TestInterface2V8Internal::indexedPropertyDeleter(index, info); |
| 318 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 318 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 319 } | 319 } |
| 320 | 320 |
| 321 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 321 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
| 322 { | 322 { |
| 323 if (info.Holder()->HasRealNamedProperty(name)) | 323 if (info.Holder()->HasRealNamedProperty(name)) |
| 324 return; | 324 return; |
| 325 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 325 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 326 return; | 326 return; |
| 327 | 327 |
| 328 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 328 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 329 AtomicString propertyName = toCoreAtomicString(name); | 329 AtomicString propertyName = toCoreAtomicString(name); |
| 330 v8::String::Utf8Value namedProperty(name); | 330 v8::String::Utf8Value namedProperty(name); |
| 331 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); | 331 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); |
| 332 RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionS
tate); | 332 RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionS
tate); |
| 333 if (exceptionState.throwIfNeeded()) | 333 if (exceptionState.throwIfNeeded()) |
| 334 return; | 334 return; |
| 335 if (!result) | 335 if (!result) |
| 336 return; | 336 return; |
| 337 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); | 337 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); |
| 338 } | 338 } |
| 339 | 339 |
| 340 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 340 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
| 341 { | 341 { |
| 342 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | 342 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 343 TestInterface2V8Internal::namedPropertyGetter(name, info); | 343 TestInterface2V8Internal::namedPropertyGetter(name, info); |
| 344 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 344 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 345 } | 345 } |
| 346 | 346 |
| 347 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 347 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 348 { | 348 { |
| 349 if (info.Holder()->HasRealNamedProperty(name)) | 349 if (info.Holder()->HasRealNamedProperty(name)) |
| 350 return; | 350 return; |
| 351 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 351 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
| 352 return; | 352 return; |
| 353 | 353 |
| 354 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 354 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 355 TOSTRING_VOID(V8StringResource<>, propertyName, name); | 355 TOSTRING_VOID(V8StringResource<>, propertyName, name); |
| 356 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value); | 356 TOSTRING_VOID(V8StringResource<>, propertyValue, v8Value); |
| 357 v8::String::Utf8Value namedProperty(name); | 357 v8::String::Utf8Value namedProperty(name); |
| 358 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); | 358 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); |
| 359 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState
); | 359 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState
); |
| 360 if (exceptionState.throwIfNeeded()) | 360 if (exceptionState.throwIfNeeded()) |
| 361 return; | 361 return; |
| 362 if (!result) | 362 if (!result) |
| 363 return; | 363 return; |
| 364 v8SetReturnValue(info, v8Value); | 364 v8SetReturnValue(info, v8Value); |
| 365 } | 365 } |
| 366 | 366 |
| 367 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 367 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 368 { | 368 { |
| 369 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | 369 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 370 TestInterface2V8Internal::namedPropertySetter(name, v8Value, info); | 370 TestInterface2V8Internal::namedPropertySetter(name, v8Value, info); |
| 371 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 371 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 372 } | 372 } |
| 373 | 373 |
| 374 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 374 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
| 375 { | 375 { |
| 376 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 376 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 377 AtomicString propertyName = toCoreAtomicString(name); | 377 AtomicString propertyName = toCoreAtomicString(name); |
| 378 v8::String::Utf8Value namedProperty(name); | 378 v8::String::Utf8Value namedProperty(name); |
| 379 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); | 379 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestInterface2", info.Holder(), info.GetIsolate()); |
| 380 bool result = impl->namedPropertyQuery(propertyName, exceptionState); | 380 bool result = impl->namedPropertyQuery(propertyName, exceptionState); |
| 381 if (exceptionState.throwIfNeeded()) | 381 if (exceptionState.throwIfNeeded()) |
| 382 return; | 382 return; |
| 383 if (!result) | 383 if (!result) |
| 384 return; | 384 return; |
| 385 v8SetReturnValueInt(info, v8::None); | 385 v8SetReturnValueInt(info, v8::None); |
| 386 } | 386 } |
| 387 | 387 |
| 388 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 388 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
| 389 { | 389 { |
| 390 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | 390 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 391 TestInterface2V8Internal::namedPropertyQuery(name, info); | 391 TestInterface2V8Internal::namedPropertyQuery(name, info); |
| 392 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 392 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 393 } | 393 } |
| 394 | 394 |
| 395 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) | 395 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) |
| 396 { | 396 { |
| 397 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 397 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 398 AtomicString propertyName = toCoreAtomicString(name); | 398 AtomicString propertyName = toCoreAtomicString(name); |
| 399 v8::String::Utf8Value namedProperty(name); | 399 v8::String::Utf8Value namedProperty(name); |
| 400 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "TestInterface2", info.Holder(), info.GetIsolate()); | 400 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "TestInterface2", info.Holder(), info.GetIsolate()); |
| 401 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState); | 401 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState); |
| 402 if (exceptionState.throwIfNeeded()) | 402 if (exceptionState.throwIfNeeded()) |
| 403 return; | 403 return; |
| 404 if (result != DeleteUnknownProperty) | 404 if (result != DeleteUnknownProperty) |
| 405 return v8SetReturnValueBool(info, result == DeleteSuccess); | 405 return v8SetReturnValueBool(info, result == DeleteSuccess); |
| 406 } | 406 } |
| 407 | 407 |
| 408 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) | 408 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) |
| 409 { | 409 { |
| 410 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | 410 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 411 TestInterface2V8Internal::namedPropertyDeleter(name, info); | 411 TestInterface2V8Internal::namedPropertyDeleter(name, info); |
| 412 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 412 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 413 } | 413 } |
| 414 | 414 |
| 415 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 415 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
| 416 { | 416 { |
| 417 TestInterface2* impl = V8TestInterface2::toNative(info.Holder()); | 417 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); |
| 418 Vector<String> names; | 418 Vector<String> names; |
| 419 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInter
face2", info.Holder(), info.GetIsolate()); | 419 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInter
face2", info.Holder(), info.GetIsolate()); |
| 420 impl->namedPropertyEnumerator(names, exceptionState); | 420 impl->namedPropertyEnumerator(names, exceptionState); |
| 421 if (exceptionState.throwIfNeeded()) | 421 if (exceptionState.throwIfNeeded()) |
| 422 return; | 422 return; |
| 423 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 423 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
| 424 for (size_t i = 0; i < names.size(); ++i) | 424 for (size_t i = 0; i < names.size(); ++i) |
| 425 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 425 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
| 426 v8SetReturnValue(info, v8names); | 426 v8SetReturnValue(info, v8names); |
| 427 } | 427 } |
| 428 | 428 |
| 429 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 429 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
| 430 { | 430 { |
| 431 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); | 431 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMNamedProperty"); |
| 432 TestInterface2V8Internal::namedPropertyEnumerator(info); | 432 TestInterface2V8Internal::namedPropertyEnumerator(info); |
| 433 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 433 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace TestInterface2V8Internal | 436 } // namespace TestInterface2V8Internal |
| 437 | 437 |
| 438 void V8TestInterface2::visitDOMWrapper(ScriptWrappableBase* internalPointer, con
st v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate) | 438 void V8TestInterface2::visitDOMWrapper(ScriptWrappableBase* internalPointer, con
st v8::Persistent<v8::Object>& wrapper, v8::Isolate* isolate) |
| 439 { | 439 { |
| 440 TestInterface2* impl = fromInternalPointer(internalPointer); | 440 TestInterface2* impl = internalPointer->toImpl<TestInterface2>(); |
| 441 // The ownerNode() method may return a reference or a pointer. | 441 // The ownerNode() method may return a reference or a pointer. |
| 442 if (Node* owner = WTF::getPtr(impl->ownerNode())) { | 442 if (Node* owner = WTF::getPtr(impl->ownerNode())) { |
| 443 Node* root = V8GCController::opaqueRootForGC(owner, isolate); | 443 Node* root = V8GCController::opaqueRootForGC(owner, isolate); |
| 444 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(r
oot)), wrapper); | 444 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(r
oot)), wrapper); |
| 445 return; | 445 return; |
| 446 } | 446 } |
| 447 setObjectGroup(internalPointer, wrapper, isolate); | 447 setObjectGroup(internalPointer, wrapper, isolate); |
| 448 } | 448 } |
| 449 | 449 |
| 450 static const V8DOMConfiguration::MethodConfiguration V8TestInterface2Methods[] =
{ | 450 static const V8DOMConfiguration::MethodConfiguration V8TestInterface2Methods[] =
{ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 bool V8TestInterface2::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* i
solate) | 508 bool V8TestInterface2::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* i
solate) |
| 509 { | 509 { |
| 510 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | 510 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); |
| 511 } | 511 } |
| 512 | 512 |
| 513 v8::Handle<v8::Object> V8TestInterface2::findInstanceInPrototypeChain(v8::Handle
<v8::Value> v8Value, v8::Isolate* isolate) | 513 v8::Handle<v8::Object> V8TestInterface2::findInstanceInPrototypeChain(v8::Handle
<v8::Value> v8Value, v8::Isolate* isolate) |
| 514 { | 514 { |
| 515 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | 515 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); |
| 516 } | 516 } |
| 517 | 517 |
| 518 TestInterface2* V8TestInterface2::toNativeWithTypeCheck(v8::Isolate* isolate, v8
::Handle<v8::Value> value) | 518 TestInterface2* V8TestInterface2::toImplWithTypeCheck(v8::Isolate* isolate, v8::
Handle<v8::Value> value) |
| 519 { | 519 { |
| 520 return hasInstance(value, isolate) ? fromInternalPointer(blink::toInternalPo
inter(v8::Handle<v8::Object>::Cast(value))) : 0; | 520 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle
<v8::Object>::Cast(value))->toImpl<TestInterface2>() : 0; |
| 521 } | 521 } |
| 522 | 522 |
| 523 | 523 |
| 524 void V8TestInterface2::refObject(ScriptWrappableBase* internalPointer) | 524 void V8TestInterface2::refObject(ScriptWrappableBase* internalPointer) |
| 525 { | 525 { |
| 526 fromInternalPointer(internalPointer)->ref(); | 526 internalPointer->toImpl<TestInterface2>()->ref(); |
| 527 } | 527 } |
| 528 | 528 |
| 529 void V8TestInterface2::derefObject(ScriptWrappableBase* internalPointer) | 529 void V8TestInterface2::derefObject(ScriptWrappableBase* internalPointer) |
| 530 { | 530 { |
| 531 fromInternalPointer(internalPointer)->deref(); | 531 internalPointer->toImpl<TestInterface2>()->deref(); |
| 532 } | 532 } |
| 533 | 533 |
| 534 WrapperPersistentNode* V8TestInterface2::createPersistentHandle(ScriptWrappableB
ase* internalPointer) | 534 WrapperPersistentNode* V8TestInterface2::createPersistentHandle(ScriptWrappableB
ase* internalPointer) |
| 535 { | 535 { |
| 536 ASSERT_NOT_REACHED(); | 536 ASSERT_NOT_REACHED(); |
| 537 return 0; | 537 return 0; |
| 538 } | 538 } |
| 539 | 539 |
| 540 template<> | 540 template<> |
| 541 v8::Handle<v8::Value> toV8NoInline(TestInterface2* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) | 541 v8::Handle<v8::Value> toV8NoInline(TestInterface2* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) |
| 542 { | 542 { |
| 543 return toV8(impl, creationContext, isolate); | 543 return toV8(impl, creationContext, isolate); |
| 544 } | 544 } |
| 545 | 545 |
| 546 } // namespace blink | 546 } // namespace blink |
| OLD | NEW |