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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp

Issue 2229313002: Make FetchDataLoader accept BytesConsumer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-c++-rs
Patch Set: fix Created 4 years, 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/BodyStreamBuffer.h" 5 #include "modules/fetch/BodyStreamBuffer.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/V8HiddenValue.h" 8 #include "bindings/core/v8/V8HiddenValue.h"
9 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" 9 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
10 #include "core/dom/DOMArrayBuffer.h" 10 #include "core/dom/DOMArrayBuffer.h"
11 #include "core/dom/DOMTypedArray.h" 11 #include "core/dom/DOMTypedArray.h"
12 #include "core/dom/ExceptionCode.h" 12 #include "core/dom/ExceptionCode.h"
13 #include "core/streams/ReadableStreamController.h" 13 #include "core/streams/ReadableStreamController.h"
14 #include "core/streams/ReadableStreamOperations.h" 14 #include "core/streams/ReadableStreamOperations.h"
15 #include "core/workers/WorkerGlobalScope.h" 15 #include "core/workers/WorkerGlobalScope.h"
16 #include "modules/fetch/Body.h" 16 #include "modules/fetch/Body.h"
17 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h"
17 #include "modules/fetch/DataConsumerHandleUtil.h" 18 #include "modules/fetch/DataConsumerHandleUtil.h"
18 #include "modules/fetch/DataConsumerTee.h" 19 #include "modules/fetch/DataConsumerTee.h"
19 #include "modules/fetch/ReadableStreamDataConsumerHandle.h" 20 #include "modules/fetch/ReadableStreamDataConsumerHandle.h"
20 #include "platform/blob/BlobData.h" 21 #include "platform/blob/BlobData.h"
21 #include "platform/network/EncodedFormData.h" 22 #include "platform/network/EncodedFormData.h"
22 #include <memory> 23 #include <memory>
23 24
24 namespace blink { 25 namespace blink {
25 26
26 namespace { 27 namespace {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 199 }
199 return nullptr; 200 return nullptr;
200 } 201 }
201 202
202 void BodyStreamBuffer::startLoading(FetchDataLoader* loader, FetchDataLoader::Cl ient* client) 203 void BodyStreamBuffer::startLoading(FetchDataLoader* loader, FetchDataLoader::Cl ient* client)
203 { 204 {
204 ASSERT(!m_loader); 205 ASSERT(!m_loader);
205 ASSERT(m_scriptState->contextIsValid()); 206 ASSERT(m_scriptState->contextIsValid());
206 std::unique_ptr<FetchDataConsumerHandle> handle = releaseHandle(); 207 std::unique_ptr<FetchDataConsumerHandle> handle = releaseHandle();
207 m_loader = loader; 208 m_loader = loader;
208 loader->start(handle.get(), new LoaderClient(m_scriptState->getExecutionCont ext(), this, client)); 209 loader->start(new BytesConsumerForDataConsumerHandle(std::move(handle)), new LoaderClient(m_scriptState->getExecutionContext(), this, client));
209 } 210 }
210 211
211 void BodyStreamBuffer::tee(BodyStreamBuffer** branch1, BodyStreamBuffer** branch 2) 212 void BodyStreamBuffer::tee(BodyStreamBuffer** branch1, BodyStreamBuffer** branch 2)
212 { 213 {
213 DCHECK(!isStreamLocked()); 214 DCHECK(!isStreamLocked());
214 DCHECK(!isStreamDisturbed()); 215 DCHECK(!isStreamDisturbed());
215 *branch1 = nullptr; 216 *branch1 = nullptr;
216 *branch2 = nullptr; 217 *branch2 = nullptr;
217 218
218 if (m_madeFromReadableStream) { 219 if (m_madeFromReadableStream) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 return createFetchDataConsumerHandleFromWebHandle(createDoneDataConsumer Handle()); 420 return createFetchDataConsumerHandleFromWebHandle(createDoneDataConsumer Handle());
420 } 421 }
421 if (isErrored) 422 if (isErrored)
422 return createFetchDataConsumerHandleFromWebHandle(createUnexpectedErrorD ataConsumerHandle()); 423 return createFetchDataConsumerHandleFromWebHandle(createUnexpectedErrorD ataConsumerHandle());
423 424
424 DCHECK(handle); 425 DCHECK(handle);
425 return handle; 426 return handle;
426 } 427 }
427 428
428 } // namespace blink 429 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/fetch/BodyStreamBufferTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698