| 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/ReadableStreamOperations.h" | 8 #include "bindings/core/v8/ReadableStreamOperations.h" |
| 9 #include "bindings/core/v8/ScopedPersistent.h" | 9 #include "bindings/core/v8/ScopedPersistent.h" |
| 10 #include "bindings/core/v8/ScriptFunction.h" | 10 #include "bindings/core/v8/ScriptFunction.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 ScriptValue call(ScriptValue v) override | 45 ScriptValue call(ScriptValue v) override |
| 46 { | 46 { |
| 47 RefPtr<ReadingContext> readingContext(m_readingContext); | 47 RefPtr<ReadingContext> readingContext(m_readingContext); |
| 48 if (!readingContext) | 48 if (!readingContext) |
| 49 return v; | 49 return v; |
| 50 bool done; | 50 bool done; |
| 51 v8::Local<v8::Value> item = v.v8Value(); | 51 v8::Local<v8::Value> item = v.v8Value(); |
| 52 ASSERT(item->IsObject()); | 52 ASSERT(item->IsObject()); |
| 53 v8::Local<v8::Value> value = v8CallOrCrash(v8UnpackIteratorResult(v.
scriptState(), item.As<v8::Object>(), &done)); | 53 v8::Local<v8::Value> value = v8CallOrCrash(v8UnpackIteratorResult(v.
getScriptState(), item.As<v8::Object>(), &done)); |
| 54 if (done) { | 54 if (done) { |
| 55 readingContext->onReadDone(); | 55 readingContext->onReadDone(); |
| 56 return v; | 56 return v; |
| 57 } | 57 } |
| 58 if (!V8Uint8Array::hasInstance(value, v.isolate())) { | 58 if (!V8Uint8Array::hasInstance(value, v.isolate())) { |
| 59 readingContext->onRejected(); | 59 readingContext->onRejected(); |
| 60 return ScriptValue(); | 60 return ScriptValue(); |
| 61 } | 61 } |
| 62 readingContext->onRead(V8Uint8Array::toImpl(value.As<v8::Object>()))
; | 62 readingContext->onRead(V8Uint8Array::toImpl(value.As<v8::Object>()))
; |
| 63 return v; | 63 return v; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 272 } |
| 273 ReadableStreamDataConsumerHandle::~ReadableStreamDataConsumerHandle() = default; | 273 ReadableStreamDataConsumerHandle::~ReadableStreamDataConsumerHandle() = default; |
| 274 | 274 |
| 275 FetchDataConsumerHandle::Reader* ReadableStreamDataConsumerHandle::obtainReaderI
nternal(Client* client) | 275 FetchDataConsumerHandle::Reader* ReadableStreamDataConsumerHandle::obtainReaderI
nternal(Client* client) |
| 276 { | 276 { |
| 277 return new ReadingContext::ReaderImpl(m_readingContext, client); | 277 return new ReadingContext::ReaderImpl(m_readingContext, client); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace blink | 280 } // namespace blink |
| 281 | 281 |
| OLD | NEW |