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 #include <string> |
| 10 |
8 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
10 #include "storage/browser/storage_browser_export.h" | 13 #include "storage/browser/storage_browser_export.h" |
11 #include "storage/common/data_element.h" | 14 #include "storage/common/data_element.h" |
12 | 15 |
13 namespace disk_cache { | 16 namespace disk_cache { |
14 class Entry; | 17 class Entry; |
15 } | 18 } |
16 | 19 |
17 namespace storage { | 20 namespace storage { |
(...skipping 25 matching lines...) Expand all Loading... |
43 const base::FilePath& path() const { return item_->path(); } | 46 const base::FilePath& path() const { return item_->path(); } |
44 const GURL& filesystem_url() const { return item_->filesystem_url(); } | 47 const GURL& filesystem_url() const { return item_->filesystem_url(); } |
45 const std::string& blob_uuid() const { return item_->blob_uuid(); } | 48 const std::string& blob_uuid() const { return item_->blob_uuid(); } |
46 uint64 offset() const { return item_->offset(); } | 49 uint64 offset() const { return item_->offset(); } |
47 uint64 length() const { return item_->length(); } | 50 uint64 length() const { return item_->length(); } |
48 const base::Time& expected_modification_time() const { | 51 const base::Time& expected_modification_time() const { |
49 return item_->expected_modification_time(); | 52 return item_->expected_modification_time(); |
50 } | 53 } |
51 const DataElement& data_element() const { return *item_; } | 54 const DataElement& data_element() const { return *item_; } |
52 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(); } |
53 | 57 |
54 disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; } | 58 disk_cache::Entry* disk_cache_entry() const { return disk_cache_entry_; } |
55 int disk_cache_stream_index() const { return disk_cache_stream_index_; } | 59 int disk_cache_stream_index() const { return disk_cache_stream_index_; } |
56 | 60 |
57 private: | 61 private: |
58 friend class BlobDataBuilder; | 62 friend class BlobDataBuilder; |
59 friend class BlobStorageContext; | 63 friend class BlobStorageContext; |
60 friend class base::RefCounted<BlobDataItem>; | 64 friend class base::RefCounted<BlobDataItem>; |
| 65 friend STORAGE_EXPORT void PrintTo(const BlobDataItem& x, ::std::ostream* os); |
61 | 66 |
62 BlobDataItem(scoped_ptr<DataElement> item); | 67 explicit 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 |
71 scoped_ptr<DataElement> item_; | 76 scoped_ptr<DataElement> item_; |
72 scoped_refptr<DataHandle> data_handle_; | 77 scoped_refptr<DataHandle> data_handle_; |
(...skipping 12 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 |