Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1086)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ToV8.h

Issue 1167343002: Add methods for creating V8 extras-based ReadableStreams from C++ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Trying blindly to resolve circular dependency Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 DISALLOW_NEW(); 179 DISALLOW_NEW();
180 }; // Used only for having toV8 return v8::Undefined. 180 }; // Used only for having toV8 return v8::Undefined.
181 181
182 inline v8::Local<v8::Value> toV8(const ToV8UndefinedGenerator& value, v8::Local <v8::Object> creationContext, v8::Isolate* isolate) 182 inline v8::Local<v8::Value> toV8(const ToV8UndefinedGenerator& value, v8::Local <v8::Object> creationContext, v8::Isolate* isolate)
183 { 183 {
184 return v8::Undefined(isolate); 184 return v8::Undefined(isolate);
185 } 185 }
186 186
187 // ScriptValue 187 // ScriptValue
188 188
189 inline v8::Local<v8::Value> toV8(const ScriptValue& value, v8::Local<v8::Object> creationContext, v8::Isolate*) 189 inline v8::Local<v8::Value> toV8(const ScriptValue& value, v8::Local<v8::Object> creationContext, v8::Isolate*)
haraken 2016/02/09 01:19:29 Alternately, can we move this implementation to To
190 { 190 {
191 return value.v8Value(); 191 return value.v8Value();
192 } 192 }
193 193
194 // Dictionary 194 // Dictionary
195 195
196 inline v8::Local<v8::Value> toV8(const Dictionary& value, v8::Local<v8::Object> creationContext, v8::Isolate*) 196 inline v8::Local<v8::Value> toV8(const Dictionary& value, v8::Local<v8::Object> creationContext, v8::Isolate*)
197 { 197 {
198 RELEASE_ASSERT_NOT_REACHED(); 198 RELEASE_ASSERT_NOT_REACHED();
199 return v8::Local<v8::Value>(); 199 return v8::Local<v8::Value>();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // Only declare toV8(void*,...) for checking function overload mismatch. 255 // Only declare toV8(void*,...) for checking function overload mismatch.
256 // This toV8(void*,...) should be never used. So we will find mismatch 256 // This toV8(void*,...) should be never used. So we will find mismatch
257 // because of "unresolved external symbol". 257 // because of "unresolved external symbol".
258 // Without toV8(void*, ...), call to toV8 with T* will match with 258 // Without toV8(void*, ...), call to toV8 with T* will match with
259 // toV8(bool, ...) if T is not a subclass of ScriptWrappable or if T is 259 // toV8(bool, ...) if T is not a subclass of ScriptWrappable or if T is
260 // declared but not defined (so it's not clear that T is a subclass of 260 // declared but not defined (so it's not clear that T is a subclass of
261 // ScriptWrappable). 261 // ScriptWrappable).
262 // This hack helps detect such unwanted implicit conversions from T* to bool. 262 // This hack helps detect such unwanted implicit conversions from T* to bool.
263 v8::Local<v8::Value> toV8(void* value, v8::Local<v8::Object> creationContext, v8 ::Isolate*) = delete; 263 v8::Local<v8::Value> toV8(void* value, v8::Local<v8::Object> creationContext, v8 ::Isolate*) = delete;
264 264
265 // Cannot define in ScriptValue because of the circular dependency between toV8 and ScriptValue
266 template<typename T>
267 inline ScriptValue ScriptValue::from(ScriptState* scriptState, T&& value)
268 {
269 return ScriptValue(scriptState, toV8(std::forward<T>(value), scriptState));
270 }
271
265 } // namespace blink 272 } // namespace blink
266 273
267 #endif // ToV8_h 274 #endif // ToV8_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptValue.h ('k') | third_party/WebKit/Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698