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

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

Issue 2000483004: [BlobReader] Correct IsInMemory = false when async constructing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests, and comment Created 4 years, 7 months 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/blob_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/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
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
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
OLDNEW
« no previous file with comments | « storage/browser/blob/blob_reader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698