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

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

Issue 1288373002: [BlobAsync] Patch 2: Common Constants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@async1
Patch Set: comments Created 5 years, 1 month 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_data_item.cc ('k') | storage/browser/blob/view_blob_internals_job.cc » ('j') | 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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 return file_stream_provider_ 532 return file_stream_provider_
533 ->CreateFileStreamReader( 533 ->CreateFileStreamReader(
534 item.filesystem_url(), item.offset() + additional_offset, 534 item.filesystem_url(), item.offset() + additional_offset,
535 item.length() == std::numeric_limits<uint64_t>::max() 535 item.length() == std::numeric_limits<uint64_t>::max()
536 ? storage::kMaximumLength 536 ? storage::kMaximumLength
537 : item.length() - additional_offset, 537 : item.length() - additional_offset,
538 item.expected_modification_time()) 538 item.expected_modification_time())
539 .Pass(); 539 .Pass();
540 case DataElement::TYPE_BLOB: 540 case DataElement::TYPE_BLOB:
541 case DataElement::TYPE_BYTES: 541 case DataElement::TYPE_BYTES:
542 case DataElement::TYPE_BYTES_DESCRIPTION:
542 case DataElement::TYPE_DISK_CACHE_ENTRY: 543 case DataElement::TYPE_DISK_CACHE_ENTRY:
543 case DataElement::TYPE_UNKNOWN: 544 case DataElement::TYPE_UNKNOWN:
544 break; 545 break;
545 } 546 }
546 547
547 NOTREACHED(); 548 NOTREACHED();
548 return nullptr; 549 return nullptr;
549 } 550 }
550 551
551 void BlobReader::SetFileReaderAtIndex(size_t index, 552 void BlobReader::SetFileReaderAtIndex(size_t index,
552 scoped_ptr<FileStreamReader> reader) { 553 scoped_ptr<FileStreamReader> reader) {
553 auto found = index_to_reader_.find(current_item_index_); 554 auto found = index_to_reader_.find(current_item_index_);
554 if (found != index_to_reader_.end()) { 555 if (found != index_to_reader_.end()) {
555 if (found->second) { 556 if (found->second) {
556 delete found->second; 557 delete found->second;
557 } 558 }
558 if (!reader.get()) { 559 if (!reader.get()) {
559 index_to_reader_.erase(found); 560 index_to_reader_.erase(found);
560 return; 561 return;
561 } 562 }
562 found->second = reader.release(); 563 found->second = reader.release();
563 } else if (reader.get()) { 564 } else if (reader.get()) {
564 index_to_reader_[current_item_index_] = reader.release(); 565 index_to_reader_[current_item_index_] = reader.release();
565 } 566 }
566 } 567 }
567 568
568 } // namespace storage 569 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/blob/blob_data_item.cc ('k') | storage/browser/blob/view_blob_internals_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698