| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 scoped_ptr<BlobDataHandle> GetBlobDataFromUUID(const std::string& uuid); | 48 scoped_ptr<BlobDataHandle> GetBlobDataFromUUID(const std::string& uuid); |
| 49 scoped_ptr<BlobDataHandle> GetBlobDataFromPublicURL(const GURL& url); | 49 scoped_ptr<BlobDataHandle> GetBlobDataFromPublicURL(const GURL& url); |
| 50 | 50 |
| 51 // Useful for coining blobs from within the browser process. If the | 51 // Useful for coining blobs from within the browser process. If the |
| 52 // blob cannot be added due to memory consumption, returns NULL. | 52 // blob cannot be added due to memory consumption, returns NULL. |
| 53 // A builder should not be used twice to create blobs, as the internal | 53 // A builder should not be used twice to create blobs, as the internal |
| 54 // resources are refcounted instead of copied for memory efficiency. | 54 // resources are refcounted instead of copied for memory efficiency. |
| 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(const BlobDataBuilder& builder); |
| 59 |
| 60 // Deprecated, use const ref version above. |
| 61 scoped_ptr<BlobDataHandle> AddFinishedBlob(const BlobDataBuilder* builder); |
| 59 | 62 |
| 60 // Useful for coining blob urls from within the browser process. | 63 // Useful for coining blob urls from within the browser process. |
| 61 bool RegisterPublicBlobURL(const GURL& url, const std::string& uuid); | 64 bool RegisterPublicBlobURL(const GURL& url, const std::string& uuid); |
| 62 void RevokePublicBlobURL(const GURL& url); | 65 void RevokePublicBlobURL(const GURL& url); |
| 63 | 66 |
| 64 size_t memory_usage() const { return memory_usage_; } | 67 size_t memory_usage() const { return memory_usage_; } |
| 65 size_t blob_count() const { return blob_map_.size(); } | 68 size_t blob_count() const { return blob_map_.size(); } |
| 66 | 69 |
| 67 private: | 70 private: |
| 68 friend class content::BlobStorageHost; | 71 friend class content::BlobStorageHost; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // we count only the items of TYPE_DATA which are held in memory and not | 140 // we count only the items of TYPE_DATA which are held in memory and not |
| 138 // items of TYPE_FILE. | 141 // items of TYPE_FILE. |
| 139 size_t memory_usage_; | 142 size_t memory_usage_; |
| 140 | 143 |
| 141 DISALLOW_COPY_AND_ASSIGN(BlobStorageContext); | 144 DISALLOW_COPY_AND_ASSIGN(BlobStorageContext); |
| 142 }; | 145 }; |
| 143 | 146 |
| 144 } // namespace storage | 147 } // namespace storage |
| 145 | 148 |
| 146 #endif // STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ | 149 #endif // STORAGE_BROWSER_BLOB_BLOB_STORAGE_CONTEXT_H_ |
| OLD | NEW |