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

Side by Side Diff: mojo/data_pipe_utils/data_pipe_file_utils.cc

Issue 2069663002: Some scoped_ptr -> std::unique_ptr conversion, especially under //mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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 | « mojo/dart/embedder/builtin_natives.cc ('k') | mojo/gles2/command_buffer_client_impl.h » ('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 "mojo/data_pipe_utils/data_pipe_utils.h" 5 #include "mojo/data_pipe_utils/data_pipe_utils.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory>
10 11
11 #include "base/files/file.h" 12 #include "base/files/file.h"
12 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
14 #include "base/files/scoped_file.h" 15 #include "base/files/scoped_file.h"
15 #include "base/location.h" 16 #include "base/location.h"
16 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
17 #include "mojo/data_pipe_utils/data_pipe_utils_internal.h" 18 #include "mojo/data_pipe_utils/data_pipe_utils_internal.h"
18 #include "mojo/public/cpp/environment/async_waiter.h" 19 #include "mojo/public/cpp/environment/async_waiter.h"
19 20
(...skipping 14 matching lines...) Expand all
34 void SendCallback(bool value); 35 void SendCallback(bool value);
35 void OpenFile(); 36 void OpenFile();
36 void OnHandleReady(MojoResult result); 37 void OnHandleReady(MojoResult result);
37 void WriteToFile(); 38 void WriteToFile();
38 39
39 ScopedDataPipeConsumerHandle source_; 40 ScopedDataPipeConsumerHandle source_;
40 const base::FilePath destination_; 41 const base::FilePath destination_;
41 base::TaskRunner* file_task_runner_; 42 base::TaskRunner* file_task_runner_;
42 base::Callback<void(bool)> callback_; 43 base::Callback<void(bool)> callback_;
43 base::File file_; 44 base::File file_;
44 scoped_ptr<AsyncWaiter> waiter_; 45 std::unique_ptr<AsyncWaiter> waiter_;
45 const void* buffer_; 46 const void* buffer_;
46 uint32_t buffer_size_; 47 uint32_t buffer_size_;
47 scoped_refptr<base::SingleThreadTaskRunner> main_runner_; 48 scoped_refptr<base::SingleThreadTaskRunner> main_runner_;
48 49
49 DISALLOW_COPY_AND_ASSIGN(CopyToFileHandler); 50 DISALLOW_COPY_AND_ASSIGN(CopyToFileHandler);
50 }; 51 };
51 52
52 CopyToFileHandler::CopyToFileHandler(ScopedDataPipeConsumerHandle source, 53 CopyToFileHandler::CopyToFileHandler(ScopedDataPipeConsumerHandle source,
53 const base::FilePath& destination, 54 const base::FilePath& destination,
54 base::TaskRunner* task_runner, 55 base::TaskRunner* task_runner,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void OpenFile(); 172 void OpenFile();
172 void OnHandleReady(MojoResult result); 173 void OnHandleReady(MojoResult result);
173 void ReadFromFile(); 174 void ReadFromFile();
174 175
175 const base::FilePath source_; 176 const base::FilePath source_;
176 ScopedDataPipeProducerHandle destination_; 177 ScopedDataPipeProducerHandle destination_;
177 uint32_t skip_; 178 uint32_t skip_;
178 base::TaskRunner* file_task_runner_; 179 base::TaskRunner* file_task_runner_;
179 base::Callback<void(bool)> callback_; 180 base::Callback<void(bool)> callback_;
180 base::File file_; 181 base::File file_;
181 scoped_ptr<AsyncWaiter> waiter_; 182 std::unique_ptr<AsyncWaiter> waiter_;
182 void* buffer_; 183 void* buffer_;
183 uint32_t buffer_size_; 184 uint32_t buffer_size_;
184 scoped_refptr<base::SingleThreadTaskRunner> main_runner_; 185 scoped_refptr<base::SingleThreadTaskRunner> main_runner_;
185 186
186 DISALLOW_COPY_AND_ASSIGN(CopyFromFileHandler); 187 DISALLOW_COPY_AND_ASSIGN(CopyFromFileHandler);
187 }; 188 };
188 189
189 CopyFromFileHandler::CopyFromFileHandler( 190 CopyFromFileHandler::CopyFromFileHandler(
190 const base::FilePath& source, 191 const base::FilePath& source,
191 ScopedDataPipeProducerHandle destination, 192 ScopedDataPipeProducerHandle destination,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 ScopedDataPipeProducerHandle destination, 356 ScopedDataPipeProducerHandle destination,
356 uint32_t skip, 357 uint32_t skip,
357 base::TaskRunner* task_runner, 358 base::TaskRunner* task_runner,
358 const base::Callback<void(bool)>& callback) { 359 const base::Callback<void(bool)>& callback) {
359 new CopyFromFileHandler(source, destination.Pass(), skip, task_runner, 360 new CopyFromFileHandler(source, destination.Pass(), skip, task_runner,
360 callback); 361 callback);
361 } 362 }
362 363
363 } // namespace common 364 } // namespace common
364 } // namespace mojo 365 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/dart/embedder/builtin_natives.cc ('k') | mojo/gles2/command_buffer_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698