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

Side by Side Diff: third_party/WebKit/Source/core/streams/ReadableStreamOperations.cpp

Issue 1902673003: Reflect recent spec changes to V8 Extra ReadableStream impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated UnderlyingSourceBase Created 4 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "core/streams/ReadableStreamOperations.h" 5 #include "core/streams/ReadableStreamOperations.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptState.h" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "bindings/core/v8/ToV8.h" 9 #include "bindings/core/v8/ToV8.h"
10 #include "bindings/core/v8/V8ScriptRunner.h" 10 #include "bindings/core/v8/V8ScriptRunner.h"
(...skipping 22 matching lines...) Expand all
33 33
34 return ScriptValue(scriptState, jsStrategy); 34 return ScriptValue(scriptState, jsStrategy);
35 } 35 }
36 36
37 ScriptValue ReadableStreamOperations::getReader(ScriptState* scriptState, Script Value stream, ExceptionState& es) 37 ScriptValue ReadableStreamOperations::getReader(ScriptState* scriptState, Script Value stream, ExceptionState& es)
38 { 38 {
39 ASSERT(isReadableStream(scriptState, stream)); 39 ASSERT(isReadableStream(scriptState, stream));
40 40
41 v8::TryCatch block(scriptState->isolate()); 41 v8::TryCatch block(scriptState->isolate());
42 v8::Local<v8::Value> args[] = { stream.v8Value() }; 42 v8::Local<v8::Value> args[] = { stream.v8Value() };
43 ScriptValue result(scriptState, V8ScriptRunner::callExtra(scriptState, "Acqu ireReadableStreamReader", args)); 43 ScriptValue result(scriptState, V8ScriptRunner::callExtra(scriptState, "Acqu ireReadableStreamDefaultReader", args));
44 if (block.HasCaught()) 44 if (block.HasCaught())
45 es.rethrowV8Exception(block.Exception()); 45 es.rethrowV8Exception(block.Exception());
46 return result; 46 return result;
47 } 47 }
48 48
49 bool ReadableStreamOperations::isReadableStream(ScriptState* scriptState, Script Value value) 49 bool ReadableStreamOperations::isReadableStream(ScriptState* scriptState, Script Value value)
50 { 50 {
51 ASSERT(!value.isEmpty()); 51 ASSERT(!value.isEmpty());
52 52
53 if (!value.isObject()) 53 if (!value.isObject())
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 bool ReadableStreamOperations::isErrored(ScriptState* scriptState, ScriptValue s tream) 100 bool ReadableStreamOperations::isErrored(ScriptState* scriptState, ScriptValue s tream)
101 { 101 {
102 ASSERT(isReadableStream(scriptState, stream)); 102 ASSERT(isReadableStream(scriptState, stream));
103 103
104 v8::Local<v8::Value> args[] = { stream.v8Value() }; 104 v8::Local<v8::Value> args[] = { stream.v8Value() };
105 return V8ScriptRunner::callExtraOrCrash(scriptState, "IsReadableStreamErrore d", args)->ToBoolean()->Value(); 105 return V8ScriptRunner::callExtraOrCrash(scriptState, "IsReadableStreamErrore d", args)->ToBoolean()->Value();
106 } 106 }
107 107
108 bool ReadableStreamOperations::isReadableStreamReader(ScriptState* scriptState, ScriptValue value) 108 bool ReadableStreamOperations::isReadableStreamDefaultReader(ScriptState* script State, ScriptValue value)
109 { 109 {
110 ASSERT(!value.isEmpty()); 110 ASSERT(!value.isEmpty());
111 111
112 if (!value.isObject()) 112 if (!value.isObject())
113 return false; 113 return false;
114 114
115 v8::Local<v8::Value> args[] = { value.v8Value() }; 115 v8::Local<v8::Value> args[] = { value.v8Value() };
116 return V8ScriptRunner::callExtraOrCrash(scriptState, "IsReadableStreamReader ", args)->ToBoolean()->Value(); 116 return V8ScriptRunner::callExtraOrCrash(scriptState, "IsReadableStreamDefaul tReader", args)->ToBoolean()->Value();
117 } 117 }
118 118
119 ScriptPromise ReadableStreamOperations::read(ScriptState* scriptState, ScriptVal ue reader) 119 ScriptPromise ReadableStreamOperations::defaultReaderRead(ScriptState* scriptSta te, ScriptValue reader)
120 { 120 {
121 ASSERT(isReadableStreamReader(scriptState, reader)); 121 ASSERT(isReadableStreamDefaultReader(scriptState, reader));
122 122
123 v8::Local<v8::Value> args[] = { reader.v8Value() }; 123 v8::Local<v8::Value> args[] = { reader.v8Value() };
124 return ScriptPromise::cast(scriptState, V8ScriptRunner::callExtraOrCrash(scr iptState, "ReadFromReadableStreamReader", args)); 124 return ScriptPromise::cast(scriptState, V8ScriptRunner::callExtraOrCrash(scr iptState, "ReadableStreamDefaultReaderRead", args));
125 } 125 }
126 126
127 } // namespace blink 127 } // namespace blink
128
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698