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 #include "storage/browser/blob/blob_data_item.h" | 5 #include "storage/browser/blob/blob_data_item.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 namespace storage { | 9 namespace storage { |
8 | 10 |
9 BlobDataItem::DataHandle::~DataHandle() { | 11 BlobDataItem::DataHandle::~DataHandle() { |
10 } | 12 } |
11 | 13 |
12 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item) | 14 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item) |
13 : item_(item.Pass()), | 15 : item_(std::move(item)), |
14 disk_cache_entry_(nullptr), | 16 disk_cache_entry_(nullptr), |
15 disk_cache_stream_index_(-1) { | 17 disk_cache_stream_index_(-1) {} |
16 } | |
17 | 18 |
18 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item, | 19 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item, |
19 const scoped_refptr<DataHandle>& data_handle) | 20 const scoped_refptr<DataHandle>& data_handle) |
20 : item_(item.Pass()), | 21 : item_(std::move(item)), |
21 data_handle_(data_handle), | 22 data_handle_(data_handle), |
22 disk_cache_entry_(nullptr), | 23 disk_cache_entry_(nullptr), |
23 disk_cache_stream_index_(-1) { | 24 disk_cache_stream_index_(-1) {} |
24 } | |
25 | 25 |
26 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item, | 26 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item, |
27 const scoped_refptr<DataHandle>& data_handle, | 27 const scoped_refptr<DataHandle>& data_handle, |
28 disk_cache::Entry* entry, | 28 disk_cache::Entry* entry, |
29 int disk_cache_stream_index) | 29 int disk_cache_stream_index) |
30 : item_(item.Pass()), | 30 : item_(std::move(item)), |
31 data_handle_(data_handle), | 31 data_handle_(data_handle), |
32 disk_cache_entry_(entry), | 32 disk_cache_entry_(entry), |
33 disk_cache_stream_index_(disk_cache_stream_index) { | 33 disk_cache_stream_index_(disk_cache_stream_index) {} |
34 } | |
35 | 34 |
36 BlobDataItem::~BlobDataItem() {} | 35 BlobDataItem::~BlobDataItem() {} |
37 | 36 |
38 void PrintTo(const BlobDataItem& x, ::std::ostream* os) { | 37 void PrintTo(const BlobDataItem& x, ::std::ostream* os) { |
39 DCHECK(os); | 38 DCHECK(os); |
40 *os << "<BlobDataItem>{item: "; | 39 *os << "<BlobDataItem>{item: "; |
41 PrintTo(*x.item_, os); | 40 PrintTo(*x.item_, os); |
42 *os << ", has_data_handle: " << (x.data_handle_.get() ? "true" : "false") | 41 *os << ", has_data_handle: " << (x.data_handle_.get() ? "true" : "false") |
43 << ", disk_cache_entry_ptr: " << x.disk_cache_entry_ | 42 << ", disk_cache_entry_ptr: " << x.disk_cache_entry_ |
44 << ", disk_cache_stream_index_: " << x.disk_cache_stream_index_ << "}"; | 43 << ", disk_cache_stream_index_: " << x.disk_cache_stream_index_ << "}"; |
45 } | 44 } |
46 | 45 |
47 bool operator==(const BlobDataItem& a, const BlobDataItem& b) { | 46 bool operator==(const BlobDataItem& a, const BlobDataItem& b) { |
48 return a.disk_cache_entry() == b.disk_cache_entry() && | 47 return a.disk_cache_entry() == b.disk_cache_entry() && |
49 a.disk_cache_stream_index() == b.disk_cache_stream_index() && | 48 a.disk_cache_stream_index() == b.disk_cache_stream_index() && |
50 a.data_element() == b.data_element(); | 49 a.data_element() == b.data_element(); |
51 } | 50 } |
52 | 51 |
53 bool operator!=(const BlobDataItem& a, const BlobDataItem& b) { | 52 bool operator!=(const BlobDataItem& a, const BlobDataItem& b) { |
54 return !(a == b); | 53 return !(a == b); |
55 } | 54 } |
56 | 55 |
57 } // namespace storage | 56 } // namespace storage |
OLD | NEW |