| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_storage_context.h" | 5 #include "storage/browser/blob/blob_storage_context.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 read_size); | 360 read_size); |
| 361 data_item = | 361 data_item = |
| 362 new BlobDataItem(std::move(element), source_item->data_handle_, | 362 new BlobDataItem(std::move(element), source_item->data_handle_, |
| 363 source_item->disk_cache_entry(), | 363 source_item->disk_cache_entry(), |
| 364 source_item->disk_cache_stream_index(), | 364 source_item->disk_cache_stream_index(), |
| 365 source_item->disk_cache_side_stream_index()); | 365 source_item->disk_cache_side_stream_index()); |
| 366 break; | 366 break; |
| 367 } | 367 } |
| 368 case DataElement::TYPE_BLOB: | 368 case DataElement::TYPE_BLOB: |
| 369 case DataElement::TYPE_UNKNOWN: | 369 case DataElement::TYPE_UNKNOWN: |
| 370 CHECK(false) << "Illegal blob item type: " << type; | 370 // Illegal blob item type. |
| 371 CHECK(false); |
| 371 } | 372 } |
| 372 dest_items.push_back( | 373 dest_items.push_back( |
| 373 new ShareableBlobDataItem(std::move(data_item), state)); | 374 new ShareableBlobDataItem(std::move(data_item), state)); |
| 374 item_offset = 0; | 375 item_offset = 0; |
| 375 } | 376 } |
| 376 } | 377 } |
| 377 | 378 |
| 378 BlobStorageContext::BlobSlice::~BlobSlice() {} | 379 BlobStorageContext::BlobSlice::~BlobSlice() {} |
| 379 | 380 |
| 380 BlobStorageContext::BlobStorageContext() | 381 BlobStorageContext::BlobStorageContext() |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 return handle; | 569 return handle; |
| 569 } | 570 } |
| 570 | 571 |
| 571 void BlobStorageContext::CancelBuildingBlob(const std::string& uuid, | 572 void BlobStorageContext::CancelBuildingBlob(const std::string& uuid, |
| 572 BlobStatus reason) { | 573 BlobStatus reason) { |
| 573 CancelBuildingBlobInternal(registry_.GetEntry(uuid), reason); | 574 CancelBuildingBlobInternal(registry_.GetEntry(uuid), reason); |
| 574 } | 575 } |
| 575 | 576 |
| 576 void BlobStorageContext::NotifyTransportComplete(const std::string& uuid) { | 577 void BlobStorageContext::NotifyTransportComplete(const std::string& uuid) { |
| 577 BlobEntry* entry = registry_.GetEntry(uuid); | 578 BlobEntry* entry = registry_.GetEntry(uuid); |
| 578 CHECK(entry) << "There is no blob entry with uuid " << uuid; | 579 // There is no blob entry with uuid |uuid| |
| 580 CHECK(entry); |
| 579 DCHECK(BlobStatusIsPending(entry->status())); | 581 DCHECK(BlobStatusIsPending(entry->status())); |
| 580 NotifyTransportCompleteInternal(entry); | 582 NotifyTransportCompleteInternal(entry); |
| 581 } | 583 } |
| 582 | 584 |
| 583 void BlobStorageContext::IncrementBlobRefCount(const std::string& uuid) { | 585 void BlobStorageContext::IncrementBlobRefCount(const std::string& uuid) { |
| 584 BlobEntry* entry = registry_.GetEntry(uuid); | 586 BlobEntry* entry = registry_.GetEntry(uuid); |
| 585 DCHECK(entry); | 587 DCHECK(entry); |
| 586 entry->IncrementRefCount(); | 588 entry->IncrementRefCount(); |
| 587 } | 589 } |
| 588 | 590 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 | 826 |
| 825 void BlobStorageContext::ClearAndFreeMemory(BlobEntry* entry) { | 827 void BlobStorageContext::ClearAndFreeMemory(BlobEntry* entry) { |
| 826 if (entry->building_state_) | 828 if (entry->building_state_) |
| 827 entry->building_state_->CancelRequests(); | 829 entry->building_state_->CancelRequests(); |
| 828 entry->ClearItems(); | 830 entry->ClearItems(); |
| 829 entry->ClearOffsets(); | 831 entry->ClearOffsets(); |
| 830 entry->set_size(0); | 832 entry->set_size(0); |
| 831 } | 833 } |
| 832 | 834 |
| 833 } // namespace storage | 835 } // namespace storage |
| OLD | NEW |