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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.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 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/DataConsumerHandleTestUtil.h" 5 #include "modules/fetch/DataConsumerHandleTestUtil.h"
6 6
7 #include "bindings/core/v8/DOMWrapperWorld.h" 7 #include "bindings/core/v8/DOMWrapperWorld.h"
8 #include "wtf/PtrUtil.h" 8 #include "wtf/PtrUtil.h"
9 #include <memory> 9 #include <memory>
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 DataConsumerHandleTestUtil::ReplayingHandle::ReplayingHandle() 214 DataConsumerHandleTestUtil::ReplayingHandle::ReplayingHandle()
215 : m_context(Context::create()) 215 : m_context(Context::create())
216 { 216 {
217 } 217 }
218 218
219 DataConsumerHandleTestUtil::ReplayingHandle::~ReplayingHandle() 219 DataConsumerHandleTestUtil::ReplayingHandle::~ReplayingHandle()
220 { 220 {
221 m_context->detachHandle(); 221 m_context->detachHandle();
222 } 222 }
223 223
224 WebDataConsumerHandle::Reader* DataConsumerHandleTestUtil::ReplayingHandle::obta inReaderInternal(Client* client) 224 std::unique_ptr<WebDataConsumerHandle::Reader> DataConsumerHandleTestUtil::Repla yingHandle::obtainReader(Client* client)
225 { 225 {
226 return new ReaderImpl(m_context, client); 226 return WTF::wrapUnique(new ReaderImpl(m_context, client));
227 } 227 }
228 228
229 void DataConsumerHandleTestUtil::ReplayingHandle::add(const Command& command) 229 void DataConsumerHandleTestUtil::ReplayingHandle::add(const Command& command)
230 { 230 {
231 m_context->add(command); 231 m_context->add(command);
232 } 232 }
233 233
234 DataConsumerHandleTestUtil::HandleReader::HandleReader(std::unique_ptr<WebDataCo nsumerHandle> handle, std::unique_ptr<OnFinishedReading> onFinishedReading) 234 DataConsumerHandleTestUtil::HandleReader::HandleReader(std::unique_ptr<WebDataCo nsumerHandle> handle, std::unique_ptr<OnFinishedReading> onFinishedReading)
235 : m_reader(handle->obtainReader(this)) 235 : m_reader(handle->obtainReader(this))
236 , m_onFinishedReading(std::move(onFinishedReading)) 236 , m_onFinishedReading(std::move(onFinishedReading))
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 292 }
293 293
294 void DataConsumerHandleTestUtil::HandleTwoPhaseReader::runOnFinishedReading(std: :unique_ptr<HandleReadResult> result) 294 void DataConsumerHandleTestUtil::HandleTwoPhaseReader::runOnFinishedReading(std: :unique_ptr<HandleReadResult> result)
295 { 295 {
296 ASSERT(m_onFinishedReading); 296 ASSERT(m_onFinishedReading);
297 std::unique_ptr<OnFinishedReading> onFinishedReading(std::move(m_onFinishedR eading)); 297 std::unique_ptr<OnFinishedReading> onFinishedReading(std::move(m_onFinishedR eading));
298 (*onFinishedReading)(std::move(result)); 298 (*onFinishedReading)(std::move(result));
299 } 299 }
300 300
301 } // namespace blink 301 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698