| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2012 Ericsson AB. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 template<typename CallbackInfo> | 194 template<typename CallbackInfo> |
| 195 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ScriptWrappable*
impl) | 195 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ScriptWrappable*
impl) |
| 196 { | 196 { |
| 197 if (UNLIKELY(!impl)) { | 197 if (UNLIKELY(!impl)) { |
| 198 v8SetReturnValueNull(callbackInfo); | 198 v8SetReturnValueNull(callbackInfo); |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 if (DOMDataStore::setReturnValue(callbackInfo.GetReturnValue(), impl)) | 201 if (DOMDataStore::setReturnValue(callbackInfo.GetReturnValue(), impl)) |
| 202 return; | 202 return; |
| 203 v8::Local<v8::Object> wrapper = impl->wrap(callbackInfo.Holder(), callbackIn
fo.GetIsolate()); | 203 v8::Local<v8::Object> wrapper = impl->wrap(callbackInfo.GetIsolate(), callba
ckInfo.Holder()); |
| 204 v8SetReturnValue(callbackInfo, wrapper); | 204 v8SetReturnValue(callbackInfo, wrapper); |
| 205 } | 205 } |
| 206 | 206 |
| 207 template<typename CallbackInfo> | 207 template<typename CallbackInfo> |
| 208 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, Node* impl) | 208 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, Node* impl) |
| 209 { | 209 { |
| 210 if (UNLIKELY(!impl)) { | 210 if (UNLIKELY(!impl)) { |
| 211 v8SetReturnValueNull(callbackInfo); | 211 v8SetReturnValueNull(callbackInfo); |
| 212 return; | 212 return; |
| 213 } | 213 } |
| 214 if (DOMDataStore::setReturnValue(callbackInfo.GetReturnValue(), impl)) | 214 if (DOMDataStore::setReturnValue(callbackInfo.GetReturnValue(), impl)) |
| 215 return; | 215 return; |
| 216 v8::Local<v8::Object> wrapper = ScriptWrappable::fromNode(impl)->wrap(callba
ckInfo.Holder(), callbackInfo.GetIsolate()); | 216 v8::Local<v8::Object> wrapper = ScriptWrappable::fromNode(impl)->wrap(callba
ckInfo.GetIsolate(), callbackInfo.Holder()); |
| 217 v8SetReturnValue(callbackInfo, wrapper); | 217 v8SetReturnValue(callbackInfo, wrapper); |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Special versions for DOMWindow, WorkerGlobalScope and EventTarget | 220 // Special versions for DOMWindow, WorkerGlobalScope and EventTarget |
| 221 | 221 |
| 222 template<typename CallbackInfo> | 222 template<typename CallbackInfo> |
| 223 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, DOMWindow* impl) | 223 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, DOMWindow* impl) |
| 224 { | 224 { |
| 225 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); | 225 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 226 } | 226 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 252 template<typename CallbackInfo> | 252 template<typename CallbackInfo> |
| 253 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, Scrip
tWrappable* impl) | 253 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, Scrip
tWrappable* impl) |
| 254 { | 254 { |
| 255 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld()); | 255 ASSERT(DOMWrapperWorld::current(callbackInfo.GetIsolate()).isMainWorld()); |
| 256 if (UNLIKELY(!impl)) { | 256 if (UNLIKELY(!impl)) { |
| 257 v8SetReturnValueNull(callbackInfo); | 257 v8SetReturnValueNull(callbackInfo); |
| 258 return; | 258 return; |
| 259 } | 259 } |
| 260 if (DOMDataStore::setReturnValueForMainWorld(callbackInfo.GetReturnValue(),
impl)) | 260 if (DOMDataStore::setReturnValueForMainWorld(callbackInfo.GetReturnValue(),
impl)) |
| 261 return; | 261 return; |
| 262 v8::Local<v8::Object> wrapper = impl->wrap(callbackInfo.Holder(), callbackIn
fo.GetIsolate()); | 262 v8::Local<v8::Object> wrapper = impl->wrap(callbackInfo.GetIsolate(), callba
ckInfo.Holder()); |
| 263 v8SetReturnValue(callbackInfo, wrapper); | 263 v8SetReturnValue(callbackInfo, wrapper); |
| 264 } | 264 } |
| 265 | 265 |
| 266 template<typename CallbackInfo> | 266 template<typename CallbackInfo> |
| 267 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, Node*
impl) | 267 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, Node*
impl) |
| 268 { | 268 { |
| 269 // Since EventTarget has a special version of ToV8 and V8EventTarget.h | 269 // Since EventTarget has a special version of ToV8 and V8EventTarget.h |
| 270 // defines its own v8SetReturnValue family, which are slow, we need to | 270 // defines its own v8SetReturnValue family, which are slow, we need to |
| 271 // override them with optimized versions for Node and its subclasses. | 271 // override them with optimized versions for Node and its subclasses. |
| 272 // Without this overload, v8SetReturnValueForMainWorld for Node would be | 272 // Without this overload, v8SetReturnValueForMainWorld for Node would be |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 321 |
| 322 template<typename CallbackInfo> | 322 template<typename CallbackInfo> |
| 323 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, ScriptWrappab
le* impl, const ScriptWrappable* wrappable) | 323 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, ScriptWrappab
le* impl, const ScriptWrappable* wrappable) |
| 324 { | 324 { |
| 325 if (UNLIKELY(!impl)) { | 325 if (UNLIKELY(!impl)) { |
| 326 v8SetReturnValueNull(callbackInfo); | 326 v8SetReturnValueNull(callbackInfo); |
| 327 return; | 327 return; |
| 328 } | 328 } |
| 329 if (DOMDataStore::setReturnValueFast(callbackInfo.GetReturnValue(), impl, ca
llbackInfo.Holder(), wrappable)) | 329 if (DOMDataStore::setReturnValueFast(callbackInfo.GetReturnValue(), impl, ca
llbackInfo.Holder(), wrappable)) |
| 330 return; | 330 return; |
| 331 v8::Local<v8::Object> wrapper = impl->wrap(callbackInfo.Holder(), callbackIn
fo.GetIsolate()); | 331 v8::Local<v8::Object> wrapper = impl->wrap(callbackInfo.GetIsolate(), callba
ckInfo.Holder()); |
| 332 v8SetReturnValue(callbackInfo, wrapper); | 332 v8SetReturnValue(callbackInfo, wrapper); |
| 333 } | 333 } |
| 334 | 334 |
| 335 template<typename CallbackInfo> | 335 template<typename CallbackInfo> |
| 336 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, Node* impl, c
onst ScriptWrappable* wrappable) | 336 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, Node* impl, c
onst ScriptWrappable* wrappable) |
| 337 { | 337 { |
| 338 if (UNLIKELY(!impl)) { | 338 if (UNLIKELY(!impl)) { |
| 339 v8SetReturnValueNull(callbackInfo); | 339 v8SetReturnValueNull(callbackInfo); |
| 340 return; | 340 return; |
| 341 } | 341 } |
| 342 if (DOMDataStore::setReturnValueFast(callbackInfo.GetReturnValue(), impl, ca
llbackInfo.Holder(), wrappable)) | 342 if (DOMDataStore::setReturnValueFast(callbackInfo.GetReturnValue(), impl, ca
llbackInfo.Holder(), wrappable)) |
| 343 return; | 343 return; |
| 344 v8::Local<v8::Object> wrapper = ScriptWrappable::fromNode(impl)->wrap(callba
ckInfo.Holder(), callbackInfo.GetIsolate()); | 344 v8::Local<v8::Object> wrapper = ScriptWrappable::fromNode(impl)->wrap(callba
ckInfo.GetIsolate(), callbackInfo.Holder()); |
| 345 v8SetReturnValue(callbackInfo, wrapper); | 345 v8SetReturnValue(callbackInfo, wrapper); |
| 346 } | 346 } |
| 347 | 347 |
| 348 // Special versions for DOMWindow, WorkerGlobalScope and EventTarget | 348 // Special versions for DOMWindow, WorkerGlobalScope and EventTarget |
| 349 | 349 |
| 350 template<typename CallbackInfo> | 350 template<typename CallbackInfo> |
| 351 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, DOMWindow* im
pl, const ScriptWrappable*) | 351 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, DOMWindow* im
pl, const ScriptWrappable*) |
| 352 { | 352 { |
| 353 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); | 353 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 354 } | 354 } |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Local<v8::Function>); | 1064 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate*, ExecutionContext*, v8::Local<v8::Function>); |
| 1065 | 1065 |
| 1066 // Callback functions used by generated code. | 1066 // Callback functions used by generated code. |
| 1067 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); | 1067 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName,
const v8::PropertyCallbackInfo<v8::Value>&); |
| 1068 | 1068 |
| 1069 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); | 1069 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); |
| 1070 | 1070 |
| 1071 } // namespace blink | 1071 } // namespace blink |
| 1072 | 1072 |
| 1073 #endif // V8Binding_h | 1073 #endif // V8Binding_h |
| OLD | NEW |