| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 read_callback_ = done; | 219 read_callback_ = done; |
| 220 return status; | 220 return status; |
| 221 } | 221 } |
| 222 | 222 |
| 223 void BlobReader::Kill() { | 223 void BlobReader::Kill() { |
| 224 DeleteCurrentFileReader(); | 224 DeleteCurrentFileReader(); |
| 225 weak_factory_.InvalidateWeakPtrs(); | 225 weak_factory_.InvalidateWeakPtrs(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 bool BlobReader::IsInMemory() const { | 228 bool BlobReader::IsInMemory() const { |
| 229 if (blob_handle_ && blob_handle_->IsBeingBuilt()) { |
| 230 return false; |
| 231 } |
| 229 if (!blob_data_.get()) { | 232 if (!blob_data_.get()) { |
| 230 return true; | 233 return true; |
| 231 } | 234 } |
| 232 for (const auto& item : blob_data_->items()) { | 235 for (const auto& item : blob_data_->items()) { |
| 233 if (item->type() != DataElement::TYPE_BYTES) { | 236 if (item->type() != DataElement::TYPE_BYTES) { |
| 234 return false; | 237 return false; |
| 235 } | 238 } |
| 236 } | 239 } |
| 237 return true; | 240 return true; |
| 238 } | 241 } |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 index_to_reader_.erase(found); | 671 index_to_reader_.erase(found); |
| 669 return; | 672 return; |
| 670 } | 673 } |
| 671 found->second = reader.release(); | 674 found->second = reader.release(); |
| 672 } else if (reader.get()) { | 675 } else if (reader.get()) { |
| 673 index_to_reader_[current_item_index_] = reader.release(); | 676 index_to_reader_[current_item_index_] = reader.release(); |
| 674 } | 677 } |
| 675 } | 678 } |
| 676 | 679 |
| 677 } // namespace storage | 680 } // namespace storage |
| OLD | NEW |