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

Side by Side Diff: content/child/shared_memory_data_consumer_handle_unittest.cc

Issue 1544293002: Convert Pass()→std::move() in //content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 "content/child/shared_memory_data_consumer_handle.h" 5 #include "content/child/shared_memory_data_consumer_handle.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 #include <string> 9 #include <string>
10 #include <utility>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/bind.h" 13 #include "base/bind.h"
13 #include "base/callback.h" 14 #include "base/callback.h"
14 #include "base/location.h" 15 #include "base/location.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h" 18 #include "base/run_loop.h"
18 #include "base/task_runner.h" 19 #include "base/task_runner.h"
19 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 private: 121 private:
121 ReadDataOperation* operation_; 122 ReadDataOperation* operation_;
122 }; 123 };
123 124
124 class ReadDataOperation final { 125 class ReadDataOperation final {
125 public: 126 public:
126 typedef WebDataConsumerHandle::Result Result; 127 typedef WebDataConsumerHandle::Result Result;
127 ReadDataOperation(scoped_ptr<SharedMemoryDataConsumerHandle> handle, 128 ReadDataOperation(scoped_ptr<SharedMemoryDataConsumerHandle> handle,
128 base::MessageLoop* main_message_loop, 129 base::MessageLoop* main_message_loop,
129 const base::Closure& on_done) 130 const base::Closure& on_done)
130 : handle_(handle.Pass()), 131 : handle_(std::move(handle)),
131 main_message_loop_(main_message_loop), 132 main_message_loop_(main_message_loop),
132 on_done_(on_done) {} 133 on_done_(on_done) {}
133 134
134 const std::string& result() const { return result_; } 135 const std::string& result() const { return result_; }
135 136
136 void ReadData() { 137 void ReadData() {
137 if (!client_) { 138 if (!client_) {
138 client_.reset(new ClientImpl(this)); 139 client_.reset(new ClientImpl(this));
139 reader_ = handle_->ObtainReader(client_.get()); 140 reader_ = handle_->ObtainReader(client_.get());
140 } 141 }
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 "1\n" 994 "1\n"
994 "data1 is destructed.\n" 995 "data1 is destructed.\n"
995 "2\n" 996 "2\n"
996 "data2 is destructed.\n" 997 "data2 is destructed.\n"
997 "3\n", 998 "3\n",
998 logger->log()); 999 logger->log());
999 } 1000 }
1000 1001
1001 TEST_F(ThreadedSharedMemoryDataConsumerHandleTest, Read) { 1002 TEST_F(ThreadedSharedMemoryDataConsumerHandleTest, Read) {
1002 base::RunLoop run_loop; 1003 base::RunLoop run_loop;
1003 auto operation = make_scoped_ptr( 1004 auto operation = make_scoped_ptr(new ReadDataOperation(
1004 new ReadDataOperation(handle_.Pass(), &loop_, run_loop.QuitClosure())); 1005 std::move(handle_), &loop_, run_loop.QuitClosure()));
1005 scoped_refptr<Logger> logger(new Logger); 1006 scoped_refptr<Logger> logger(new Logger);
1006 1007
1007 base::Thread t("DataConsumerHandle test thread"); 1008 base::Thread t("DataConsumerHandle test thread");
1008 ASSERT_TRUE(t.Start()); 1009 ASSERT_TRUE(t.Start());
1009 1010
1010 t.message_loop()->PostTask(FROM_HERE, 1011 t.message_loop()->PostTask(FROM_HERE,
1011 base::Bind(&ReadDataOperation::ReadData, 1012 base::Bind(&ReadDataOperation::ReadData,
1012 base::Unretained(operation.get()))); 1013 base::Unretained(operation.get())));
1013 1014
1014 logger->Add("1"); 1015 logger->Add("1");
(...skipping 25 matching lines...) Expand all
1040 logger->log()); 1041 logger->log());
1041 } 1042 }
1042 1043
1043 INSTANTIATE_TEST_CASE_P(SharedMemoryDataConsumerHandleTest, 1044 INSTANTIATE_TEST_CASE_P(SharedMemoryDataConsumerHandleTest,
1044 SharedMemoryDataConsumerHandleTest, 1045 SharedMemoryDataConsumerHandleTest,
1045 ::testing::Values(kApplyBackpressure, 1046 ::testing::Values(kApplyBackpressure,
1046 kDoNotApplyBackpressure)); 1047 kDoNotApplyBackpressure));
1047 } // namespace 1048 } // namespace
1048 1049
1049 } // namespace content 1050 } // namespace content
OLDNEW
« no previous file with comments | « content/child/shared_memory_data_consumer_handle.cc ('k') | content/child/web_data_consumer_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698