OLD | NEW |
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 "storage/browser/blob/upload_blob_element_reader.h" | 5 #include "storage/browser/blob/upload_blob_element_reader.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
10 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
11 #include "storage/browser/blob/blob_data_handle.h" | 12 #include "storage/browser/blob/blob_data_handle.h" |
12 #include "storage/browser/blob/blob_reader.h" | 13 #include "storage/browser/blob/blob_reader.h" |
13 #include "storage/browser/fileapi/file_system_context.h" | 14 #include "storage/browser/fileapi/file_system_context.h" |
14 | 15 |
15 namespace storage { | 16 namespace storage { |
16 | 17 |
17 UploadBlobElementReader::UploadBlobElementReader( | 18 UploadBlobElementReader::UploadBlobElementReader( |
18 scoped_ptr<BlobDataHandle> handle, | 19 scoped_ptr<BlobDataHandle> handle, |
19 FileSystemContext* file_system_context, | 20 FileSystemContext* file_system_context, |
20 base::SingleThreadTaskRunner* file_task_runner) | 21 base::SingleThreadTaskRunner* file_task_runner) |
21 : handle_(handle.Pass()), | 22 : handle_(std::move(handle)), |
22 file_system_context_(file_system_context), | 23 file_system_context_(file_system_context), |
23 file_runner_(file_task_runner) {} | 24 file_runner_(file_task_runner) {} |
24 | 25 |
25 UploadBlobElementReader::~UploadBlobElementReader() {} | 26 UploadBlobElementReader::~UploadBlobElementReader() {} |
26 | 27 |
27 int UploadBlobElementReader::Init(const net::CompletionCallback& callback) { | 28 int UploadBlobElementReader::Init(const net::CompletionCallback& callback) { |
28 reader_ = | 29 reader_ = |
29 handle_->CreateReader(file_system_context_.get(), file_runner_.get()); | 30 handle_->CreateReader(file_system_context_.get(), file_runner_.get()); |
30 BlobReader::Status status = reader_->CalculateSize(callback); | 31 BlobReader::Status status = reader_->CalculateSize(callback); |
31 switch (status) { | 32 switch (status) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 68 } |
68 NOTREACHED(); | 69 NOTREACHED(); |
69 return net::ERR_FAILED; | 70 return net::ERR_FAILED; |
70 } | 71 } |
71 | 72 |
72 const std::string& UploadBlobElementReader::uuid() const { | 73 const std::string& UploadBlobElementReader::uuid() const { |
73 return handle_->uuid(); | 74 return handle_->uuid(); |
74 } | 75 } |
75 | 76 |
76 } // namespace storage | 77 } // namespace storage |
OLD | NEW |