| 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 #ifndef STORAGE_BROWSER_BLOB_INTERNAL_BLOB_DATA_H_ | 5 #ifndef STORAGE_BROWSER_BLOB_INTERNAL_BLOB_DATA_H_ |
| 6 #define STORAGE_BROWSER_BLOB_INTERNAL_BLOB_DATA_H_ | 6 #define STORAGE_BROWSER_BLOB_INTERNAL_BLOB_DATA_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 protected: | 26 protected: |
| 27 friend class BlobStorageContext; | 27 friend class BlobStorageContext; |
| 28 friend class BlobStorageRegistry; | 28 friend class BlobStorageRegistry; |
| 29 friend class ViewBlobInternalsJob; | 29 friend class ViewBlobInternalsJob; |
| 30 | 30 |
| 31 // Removes the given blob uuid from the internal ShareableBlobDataItems. | 31 // Removes the given blob uuid from the internal ShareableBlobDataItems. |
| 32 // This is called when this blob is being destroyed. | 32 // This is called when this blob is being destroyed. |
| 33 void RemoveBlobFromShareableItems(const std::string& blob_uuid); | 33 void RemoveBlobFromShareableItems(const std::string& blob_uuid); |
| 34 | 34 |
| 35 const std::vector<scoped_refptr<ShareableBlobDataItem>>& items() const; | 35 const std::vector<scoped_refptr<ShareableBlobDataItem>>& items() const; |
| 36 const std::string& content_type() const; | |
| 37 const std::string& content_disposition() const; | |
| 38 | 36 |
| 39 // Gets the memory used by this blob that is not shared by other blobs. This | 37 // Gets the memory used by this blob that is not shared by other blobs. This |
| 40 // also doesn't count duplicate items. | 38 // also doesn't count duplicate items. |
| 41 size_t GetUnsharedMemoryUsage() const; | 39 size_t GetUnsharedMemoryUsage() const; |
| 42 | 40 |
| 43 // Gets the memory used by this blob. Total memory includes memory of items | 41 // Gets the memory used by this blob. Total memory includes memory of items |
| 44 // possibly shared with other blobs, or items that appear multiple times in | 42 // possibly shared with other blobs, or items that appear multiple times in |
| 45 // this blob. Unshared memory is memory used by this blob that is not shared | 43 // this blob. Unshared memory is memory used by this blob that is not shared |
| 46 // by other blobs. | 44 // by other blobs. |
| 47 void GetMemoryUsage(size_t* total_memory, size_t* unshared_memory); | 45 void GetMemoryUsage(size_t* total_memory, size_t* unshared_memory); |
| 48 | 46 |
| 49 private: | 47 private: |
| 50 friend class Builder; | 48 friend class Builder; |
| 51 InternalBlobData(); | 49 InternalBlobData(); |
| 52 | 50 |
| 53 std::string content_type_; | 51 std::string content_type_; |
| 54 std::string content_disposition_; | 52 std::string content_disposition_; |
| 55 std::vector<scoped_refptr<ShareableBlobDataItem>> items_; | 53 std::vector<scoped_refptr<ShareableBlobDataItem>> items_; |
| 56 | 54 |
| 57 class Builder { | 55 class Builder { |
| 58 public: | 56 public: |
| 59 Builder(); | 57 Builder(); |
| 60 ~Builder(); | 58 ~Builder(); |
| 61 | 59 |
| 62 void AppendSharedBlobItem(scoped_refptr<ShareableBlobDataItem> item); | 60 void AppendSharedBlobItem(scoped_refptr<ShareableBlobDataItem> item); |
| 63 void set_content_type(const std::string& content_type); | |
| 64 void set_content_disposition(const std::string& content_disposition); | |
| 65 | 61 |
| 66 // Gets the memory used by this builder that is not shared with other blobs. | 62 // Gets the memory used by this builder that is not shared with other blobs. |
| 67 size_t GetNonsharedMemoryUsage() const; | 63 size_t GetNonsharedMemoryUsage() const; |
| 68 | 64 |
| 69 // Removes the given blob uuid from the internal ShareableBlobDataItems. | 65 // Removes the given blob uuid from the internal ShareableBlobDataItems. |
| 70 // This is called on destruction of the blob if we're still building it. | 66 // This is called on destruction of the blob if we're still building it. |
| 71 void RemoveBlobFromShareableItems(const std::string& blob_uuid); | 67 void RemoveBlobFromShareableItems(const std::string& blob_uuid); |
| 72 | 68 |
| 73 // The builder is invalid after calling this method. | 69 // The builder is invalid after calling this method. |
| 74 scoped_ptr<::storage::InternalBlobData> Build(); | 70 scoped_ptr<::storage::InternalBlobData> Build(); |
| 75 | 71 |
| 76 private: | 72 private: |
| 77 scoped_ptr<::storage::InternalBlobData> data_; | 73 scoped_ptr<::storage::InternalBlobData> data_; |
| 78 | 74 |
| 79 DISALLOW_COPY_AND_ASSIGN(Builder); | 75 DISALLOW_COPY_AND_ASSIGN(Builder); |
| 80 }; | 76 }; |
| 81 | 77 |
| 82 DISALLOW_COPY_AND_ASSIGN(InternalBlobData); | 78 DISALLOW_COPY_AND_ASSIGN(InternalBlobData); |
| 83 }; | 79 }; |
| 84 | 80 |
| 85 } // namespace storage | 81 } // namespace storage |
| 86 #endif // STORAGE_BROWSER_BLOB_INTERNAL_BLOB_DATA_H_ | 82 #endif // STORAGE_BROWSER_BLOB_INTERNAL_BLOB_DATA_H_ |
| OLD | NEW |