| 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 <ostream> | 8 #include <ostream> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const DataElement* data_element_ptr() const { return item_.get(); } | 55 const DataElement* data_element_ptr() const { return item_.get(); } |
| 56 DataElement* data_element_ptr() { return item_.get(); } | 56 DataElement* data_element_ptr() { return item_.get(); } |
| 57 | 57 |
| 58 disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; } | 58 disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; } |
| 59 int disk_cache_stream_index() const { return disk_cache_stream_index_; } | 59 int disk_cache_stream_index() const { return disk_cache_stream_index_; } |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 friend class BlobDataBuilder; | 62 friend class BlobDataBuilder; |
| 63 friend class BlobStorageContext; | 63 friend class BlobStorageContext; |
| 64 friend class base::RefCounted<BlobDataItem>; | 64 friend class base::RefCounted<BlobDataItem>; |
| 65 friend class BlobMemoryController; |
| 65 friend STORAGE_EXPORT void PrintTo(const BlobDataItem& x, ::std::ostream* os); | 66 friend STORAGE_EXPORT void PrintTo(const BlobDataItem& x, ::std::ostream* os); |
| 66 | 67 |
| 67 explicit BlobDataItem(scoped_ptr<DataElement> item); | 68 explicit BlobDataItem(scoped_ptr<DataElement> item); |
| 68 BlobDataItem(scoped_ptr<DataElement> item, | 69 BlobDataItem(scoped_ptr<DataElement> item, |
| 69 const scoped_refptr<DataHandle>& data_handle); | 70 const scoped_refptr<DataHandle>& data_handle); |
| 70 BlobDataItem(scoped_ptr<DataElement> item, | 71 BlobDataItem(scoped_ptr<DataElement> item, |
| 71 const scoped_refptr<DataHandle>& data_handle, | 72 const scoped_refptr<DataHandle>& data_handle, |
| 72 disk_cache::Entry* entry, | 73 disk_cache::Entry* entry, |
| 73 int disk_cache_stream_index_); | 74 int disk_cache_stream_index_); |
| 74 virtual ~BlobDataItem(); | 75 virtual ~BlobDataItem(); |
| 75 | 76 |
| 76 scoped_ptr<DataElement> item_; | 77 scoped_ptr<DataElement> item_; |
| 77 scoped_refptr<DataHandle> data_handle_; | 78 scoped_refptr<DataHandle> data_handle_; |
| 78 | 79 |
| 79 // This naked pointer is safe because the scope is protected by the DataHandle | 80 // This naked pointer is safe because the scope is protected by the DataHandle |
| 80 // instance for disk cache entries during the lifetime of this BlobDataItem. | 81 // instance for disk cache entries during the lifetime of this BlobDataItem. |
| 81 disk_cache::Entry* disk_cache_entry_; | 82 disk_cache::Entry* disk_cache_entry_; |
| 82 int disk_cache_stream_index_; // For TYPE_DISK_CACHE_ENTRY. | 83 int disk_cache_stream_index_; // For TYPE_DISK_CACHE_ENTRY. |
| 84 |
| 85 // This is a temporary file from the Blob system, and we need to call |
| 86 // DecrementTempFileRefCount on the BlobMemoryController when this item |
| 87 // is destructed. |
| 88 bool temp_file_; |
| 83 }; | 89 }; |
| 84 | 90 |
| 85 STORAGE_EXPORT bool operator==(const BlobDataItem& a, const BlobDataItem& b); | 91 STORAGE_EXPORT bool operator==(const BlobDataItem& a, const BlobDataItem& b); |
| 86 STORAGE_EXPORT bool operator!=(const BlobDataItem& a, const BlobDataItem& b); | 92 STORAGE_EXPORT bool operator!=(const BlobDataItem& a, const BlobDataItem& b); |
| 87 | 93 |
| 88 } // namespace storage | 94 } // namespace storage |
| 89 | 95 |
| 90 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ | 96 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ |
| OLD | NEW |