| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 if (!readingContext) | 47 if (!readingContext) |
| 48 return v; | 48 return v; |
| 49 bool done; | 49 bool done; |
| 50 v8::Local<v8::Value> item = v.v8Value(); | 50 v8::Local<v8::Value> item = v.v8Value(); |
| 51 ASSERT(item->IsObject()); | 51 ASSERT(item->IsObject()); |
| 52 v8::Local<v8::Value> value = v8CallOrCrash(v8UnpackIteratorResult(v.
getScriptState(), item.As<v8::Object>(), &done)); | 52 v8::Local<v8::Value> value = v8CallOrCrash(v8UnpackIteratorResult(v.
getScriptState(), item.As<v8::Object>(), &done)); |
| 53 if (done) { | 53 if (done) { |
| 54 readingContext->onReadDone(); | 54 readingContext->onReadDone(); |
| 55 return v; | 55 return v; |
| 56 } | 56 } |
| 57 if (!V8Uint8Array::hasInstance(value, v.isolate())) { | 57 if (!value->IsUint8Array()) { |
| 58 readingContext->onRejected(); | 58 readingContext->onRejected(); |
| 59 return ScriptValue(); | 59 return ScriptValue(); |
| 60 } | 60 } |
| 61 readingContext->onRead(V8Uint8Array::toImpl(value.As<v8::Object>()))
; | 61 readingContext->onRead(V8Uint8Array::toImpl(value.As<v8::Object>()))
; |
| 62 return v; | 62 return v; |
| 63 } | 63 } |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 OnFulfilled(ScriptState* scriptState, PassRefPtr<ReadingContext> context
) | 66 OnFulfilled(ScriptState* scriptState, PassRefPtr<ReadingContext> context
) |
| 67 : ScriptFunction(scriptState), m_readingContext(context) {} | 67 : ScriptFunction(scriptState), m_readingContext(context) {} |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 { | 271 { |
| 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 |
| OLD | NEW |