| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 v8::Local<v8::Object> wrapper = ScriptWrappable::fromNode(impl)->wrap( | 200 v8::Local<v8::Object> wrapper = ScriptWrappable::fromNode(impl)->wrap( |
| 201 callbackInfo.GetIsolate(), callbackInfo.Holder()); | 201 callbackInfo.GetIsolate(), callbackInfo.Holder()); |
| 202 v8SetReturnValue(callbackInfo, wrapper); | 202 v8SetReturnValue(callbackInfo, wrapper); |
| 203 } | 203 } |
| 204 | 204 |
| 205 // Special versions for DOMWindow and EventTarget | 205 // Special versions for DOMWindow and EventTarget |
| 206 | 206 |
| 207 template <typename CallbackInfo> | 207 template <typename CallbackInfo> |
| 208 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, | 208 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, |
| 209 DOMWindow* impl) { | 209 DOMWindow* impl) { |
| 210 v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(), | 210 v8SetReturnValue( |
| 211 callbackInfo.GetIsolate())); | 211 callbackInfo, |
| 212 ToV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| 212 } | 213 } |
| 213 | 214 |
| 214 template <typename CallbackInfo> | 215 template <typename CallbackInfo> |
| 215 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, | 216 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, |
| 216 EventTarget* impl) { | 217 EventTarget* impl) { |
| 217 v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(), | 218 v8SetReturnValue( |
| 218 callbackInfo.GetIsolate())); | 219 callbackInfo, |
| 220 ToV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| 219 } | 221 } |
| 220 | 222 |
| 221 template <typename CallbackInfo, typename T> | 223 template <typename CallbackInfo, typename T> |
| 222 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, | 224 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, |
| 223 PassRefPtr<T> impl) { | 225 PassRefPtr<T> impl) { |
| 224 v8SetReturnValue(callbackInfo, impl.get()); | 226 v8SetReturnValue(callbackInfo, impl.get()); |
| 225 } | 227 } |
| 226 | 228 |
| 227 template <typename CallbackInfo> | 229 template <typename CallbackInfo> |
| 228 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, | 230 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 // v8SetReturnValueForMainWorld(Window*) | 264 // v8SetReturnValueForMainWorld(Window*) |
| 263 // Uses custom toV8 function and slow. | 265 // Uses custom toV8 function and slow. |
| 264 v8SetReturnValueForMainWorld(callbackInfo, ScriptWrappable::fromNode(impl)); | 266 v8SetReturnValueForMainWorld(callbackInfo, ScriptWrappable::fromNode(impl)); |
| 265 } | 267 } |
| 266 | 268 |
| 267 // Special versions for DOMWindow and EventTarget | 269 // Special versions for DOMWindow and EventTarget |
| 268 | 270 |
| 269 template <typename CallbackInfo> | 271 template <typename CallbackInfo> |
| 270 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, | 272 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, |
| 271 DOMWindow* impl) { | 273 DOMWindow* impl) { |
| 272 v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(), | 274 v8SetReturnValue( |
| 273 callbackInfo.GetIsolate())); | 275 callbackInfo, |
| 276 ToV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| 274 } | 277 } |
| 275 | 278 |
| 276 template <typename CallbackInfo> | 279 template <typename CallbackInfo> |
| 277 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, | 280 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, |
| 278 EventTarget* impl) { | 281 EventTarget* impl) { |
| 279 v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(), | 282 v8SetReturnValue( |
| 280 callbackInfo.GetIsolate())); | 283 callbackInfo, |
| 284 ToV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| 281 } | 285 } |
| 282 | 286 |
| 283 template <typename CallbackInfo, typename T> | 287 template <typename CallbackInfo, typename T> |
| 284 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, | 288 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, |
| 285 PassRefPtr<T> impl) { | 289 PassRefPtr<T> impl) { |
| 286 v8SetReturnValueForMainWorld(callbackInfo, impl.get()); | 290 v8SetReturnValueForMainWorld(callbackInfo, impl.get()); |
| 287 } | 291 } |
| 288 | 292 |
| 289 template <typename CallbackInfo> | 293 template <typename CallbackInfo> |
| 290 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, | 294 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 317 callbackInfo.GetIsolate(), callbackInfo.Holder()); | 321 callbackInfo.GetIsolate(), callbackInfo.Holder()); |
| 318 v8SetReturnValue(callbackInfo, wrapper); | 322 v8SetReturnValue(callbackInfo, wrapper); |
| 319 } | 323 } |
| 320 | 324 |
| 321 // Special versions for DOMWindow and EventTarget | 325 // Special versions for DOMWindow and EventTarget |
| 322 | 326 |
| 323 template <typename CallbackInfo> | 327 template <typename CallbackInfo> |
| 324 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, | 328 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, |
| 325 DOMWindow* impl, | 329 DOMWindow* impl, |
| 326 const ScriptWrappable*) { | 330 const ScriptWrappable*) { |
| 327 v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(), | 331 v8SetReturnValue( |
| 328 callbackInfo.GetIsolate())); | 332 callbackInfo, |
| 333 ToV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| 329 } | 334 } |
| 330 | 335 |
| 331 template <typename CallbackInfo> | 336 template <typename CallbackInfo> |
| 332 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, | 337 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, |
| 333 EventTarget* impl, | 338 EventTarget* impl, |
| 334 const ScriptWrappable*) { | 339 const ScriptWrappable*) { |
| 335 v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(), | 340 v8SetReturnValue( |
| 336 callbackInfo.GetIsolate())); | 341 callbackInfo, |
| 342 ToV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| 337 } | 343 } |
| 338 | 344 |
| 339 template <typename CallbackInfo, typename T, typename Wrappable> | 345 template <typename CallbackInfo, typename T, typename Wrappable> |
| 340 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, | 346 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, |
| 341 PassRefPtr<T> impl, | 347 PassRefPtr<T> impl, |
| 342 const Wrappable* wrappable) { | 348 const Wrappable* wrappable) { |
| 343 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); | 349 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); |
| 344 } | 350 } |
| 345 | 351 |
| 346 template <typename CallbackInfo, typename T> | 352 template <typename CallbackInfo, typename T> |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 // If the argument isn't an object, this will crash. | 1142 // If the argument isn't an object, this will crash. |
| 1137 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, | 1143 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, |
| 1138 v8::Isolate*); | 1144 v8::Isolate*); |
| 1139 | 1145 |
| 1140 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*, | 1146 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*, |
| 1141 const String& stringifiedJSON, | 1147 const String& stringifiedJSON, |
| 1142 ExceptionState&); | 1148 ExceptionState&); |
| 1143 } // namespace blink | 1149 } // namespace blink |
| 1144 | 1150 |
| 1145 #endif // V8Binding_h | 1151 #endif // V8Binding_h |
| OLD | NEW |