| 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 #ifndef ToV8_h | 5 #ifndef ToV8_h |
| 6 #define ToV8_h | 6 #define ToV8_h |
| 7 | 7 |
| 8 // toV8() provides C++ -> V8 conversion. Note that toV8() can return an empty | 8 // toV8() provides C++ -> V8 conversion. Note that toV8() can return an empty |
| 9 // handle. Call sites must check IsEmpty() before using return value. | 9 // handle. Call sites must check IsEmpty() before using return value. |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // ScriptWrappable | 27 // ScriptWrappable |
| 28 | 28 |
| 29 inline v8::Local<v8::Value> toV8(ScriptWrappable* impl, v8::Local<v8::Object> cr
eationContext, v8::Isolate* isolate) | 29 inline v8::Local<v8::Value> toV8(ScriptWrappable* impl, v8::Local<v8::Object> cr
eationContext, v8::Isolate* isolate) |
| 30 { | 30 { |
| 31 if (UNLIKELY(!impl)) | 31 if (UNLIKELY(!impl)) |
| 32 return v8::Null(isolate); | 32 return v8::Null(isolate); |
| 33 v8::Local<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); | 33 v8::Local<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); |
| 34 if (!wrapper.IsEmpty()) | 34 if (!wrapper.IsEmpty()) |
| 35 return wrapper; | 35 return wrapper; |
| 36 | 36 |
| 37 return impl->wrap(creationContext, isolate); | 37 return impl->wrap(isolate, creationContext); |
| 38 } | 38 } |
| 39 | 39 |
| 40 inline v8::Local<v8::Value> toV8(Node* impl, v8::Local<v8::Object> creationConte
xt, v8::Isolate* isolate) | 40 inline v8::Local<v8::Value> toV8(Node* impl, v8::Local<v8::Object> creationConte
xt, v8::Isolate* isolate) |
| 41 { | 41 { |
| 42 if (UNLIKELY(!impl)) | 42 if (UNLIKELY(!impl)) |
| 43 return v8::Null(isolate); | 43 return v8::Null(isolate); |
| 44 v8::Local<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); | 44 v8::Local<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate); |
| 45 if (!wrapper.IsEmpty()) | 45 if (!wrapper.IsEmpty()) |
| 46 return wrapper; | 46 return wrapper; |
| 47 | 47 |
| 48 return ScriptWrappable::fromNode(impl)->wrap(creationContext, isolate); | 48 return ScriptWrappable::fromNode(impl)->wrap(isolate, creationContext); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Special versions for DOMWindow, WorkerGlobalScope and EventTarget | 51 // Special versions for DOMWindow, WorkerGlobalScope and EventTarget |
| 52 | 52 |
| 53 CORE_EXPORT v8::Local<v8::Value> toV8(DOMWindow*, v8::Local<v8::Object> creation
Context, v8::Isolate*); | 53 CORE_EXPORT v8::Local<v8::Value> toV8(DOMWindow*, v8::Local<v8::Object> creation
Context, v8::Isolate*); |
| 54 CORE_EXPORT v8::Local<v8::Value> toV8(EventTarget*, v8::Local<v8::Object> creati
onContext, v8::Isolate*); | 54 CORE_EXPORT v8::Local<v8::Value> toV8(EventTarget*, v8::Local<v8::Object> creati
onContext, v8::Isolate*); |
| 55 v8::Local<v8::Value> toV8(WorkerGlobalScope*, v8::Local<v8::Object> creationCont
ext, v8::Isolate*); | 55 v8::Local<v8::Value> toV8(WorkerGlobalScope*, v8::Local<v8::Object> creationCont
ext, v8::Isolate*); |
| 56 | 56 |
| 57 // PassRefPtr, RawPtr and RefPtr | 57 // PassRefPtr, RawPtr and RefPtr |
| 58 | 58 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // Without toV8(void*, ...), call to toV8 with T* will match with | 243 // Without toV8(void*, ...), call to toV8 with T* will match with |
| 244 // toV8(bool, ...) if T is not a subclass of ScriptWrappable or if T is | 244 // toV8(bool, ...) if T is not a subclass of ScriptWrappable or if T is |
| 245 // declared but not defined (so it's not clear that T is a subclass of | 245 // declared but not defined (so it's not clear that T is a subclass of |
| 246 // ScriptWrappable). | 246 // ScriptWrappable). |
| 247 // This hack helps detect such unwanted implicit conversions from T* to bool. | 247 // This hack helps detect such unwanted implicit conversions from T* to bool. |
| 248 v8::Local<v8::Value> toV8(void* value, v8::Local<v8::Object> creationContext, v8
::Isolate*); | 248 v8::Local<v8::Value> toV8(void* value, v8::Local<v8::Object> creationContext, v8
::Isolate*); |
| 249 | 249 |
| 250 } // namespace blink | 250 } // namespace blink |
| 251 | 251 |
| 252 #endif // ToV8_h | 252 #endif // ToV8_h |
| OLD | NEW |