OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_BLOB_DATA_ITEM_H_ | 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ |
6 #define STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ | 6 #define STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 DataElement* data_element_ptr() { return item_.get(); } | 58 DataElement* data_element_ptr() { return item_.get(); } |
59 | 59 |
60 disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; } | 60 disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; } |
61 int disk_cache_stream_index() const { return disk_cache_stream_index_; } | 61 int disk_cache_stream_index() const { return disk_cache_stream_index_; } |
62 int disk_cache_side_stream_index() const { | 62 int disk_cache_side_stream_index() const { |
63 return disk_cache_side_stream_index_; | 63 return disk_cache_side_stream_index_; |
64 } | 64 } |
65 | 65 |
66 private: | 66 private: |
67 friend class BlobDataBuilder; | 67 friend class BlobDataBuilder; |
| 68 friend class BlobMemoryController; |
68 friend class BlobStorageContext; | 69 friend class BlobStorageContext; |
| 70 friend class BlobSlice; |
69 friend class base::RefCounted<BlobDataItem>; | 71 friend class base::RefCounted<BlobDataItem>; |
70 friend STORAGE_EXPORT void PrintTo(const BlobDataItem& x, ::std::ostream* os); | 72 friend STORAGE_EXPORT void PrintTo(const BlobDataItem& x, ::std::ostream* os); |
71 | 73 |
72 explicit BlobDataItem(std::unique_ptr<DataElement> item); | 74 explicit BlobDataItem(std::unique_ptr<DataElement> item); |
73 BlobDataItem(std::unique_ptr<DataElement> item, | 75 BlobDataItem(std::unique_ptr<DataElement> item, |
74 const scoped_refptr<DataHandle>& data_handle); | 76 const scoped_refptr<DataHandle>& data_handle); |
75 BlobDataItem(std::unique_ptr<DataElement> item, | 77 BlobDataItem(std::unique_ptr<DataElement> item, |
76 const scoped_refptr<DataHandle>& data_handle, | 78 const scoped_refptr<DataHandle>& data_handle, |
77 disk_cache::Entry* entry, | 79 disk_cache::Entry* entry, |
78 int disk_cache_stream_index, | 80 int disk_cache_stream_index, |
79 int disk_cache_side_stream_index); | 81 int disk_cache_side_stream_index); |
80 virtual ~BlobDataItem(); | 82 virtual ~BlobDataItem(); |
81 | 83 |
82 std::unique_ptr<DataElement> item_; | 84 std::unique_ptr<DataElement> item_; |
83 scoped_refptr<DataHandle> data_handle_; | 85 scoped_refptr<DataHandle> data_handle_; |
84 | 86 |
85 // This naked pointer is safe because the scope is protected by the DataHandle | 87 // This naked pointer is safe because the scope is protected by the DataHandle |
86 // instance for disk cache entries during the lifetime of this BlobDataItem. | 88 // instance for disk cache entries during the lifetime of this BlobDataItem. |
87 disk_cache::Entry* disk_cache_entry_; | 89 disk_cache::Entry* disk_cache_entry_; |
88 int disk_cache_stream_index_; // For TYPE_DISK_CACHE_ENTRY. | 90 int disk_cache_stream_index_; // For TYPE_DISK_CACHE_ENTRY. |
89 int disk_cache_side_stream_index_; // For TYPE_DISK_CACHE_ENTRY. | 91 int disk_cache_side_stream_index_; // For TYPE_DISK_CACHE_ENTRY. |
90 }; | 92 }; |
91 | 93 |
92 STORAGE_EXPORT bool operator==(const BlobDataItem& a, const BlobDataItem& b); | 94 STORAGE_EXPORT bool operator==(const BlobDataItem& a, const BlobDataItem& b); |
93 STORAGE_EXPORT bool operator!=(const BlobDataItem& a, const BlobDataItem& b); | 95 STORAGE_EXPORT bool operator!=(const BlobDataItem& a, const BlobDataItem& b); |
94 | 96 |
95 } // namespace storage | 97 } // namespace storage |
96 | 98 |
97 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ | 99 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ |
OLD | NEW |