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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "storage/browser/blob/blob_data_handle.h" | 10 #include "storage/browser/blob/blob_data_handle.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 BlobEntry::ItemCopyEntry::~ItemCopyEntry() {} | 29 BlobEntry::ItemCopyEntry::~ItemCopyEntry() {} |
30 | 30 |
31 BlobEntry::BuildingState::BuildingState( | 31 BlobEntry::BuildingState::BuildingState( |
32 bool transport_items_present, | 32 bool transport_items_present, |
33 TransportAllowedCallback transport_allowed_callback, | 33 TransportAllowedCallback transport_allowed_callback, |
34 size_t num_building_dependent_blobs) | 34 size_t num_building_dependent_blobs) |
35 : transport_items_present(transport_items_present), | 35 : transport_items_present(transport_items_present), |
36 transport_allowed_callback(transport_allowed_callback), | 36 transport_allowed_callback(transport_allowed_callback), |
37 num_building_dependent_blobs(num_building_dependent_blobs) {} | 37 num_building_dependent_blobs(num_building_dependent_blobs) {} |
38 | 38 |
39 BlobEntry::BuildingState::~BuildingState() {} | 39 BlobEntry::BuildingState::~BuildingState() {} |
michaeln
2016/12/02 20:41:07
Are the quota_requests expected to be empty/done a
dmurph
2016/12/02 21:53:07
We can assert that.
| |
40 | 40 |
41 void BlobEntry::BuildingState::CancelRequests() { | |
42 if (copy_quota_request) { | |
43 copy_quota_request->Cancel(); | |
44 } | |
45 if (transport_quota_request) { | |
46 transport_quota_request->Cancel(); | |
47 } | |
48 } | |
49 | |
41 BlobEntry::BlobEntry(const std::string& content_type, | 50 BlobEntry::BlobEntry(const std::string& content_type, |
42 const std::string& content_disposition) | 51 const std::string& content_disposition) |
43 : content_type_(content_type), content_disposition_(content_disposition) {} | 52 : content_type_(content_type), content_disposition_(content_disposition) {} |
44 BlobEntry::~BlobEntry() {} | 53 BlobEntry::~BlobEntry() {} |
45 | 54 |
46 void BlobEntry::AppendSharedBlobItem( | 55 void BlobEntry::AppendSharedBlobItem( |
47 scoped_refptr<ShareableBlobDataItem> item) { | 56 scoped_refptr<ShareableBlobDataItem> item) { |
48 DCHECK(item); | 57 DCHECK(item); |
49 if (!items_.empty()) { | 58 if (!items_.empty()) { |
50 offsets_.push_back(size_); | 59 offsets_.push_back(size_); |
51 } | 60 } |
52 size_ += item->item()->length(); | 61 size_ += item->item()->length(); |
53 items_.push_back(std::move(item)); | 62 items_.push_back(std::move(item)); |
54 } | 63 } |
55 | 64 |
56 const std::vector<scoped_refptr<ShareableBlobDataItem>>& BlobEntry::items() | 65 const std::vector<scoped_refptr<ShareableBlobDataItem>>& BlobEntry::items() |
57 const { | 66 const { |
58 return items_; | 67 return items_; |
59 } | 68 } |
60 | 69 |
61 void BlobEntry::ClearItems() { | 70 void BlobEntry::ClearItems() { |
62 items_.clear(); | 71 items_.clear(); |
63 } | 72 } |
64 | 73 |
65 void BlobEntry::ClearOffsets() { | 74 void BlobEntry::ClearOffsets() { |
66 offsets_.clear(); | 75 offsets_.clear(); |
67 } | 76 } |
68 | 77 |
69 } // namespace storage | 78 } // namespace storage |
OLD | NEW |