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

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

Issue 2172183003: Return unique_ptr<WebDataConsumerHandle::Reader> directly from obtainReader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gmock_cxx11
Patch Set: rebase 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
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"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 Member<BodyStreamBuffer> m_buffer; 97 Member<BodyStreamBuffer> m_buffer;
98 Member<FetchDataLoader::Client> m_client; 98 Member<FetchDataLoader::Client> m_client;
99 }; 99 };
100 100
101 BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, std::unique_ptr<Fet chDataConsumerHandle> handle) 101 BodyStreamBuffer::BodyStreamBuffer(ScriptState* scriptState, std::unique_ptr<Fet chDataConsumerHandle> handle)
102 : UnderlyingSourceBase(scriptState) 102 : UnderlyingSourceBase(scriptState)
103 , m_scriptState(scriptState) 103 , m_scriptState(scriptState)
104 , m_handle(std::move(handle)) 104 , m_handle(std::move(handle))
105 , m_reader(m_handle->obtainReader(this)) 105 , m_reader(m_handle->obtainFetchDataReader(this))
106 , m_madeFromReadableStream(false) 106 , m_madeFromReadableStream(false)
107 { 107 {
108 if (RuntimeEnabledFeatures::responseBodyWithV8ExtraStreamEnabled()) { 108 if (RuntimeEnabledFeatures::responseBodyWithV8ExtraStreamEnabled()) {
109 if (isTerminating(scriptState)) { 109 if (isTerminating(scriptState)) {
110 m_reader = nullptr; 110 m_reader = nullptr;
111 m_handle = nullptr; 111 m_handle = nullptr;
112 return; 112 return;
113 } 113 }
114 v8::Local<v8::Value> bodyValue = toV8(this, scriptState); 114 v8::Local<v8::Value> bodyValue = toV8(this, scriptState);
115 if (bodyValue.IsEmpty()) { 115 if (bodyValue.IsEmpty()) {
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 return createFetchDataConsumerHandleFromWebHandle(createDoneDataConsumer Handle()); 477 return createFetchDataConsumerHandleFromWebHandle(createDoneDataConsumer Handle());
478 } 478 }
479 if (isErrored) 479 if (isErrored)
480 return createFetchDataConsumerHandleFromWebHandle(createUnexpectedErrorD ataConsumerHandle()); 480 return createFetchDataConsumerHandleFromWebHandle(createUnexpectedErrorD ataConsumerHandle());
481 481
482 DCHECK(handle); 482 DCHECK(handle);
483 return handle; 483 return handle;
484 } 484 }
485 485
486 } // namespace blink 486 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698