| 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/blob_reader.h" | 5 #include "storage/browser/blob/blob_reader.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 : file_stream_provider_(std::move(file_stream_provider)), | 69 : file_stream_provider_(std::move(file_stream_provider)), |
| 70 file_task_runner_(file_task_runner), | 70 file_task_runner_(file_task_runner), |
| 71 net_error_(net::OK), | 71 net_error_(net::OK), |
| 72 weak_factory_(this) { | 72 weak_factory_(this) { |
| 73 if (blob_handle && !blob_handle->IsBroken()) { | 73 if (blob_handle && !blob_handle->IsBroken()) { |
| 74 blob_handle_.reset(new BlobDataHandle(*blob_handle)); | 74 blob_handle_.reset(new BlobDataHandle(*blob_handle)); |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 BlobReader::~BlobReader() { | 78 BlobReader::~BlobReader() { |
| 79 STLDeleteValues(&index_to_reader_); | 79 base::STLDeleteValues(&index_to_reader_); |
| 80 } | 80 } |
| 81 | 81 |
| 82 BlobReader::Status BlobReader::CalculateSize( | 82 BlobReader::Status BlobReader::CalculateSize( |
| 83 const net::CompletionCallback& done) { | 83 const net::CompletionCallback& done) { |
| 84 DCHECK(!total_size_calculated_); | 84 DCHECK(!total_size_calculated_); |
| 85 DCHECK(size_callback_.is_null()); | 85 DCHECK(size_callback_.is_null()); |
| 86 if (!blob_handle_.get() || blob_handle_->IsBroken()) { | 86 if (!blob_handle_.get() || blob_handle_->IsBroken()) { |
| 87 return ReportError(net::ERR_FILE_NOT_FOUND); | 87 return ReportError(net::ERR_FILE_NOT_FOUND); |
| 88 } | 88 } |
| 89 if (blob_handle_->IsBeingBuilt()) { | 89 if (blob_handle_->IsBeingBuilt()) { |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 index_to_reader_.erase(found); | 671 index_to_reader_.erase(found); |
| 672 return; | 672 return; |
| 673 } | 673 } |
| 674 found->second = reader.release(); | 674 found->second = reader.release(); |
| 675 } else if (reader.get()) { | 675 } else if (reader.get()) { |
| 676 index_to_reader_[current_item_index_] = reader.release(); | 676 index_to_reader_[current_item_index_] = reader.release(); |
| 677 } | 677 } |
| 678 } | 678 } |
| 679 | 679 |
| 680 } // namespace storage | 680 } // namespace storage |
| OLD | NEW |