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> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
10 #include "storage/browser/storage_browser_export.h" | 12 #include "storage/browser/storage_browser_export.h" |
11 #include "storage/common/data_element.h" | 13 #include "storage/common/data_element.h" |
12 | 14 |
13 namespace disk_cache { | 15 namespace disk_cache { |
14 class Entry; | 16 class Entry; |
15 } | 17 } |
16 | 18 |
17 namespace storage { | 19 namespace storage { |
(...skipping 25 matching lines...) Expand all Loading... |
43 const base::FilePath& path() const { return item_->path(); } | 45 const base::FilePath& path() const { return item_->path(); } |
44 const GURL& filesystem_url() const { return item_->filesystem_url(); } | 46 const GURL& filesystem_url() const { return item_->filesystem_url(); } |
45 const std::string& blob_uuid() const { return item_->blob_uuid(); } | 47 const std::string& blob_uuid() const { return item_->blob_uuid(); } |
46 uint64 offset() const { return item_->offset(); } | 48 uint64 offset() const { return item_->offset(); } |
47 uint64 length() const { return item_->length(); } | 49 uint64 length() const { return item_->length(); } |
48 const base::Time& expected_modification_time() const { | 50 const base::Time& expected_modification_time() const { |
49 return item_->expected_modification_time(); | 51 return item_->expected_modification_time(); |
50 } | 52 } |
51 const DataElement& data_element() const { return *item_; } | 53 const DataElement& data_element() const { return *item_; } |
52 const DataElement* data_element_ptr() const { return item_.get(); } | 54 const DataElement* data_element_ptr() const { return item_.get(); } |
| 55 DataElement* data_element_ptr() { return item_.get(); } |
53 | 56 |
54 disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; } | 57 disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; } |
55 int disk_cache_stream_index() const { return disk_cache_stream_index_; } | 58 int disk_cache_stream_index() const { return disk_cache_stream_index_; } |
56 | 59 |
57 private: | 60 private: |
58 friend class BlobDataBuilder; | 61 friend class BlobDataBuilder; |
59 friend class BlobStorageContext; | 62 friend class BlobStorageContext; |
60 friend class base::RefCounted<BlobDataItem>; | 63 friend class base::RefCounted<BlobDataItem>; |
| 64 friend STORAGE_EXPORT std::ostream& operator<<(std::ostream& os, |
| 65 const BlobDataItem& x); |
61 | 66 |
62 BlobDataItem(scoped_ptr<DataElement> item); | 67 BlobDataItem(scoped_ptr<DataElement> item); |
63 BlobDataItem(scoped_ptr<DataElement> item, | 68 BlobDataItem(scoped_ptr<DataElement> item, |
64 const scoped_refptr<DataHandle>& data_handle); | 69 const scoped_refptr<DataHandle>& data_handle); |
65 BlobDataItem(scoped_ptr<DataElement> item, | 70 BlobDataItem(scoped_ptr<DataElement> item, |
66 const scoped_refptr<DataHandle>& data_handle, | 71 const scoped_refptr<DataHandle>& data_handle, |
67 disk_cache::Entry* entry, | 72 disk_cache::Entry* entry, |
68 int disk_cache_stream_index_); | 73 int disk_cache_stream_index_); |
69 virtual ~BlobDataItem(); | 74 virtual ~BlobDataItem(); |
70 | 75 |
(...skipping 14 matching lines...) Expand all Loading... |
85 } | 90 } |
86 | 91 |
87 inline bool operator!=(const BlobDataItem& a, const BlobDataItem& b) { | 92 inline bool operator!=(const BlobDataItem& a, const BlobDataItem& b) { |
88 return !(a == b); | 93 return !(a == b); |
89 } | 94 } |
90 #endif // defined(UNIT_TEST) | 95 #endif // defined(UNIT_TEST) |
91 | 96 |
92 } // namespace storage | 97 } // namespace storage |
93 | 98 |
94 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ | 99 #endif // STORAGE_BROWSER_BLOB_BLOB_DATA_ITEM_H_ |
OLD | NEW |