| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 // Identity operator | 167 // Identity operator |
| 168 | 168 |
| 169 inline v8::Local<v8::Value> toV8(v8::Local<v8::Value> value, v8::Local<v8::Objec
t> creationContext, v8::Isolate*) | 169 inline v8::Local<v8::Value> toV8(v8::Local<v8::Value> value, v8::Local<v8::Objec
t> creationContext, v8::Isolate*) |
| 170 { | 170 { |
| 171 return value; | 171 return value; |
| 172 } | 172 } |
| 173 | 173 |
| 174 // Undefined | 174 // Undefined |
| 175 | 175 |
| 176 struct ToV8UndefinedGenerator { }; // Used only for having toV8 return v8::Undef
ined. | 176 struct ToV8UndefinedGenerator { |
| 177 DISALLOW_ALLOCATION(); |
| 178 }; // Used only for having toV8 return v8::Undefined. |
| 177 | 179 |
| 178 inline v8::Local<v8::Value> toV8(const ToV8UndefinedGenerator& value, v8::Local
<v8::Object> creationContext, v8::Isolate* isolate) | 180 inline v8::Local<v8::Value> toV8(const ToV8UndefinedGenerator& value, v8::Local
<v8::Object> creationContext, v8::Isolate* isolate) |
| 179 { | 181 { |
| 180 return v8::Undefined(isolate); | 182 return v8::Undefined(isolate); |
| 181 } | 183 } |
| 182 | 184 |
| 183 // ScriptValue | 185 // ScriptValue |
| 184 | 186 |
| 185 inline v8::Local<v8::Value> toV8(const ScriptValue& value, v8::Local<v8::Object>
creationContext, v8::Isolate*) | 187 inline v8::Local<v8::Value> toV8(const ScriptValue& value, v8::Local<v8::Object>
creationContext, v8::Isolate*) |
| 186 { | 188 { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // Without toV8(void*, ...), call to toV8 with T* will match with | 247 // Without toV8(void*, ...), call to toV8 with T* will match with |
| 246 // toV8(bool, ...) if T is not a subclass of ScriptWrappable or if T is | 248 // toV8(bool, ...) if T is not a subclass of ScriptWrappable or if T is |
| 247 // declared but not defined (so it's not clear that T is a subclass of | 249 // declared but not defined (so it's not clear that T is a subclass of |
| 248 // ScriptWrappable). | 250 // ScriptWrappable). |
| 249 // This hack helps detect such unwanted implicit conversions from T* to bool. | 251 // This hack helps detect such unwanted implicit conversions from T* to bool. |
| 250 v8::Local<v8::Value> toV8(void* value, v8::Local<v8::Object> creationContext, v8
::Isolate*) = delete; | 252 v8::Local<v8::Value> toV8(void* value, v8::Local<v8::Object> creationContext, v8
::Isolate*) = delete; |
| 251 | 253 |
| 252 } // namespace blink | 254 } // namespace blink |
| 253 | 255 |
| 254 #endif // ToV8_h | 256 #endif // ToV8_h |
| OLD | NEW |