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

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

Issue 1506023003: Response construction with a ReadableStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 V8IteratorResultValue_h 5 #ifndef V8IteratorResultValue_h
6 #define V8IteratorResultValue_h 6 #define V8IteratorResultValue_h
7 7
8 #include "bindings/core/v8/ScriptValue.h" 8 #include "bindings/core/v8/ScriptValue.h"
9 #include "bindings/core/v8/ToV8.h" 9 #include "bindings/core/v8/ToV8.h"
10 #include "core/CoreExport.h" 10 #include "core/CoreExport.h"
11 #include <v8.h> 11 #include <v8.h>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 // "Iterator result" in this file is an object returned from iterator.next()
16 // having two members "done" and "value".
17
15 CORE_EXPORT v8::Local<v8::Object> v8IteratorResultValue(v8::Isolate*, bool done, v8::Local<v8::Value>); 18 CORE_EXPORT v8::Local<v8::Object> v8IteratorResultValue(v8::Isolate*, bool done, v8::Local<v8::Value>);
16 19
20 // Unpacks |result|, stores the value of "done" member to |done| and returns
21 // the value of "value" member. Returns an empty handle when errored.
22 CORE_EXPORT v8::MaybeLocal<v8::Value> v8UnpackIteratorResult(ScriptState*, v8::L ocal<v8::Object> result, bool* done);
23
17 template<typename T> 24 template<typename T>
18 inline ScriptValue v8IteratorResult(ScriptState* scriptState, const T& value) 25 inline ScriptValue v8IteratorResult(ScriptState* scriptState, const T& value)
19 { 26 {
20 return ScriptValue( 27 return ScriptValue(
21 scriptState, 28 scriptState,
22 v8IteratorResultValue( 29 v8IteratorResultValue(
23 scriptState->isolate(), 30 scriptState->isolate(),
24 false, 31 false,
25 toV8(value, scriptState->context()->Global(), scriptState->isolate() ))); 32 toV8(value, scriptState->context()->Global(), scriptState->isolate() )));
26 } 33 }
27 34
28 inline ScriptValue v8IteratorResultDone(ScriptState* scriptState) 35 inline ScriptValue v8IteratorResultDone(ScriptState* scriptState)
29 { 36 {
30 return ScriptValue( 37 return ScriptValue(
31 scriptState, 38 scriptState,
32 v8IteratorResultValue( 39 v8IteratorResultValue(
33 scriptState->isolate(), 40 scriptState->isolate(),
34 true, 41 true,
35 v8::Undefined(scriptState->isolate()))); 42 v8::Undefined(scriptState->isolate())));
36 } 43 }
37 44
38 } // namespace blink 45 } // namespace blink
39 46
40 #endif // V8IteratorResultValue_h 47 #endif // V8IteratorResultValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698