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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // To cleanly use a builder multiple times, please call Clone() on the | 55 // To cleanly use a builder multiple times, please call Clone() on the |
56 // builder, or even better for memory savings, clear the builder and append | 56 // builder, or even better for memory savings, clear the builder and append |
57 // the previously constructed blob. | 57 // the previously constructed blob. |
58 scoped_ptr<BlobDataHandle> AddFinishedBlob(BlobDataBuilder* builder); | 58 scoped_ptr<BlobDataHandle> AddFinishedBlob(BlobDataBuilder* builder); |
59 | 59 |
60 // Useful for coining blob urls from within the browser process. | 60 // Useful for coining blob urls from within the browser process. |
61 bool RegisterPublicBlobURL(const GURL& url, const std::string& uuid); | 61 bool RegisterPublicBlobURL(const GURL& url, const std::string& uuid); |
62 void RevokePublicBlobURL(const GURL& url); | 62 void RevokePublicBlobURL(const GURL& url); |
63 | 63 |
64 size_t memory_usage() const { return memory_usage_; } | 64 size_t memory_usage() const { return memory_usage_; } |
| 65 size_t blob_count() const { return blob_map_.size(); } |
65 | 66 |
66 private: | 67 private: |
67 friend class content::BlobStorageHost; | 68 friend class content::BlobStorageHost; |
68 friend class BlobDataHandle::BlobDataHandleShared; | 69 friend class BlobDataHandle::BlobDataHandleShared; |
69 friend class ViewBlobInternalsJob; | 70 friend class ViewBlobInternalsJob; |
70 | 71 |
71 enum EntryFlags { | 72 enum EntryFlags { |
72 EXCEEDED_MEMORY = 1 << 1, | 73 EXCEEDED_MEMORY = 1 << 1, |
73 }; | 74 }; |
74 | 75 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // 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 |
137 // items of TYPE_FILE. | 138 // items of TYPE_FILE. |
138 size_t memory_usage_; | 139 size_t memory_usage_; |
139 | 140 |
140 DISALLOW_COPY_AND_ASSIGN(BlobStorageContext); | 141 DISALLOW_COPY_AND_ASSIGN(BlobStorageContext); |
141 }; | 142 }; |
142 | 143 |
143 } // namespace storage | 144 } // namespace storage |
144 | 145 |
145 #endif // STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ | 146 #endif // STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ |
OLD | NEW |