| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/media_galleries/linux/mtp_read_file_worker.h" | 5 #include "chrome/browser/media_galleries/linux/mtp_read_file_worker.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 DCHECK(!device_handle_.empty()); | 44 DCHECK(!device_handle_.empty()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 MTPReadFileWorker::~MTPReadFileWorker() { | 47 MTPReadFileWorker::~MTPReadFileWorker() { |
| 48 } | 48 } |
| 49 | 49 |
| 50 void MTPReadFileWorker::WriteDataIntoSnapshotFile( | 50 void MTPReadFileWorker::WriteDataIntoSnapshotFile( |
| 51 const SnapshotRequestInfo& request_info, | 51 const SnapshotRequestInfo& request_info, |
| 52 const base::File::Info& snapshot_file_info) { | 52 const base::File::Info& snapshot_file_info) { |
| 53 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 53 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 54 ReadDataChunkFromDeviceFile(base::WrapUnique( | 54 ReadDataChunkFromDeviceFile( |
| 55 new SnapshotFileDetails(request_info, snapshot_file_info))); | 55 base::MakeUnique<SnapshotFileDetails>(request_info, snapshot_file_info)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void MTPReadFileWorker::ReadDataChunkFromDeviceFile( | 58 void MTPReadFileWorker::ReadDataChunkFromDeviceFile( |
| 59 std::unique_ptr<SnapshotFileDetails> snapshot_file_details) { | 59 std::unique_ptr<SnapshotFileDetails> snapshot_file_details) { |
| 60 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 60 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 61 DCHECK(snapshot_file_details.get()); | 61 DCHECK(snapshot_file_details.get()); |
| 62 | 62 |
| 63 // To avoid calling |snapshot_file_details| methods and passing ownership of | 63 // To avoid calling |snapshot_file_details| methods and passing ownership of |
| 64 // |snapshot_file_details| in the same_line. | 64 // |snapshot_file_details| in the same_line. |
| 65 SnapshotFileDetails* snapshot_file_details_ptr = snapshot_file_details.get(); | 65 SnapshotFileDetails* snapshot_file_details_ptr = snapshot_file_details.get(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 base::File::FILE_ERROR_FAILED)); | 132 base::File::FILE_ERROR_FAILED)); |
| 133 return; | 133 return; |
| 134 } | 134 } |
| 135 content::BrowserThread::PostTask( | 135 content::BrowserThread::PostTask( |
| 136 content::BrowserThread::IO, | 136 content::BrowserThread::IO, |
| 137 FROM_HERE, | 137 FROM_HERE, |
| 138 base::Bind(snapshot_file_details->success_callback(), | 138 base::Bind(snapshot_file_details->success_callback(), |
| 139 snapshot_file_details->file_info(), | 139 snapshot_file_details->file_info(), |
| 140 snapshot_file_details->snapshot_file_path())); | 140 snapshot_file_details->snapshot_file_path())); |
| 141 } | 141 } |
| OLD | NEW |