OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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/shareable_blob_data_item.h" | 5 #include "storage/browser/blob/shareable_blob_data_item.h" |
6 | 6 |
7 #include "storage/browser/blob/blob_data_item.h" | 7 #include "storage/browser/blob/blob_data_item.h" |
8 | 8 |
9 namespace storage { | 9 namespace storage { |
| 10 namespace { |
10 | 11 |
11 ShareableBlobDataItem::ShareableBlobDataItem( | 12 uint64_t GetAndIncrementItemId() { |
12 const std::string& blob_uuid, | 13 static uint64_t sNextItemId = 0; |
13 const scoped_refptr<BlobDataItem>& item) | 14 return sNextItemId++; |
14 : item_(item) { | 15 } |
| 16 |
| 17 } // namespace |
| 18 |
| 19 ShareableBlobDataItem::ShareableBlobDataItem(scoped_refptr<BlobDataItem> item) |
| 20 : item_id_(GetAndIncrementItemId()), item_(std::move(item)) { |
15 DCHECK_NE(item_->type(), DataElement::TYPE_BLOB); | 21 DCHECK_NE(item_->type(), DataElement::TYPE_BLOB); |
16 referencing_blobs_.insert(blob_uuid); | |
17 } | 22 } |
18 | 23 |
19 ShareableBlobDataItem::~ShareableBlobDataItem() { | 24 ShareableBlobDataItem::~ShareableBlobDataItem() { |
20 } | 25 } |
21 | 26 |
22 const scoped_refptr<BlobDataItem>& ShareableBlobDataItem::item() { | 27 const scoped_refptr<BlobDataItem>& ShareableBlobDataItem::item() { |
23 return item_; | 28 return item_; |
24 } | 29 } |
25 | 30 |
26 } // namespace storage | 31 } // namespace storage |
OLD | NEW |