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 #ifndef STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ | 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ |
6 #define STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ | 6 #define STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // wasn't enough memory to hold the item. | 115 // wasn't enough memory to hold the item. |
116 bool AppendAllocatedBlobItem(const std::string& target_blob_uuid, | 116 bool AppendAllocatedBlobItem(const std::string& target_blob_uuid, |
117 scoped_refptr<BlobDataItem> data_item, | 117 scoped_refptr<BlobDataItem> data_item, |
118 InternalBlobData::Builder* target_blob_data); | 118 InternalBlobData::Builder* target_blob_data); |
119 | 119 |
120 // Deconstructs the blob and appends it's contents to the target blob. Items | 120 // Deconstructs the blob and appends it's contents to the target blob. Items |
121 // are shared if possible, and copied if the given offset and length | 121 // are shared if possible, and copied if the given offset and length |
122 // have to split an item. | 122 // have to split an item. |
123 bool AppendBlob(const std::string& target_blob_uuid, | 123 bool AppendBlob(const std::string& target_blob_uuid, |
124 const InternalBlobData& blob, | 124 const InternalBlobData& blob, |
125 size_t offset, | 125 uint64_t offset, |
126 size_t length, | 126 uint64_t length, |
127 InternalBlobData::Builder* target_blob_data); | 127 InternalBlobData::Builder* target_blob_data); |
128 | 128 |
129 bool IsInUse(const std::string& uuid); | 129 bool IsInUse(const std::string& uuid); |
130 bool IsBeingBuilt(const std::string& uuid); | 130 bool IsBeingBuilt(const std::string& uuid); |
131 bool IsUrlRegistered(const GURL& blob_url); | 131 bool IsUrlRegistered(const GURL& blob_url); |
132 | 132 |
133 BlobMap blob_map_; | 133 BlobMap blob_map_; |
134 BlobURLMap public_blob_urls_; | 134 BlobURLMap public_blob_urls_; |
135 | 135 |
136 // Used to keep track of how much memory is being utilized for blob data, | 136 // Used to keep track of how much memory is being utilized for blob data, |
137 // we count only the items of TYPE_DATA which are held in memory and not | 137 // we count only the items of TYPE_DATA which are held in memory and not |
138 // items of TYPE_FILE. | 138 // items of TYPE_FILE. |
139 size_t memory_usage_; | 139 size_t memory_usage_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(BlobStorageContext); | 141 DISALLOW_COPY_AND_ASSIGN(BlobStorageContext); |
142 }; | 142 }; |
143 | 143 |
144 } // namespace storage | 144 } // namespace storage |
145 | 145 |
146 #endif // STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ | 146 #endif // STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ |
OLD | NEW |