| OLD | NEW |
| 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 "modules/fetch/ReadableStreamDataConsumerHandle.h" | 5 #include "modules/fetch/ReadableStreamDataConsumerHandle.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/ScriptFunction.h" | 9 #include "bindings/core/v8/ScriptFunction.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 if (!readingContext) | 63 if (!readingContext) |
| 64 return v; | 64 return v; |
| 65 bool done; | 65 bool done; |
| 66 v8::Local<v8::Value> item = v.v8Value(); | 66 v8::Local<v8::Value> item = v.v8Value(); |
| 67 ASSERT(item->IsObject()); | 67 ASSERT(item->IsObject()); |
| 68 if (isTerminating(v.getScriptState())) | 68 if (isTerminating(v.getScriptState())) |
| 69 return ScriptValue(); | 69 return ScriptValue(); |
| 70 v8::MaybeLocal<v8::Value> maybeValue = v8UnpackIteratorResult(v.getS
criptState(), item.As<v8::Object>(), &done); | 70 v8::MaybeLocal<v8::Value> maybeValue = v8UnpackIteratorResult(v.getS
criptState(), item.As<v8::Object>(), &done); |
| 71 if (isTerminating(v.getScriptState())) | 71 if (isTerminating(v.getScriptState())) |
| 72 return ScriptValue(); | 72 return ScriptValue(); |
| 73 v8::Local<v8::Value> value = v8CallOrCrash(maybeValue); | 73 v8::Local<v8::Value> value = maybeValue.ToLocalChecked(); |
| 74 if (done) { | 74 if (done) { |
| 75 readingContext->onReadDone(); | 75 readingContext->onReadDone(); |
| 76 return v; | 76 return v; |
| 77 } | 77 } |
| 78 if (!value->IsUint8Array()) { | 78 if (!value->IsUint8Array()) { |
| 79 readingContext->onRejected(); | 79 readingContext->onRejected(); |
| 80 return ScriptValue(); | 80 return ScriptValue(); |
| 81 } | 81 } |
| 82 readingContext->onRead(V8Uint8Array::toImpl(value.As<v8::Object>()))
; | 82 readingContext->onRead(V8Uint8Array::toImpl(value.As<v8::Object>()))
; |
| 83 return v; | 83 return v; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 { | 292 { |
| 293 } | 293 } |
| 294 ReadableStreamDataConsumerHandle::~ReadableStreamDataConsumerHandle() = default; | 294 ReadableStreamDataConsumerHandle::~ReadableStreamDataConsumerHandle() = default; |
| 295 | 295 |
| 296 std::unique_ptr<FetchDataConsumerHandle::Reader> ReadableStreamDataConsumerHandl
e::obtainFetchDataReader(Client* client) | 296 std::unique_ptr<FetchDataConsumerHandle::Reader> ReadableStreamDataConsumerHandl
e::obtainFetchDataReader(Client* client) |
| 297 { | 297 { |
| 298 return WTF::wrapUnique(new ReadingContext::ReaderImpl(m_readingContext, clie
nt)); | 298 return WTF::wrapUnique(new ReadingContext::ReaderImpl(m_readingContext, clie
nt)); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace blink | 301 } // namespace blink |
| OLD | NEW |