| 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" |
| 11 #include "bindings/core/v8/ScriptValue.h" | 11 #include "bindings/core/v8/ScriptValue.h" |
| 12 #include "bindings/core/v8/V8BindingMacros.h" | 12 #include "bindings/core/v8/V8BindingMacros.h" |
| 13 #include "bindings/core/v8/V8IteratorResultValue.h" | 13 #include "bindings/core/v8/V8IteratorResultValue.h" |
| 14 #include "bindings/core/v8/V8Uint8Array.h" | 14 #include "bindings/core/v8/V8Uint8Array.h" |
| 15 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 15 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 16 #include "core/dom/DOMTypedArray.h" | 16 #include "core/dom/DOMTypedArray.h" |
| 17 #include "core/dom/TaskRunnerHelper.h" |
| 17 #include "core/streams/ReadableStreamOperations.h" | 18 #include "core/streams/ReadableStreamOperations.h" |
| 18 #include "core/workers/WorkerGlobalScope.h" | 19 #include "core/workers/WorkerGlobalScope.h" |
| 19 #include "public/platform/Platform.h" | 20 #include "public/platform/Platform.h" |
| 20 #include "public/platform/WebTaskRunner.h" | 21 #include "public/platform/WebTaskRunner.h" |
| 21 #include "public/platform/WebThread.h" | 22 #include "public/platform/WebThread.h" |
| 22 #include "public/platform/WebTraceLocation.h" | 23 #include "public/platform/WebTraceLocation.h" |
| 23 #include "wtf/Assertions.h" | 24 #include "wtf/Assertions.h" |
| 24 #include "wtf/Functional.h" | 25 #include "wtf/Functional.h" |
| 25 #include "wtf/RefCounted.h" | 26 #include "wtf/RefCounted.h" |
| 26 #include <algorithm> | 27 #include <algorithm> |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 void notify() | 236 void notify() |
| 236 { | 237 { |
| 237 if (!m_client) | 238 if (!m_client) |
| 238 return; | 239 return; |
| 239 m_client->didGetReadable(); | 240 m_client->didGetReadable(); |
| 240 } | 241 } |
| 241 | 242 |
| 242 void notifyLater() | 243 void notifyLater() |
| 243 { | 244 { |
| 244 ASSERT(m_client); | 245 ASSERT(m_client); |
| 245 Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK
_FROM_HERE, WTF::bind(&ReadingContext::notify, PassRefPtr<ReadingContext>(this))
); | 246 TaskRunnerHelper::getUnthrottledTaskRunner(m_scriptState.get())->postTas
k(BLINK_FROM_HERE, WTF::bind(&ReadingContext::notify, PassRefPtr<ReadingContext>
(this))); |
| 246 } | 247 } |
| 247 | 248 |
| 248 private: | 249 private: |
| 249 ReadingContext(ScriptState* scriptState, ScriptValue streamReader) | 250 ReadingContext(ScriptState* scriptState, ScriptValue streamReader) |
| 250 : m_reader(scriptState->isolate(), streamReader.v8Value()) | 251 : m_reader(scriptState->isolate(), streamReader.v8Value()) |
| 251 , m_scriptState(scriptState) | 252 , m_scriptState(scriptState) |
| 252 , m_client(nullptr) | 253 , m_client(nullptr) |
| 253 , m_pendingOffset(0) | 254 , m_pendingOffset(0) |
| 254 , m_isReading(false) | 255 , m_isReading(false) |
| 255 , m_isDone(false) | 256 , m_isDone(false) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 { | 293 { |
| 293 } | 294 } |
| 294 ReadableStreamDataConsumerHandle::~ReadableStreamDataConsumerHandle() = default; | 295 ReadableStreamDataConsumerHandle::~ReadableStreamDataConsumerHandle() = default; |
| 295 | 296 |
| 296 std::unique_ptr<FetchDataConsumerHandle::Reader> ReadableStreamDataConsumerHandl
e::obtainFetchDataReader(Client* client) | 297 std::unique_ptr<FetchDataConsumerHandle::Reader> ReadableStreamDataConsumerHandl
e::obtainFetchDataReader(Client* client) |
| 297 { | 298 { |
| 298 return WTF::wrapUnique(new ReadingContext::ReaderImpl(m_readingContext, clie
nt)); | 299 return WTF::wrapUnique(new ReadingContext::ReaderImpl(m_readingContext, clie
nt)); |
| 299 } | 300 } |
| 300 | 301 |
| 301 } // namespace blink | 302 } // namespace blink |
| OLD | NEW |