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

Side by Side Diff: storage/browser/blob/upload_blob_element_reader.cc

Issue 1529743002: Revert of [Blob] Fix for resetting reader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « storage/browser/blob/upload_blob_element_reader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "storage/browser/blob/upload_blob_element_reader.h" 5 #include "storage/browser/blob/upload_blob_element_reader.h"
6 6
7 #include "base/single_thread_task_runner.h"
8 #include "net/base/net_errors.h" 7 #include "net/base/net_errors.h"
9 #include "storage/browser/blob/blob_data_handle.h" 8 #include "storage/browser/blob/blob_data_handle.h"
10 #include "storage/browser/blob/blob_reader.h" 9 #include "storage/browser/blob/blob_reader.h"
11 #include "storage/browser/fileapi/file_system_context.h"
12 10
13 namespace storage { 11 namespace storage {
14 12
15 UploadBlobElementReader::UploadBlobElementReader( 13 UploadBlobElementReader::UploadBlobElementReader(
16 scoped_ptr<BlobDataHandle> handle, 14 scoped_ptr<storage::BlobReader> reader,
17 FileSystemContext* file_system_context, 15 scoped_ptr<BlobDataHandle> handle)
18 base::SingleThreadTaskRunner* file_task_runner) 16 : reader_(reader.Pass()), handle_(handle.Pass()) {}
19 : handle_(handle.Pass()),
20 file_system_context_(file_system_context),
21 file_runner_(file_task_runner) {}
22 17
23 UploadBlobElementReader::~UploadBlobElementReader() {} 18 UploadBlobElementReader::~UploadBlobElementReader() {}
24 19
25 int UploadBlobElementReader::Init(const net::CompletionCallback& callback) { 20 int UploadBlobElementReader::Init(const net::CompletionCallback& callback) {
26 reader_ =
27 handle_->CreateReader(file_system_context_.get(), file_runner_.get());
28 BlobReader::Status status = reader_->CalculateSize(callback); 21 BlobReader::Status status = reader_->CalculateSize(callback);
29 switch (status) { 22 switch (status) {
30 case BlobReader::Status::NET_ERROR: 23 case BlobReader::Status::NET_ERROR:
31 return reader_->net_error(); 24 return reader_->net_error();
32 case BlobReader::Status::IO_PENDING: 25 case BlobReader::Status::IO_PENDING:
33 return net::ERR_IO_PENDING; 26 return net::ERR_IO_PENDING;
34 case BlobReader::Status::DONE: 27 case BlobReader::Status::DONE:
35 return net::OK; 28 return net::OK;
36 } 29 }
37 NOTREACHED(); 30 NOTREACHED();
(...skipping 27 matching lines...) Expand all
65 } 58 }
66 NOTREACHED(); 59 NOTREACHED();
67 return net::ERR_FAILED; 60 return net::ERR_FAILED;
68 } 61 }
69 62
70 const std::string& UploadBlobElementReader::uuid() const { 63 const std::string& UploadBlobElementReader::uuid() const {
71 return handle_->uuid(); 64 return handle_->uuid();
72 } 65 }
73 66
74 } // namespace storage 67 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/blob/upload_blob_element_reader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698