OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_DATA_SNAPSHOT_H_ |
| 6 #define STORAGE_BROWSER_BLOB_BLOB_DATA_SNAPSHOT_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/supports_user_data.h" |
| 13 #include "storage/browser/blob/blob_data_item.h" |
| 14 #include "storage/browser/storage_browser_export.h" |
| 15 |
| 16 namespace storage { |
| 17 class BlobDataBuilder; |
| 18 |
| 19 // Snapshot of a Blob. This snapshot holds a refcount of the current |
| 20 // blob item resources so the backing storage for these items will stick |
| 21 // around for the lifetime of this object. (The data represented by a blob is |
| 22 // immutable, but the backing store can change). Keeping this object alive |
| 23 // guarantees that the resources stay alive, but it does not guarentee that |
| 24 // the blob stays alive. Use the BlobDataHandle to keep a blob alive. |
| 25 // This class must be deleted on the IO thread. |
| 26 class STORAGE_EXPORT BlobDataSnapshot : public base::SupportsUserData::Data { |
| 27 public: |
| 28 BlobDataSnapshot(const BlobDataSnapshot& other); |
| 29 ~BlobDataSnapshot() override; |
| 30 |
| 31 const std::vector<scoped_refptr<BlobDataItem>>& items() const { |
| 32 return items_; |
| 33 } |
| 34 const std::string& content_type() const { return content_type_; } |
| 35 const std::string& content_disposition() const { |
| 36 return content_disposition_; |
| 37 } |
| 38 size_t GetMemoryUsage() const; |
| 39 |
| 40 private: |
| 41 friend class BlobDataBuilder; |
| 42 BlobDataSnapshot(const std::string& uuid, |
| 43 const std::string& content_type, |
| 44 const std::string& content_disposition, |
| 45 const std::vector<scoped_refptr<BlobDataItem>>& items); |
| 46 |
| 47 const std::string uuid_; |
| 48 const std::string content_type_; |
| 49 const std::string content_disposition_; |
| 50 const std::vector<scoped_refptr<BlobDataItem>> items_; |
| 51 }; |
| 52 |
| 53 } // namespace storage |
| 54 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_SNAPSHOT_H_ |
OLD | NEW |