Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: storage/browser/blob/shareable_blob_data_item.cc

Issue 2448353002: [BlobAsync] Moving async handling into BlobStorageContext & quota out. (Closed)
Patch Set: comments & windows/chromeos compile Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 namespace {
11 11
12 uint64_t GetAndIncrementItemId() { 12 uint64_t GetAndIncrementItemId() {
13 static uint64_t sNextItemId = 0; 13 static uint64_t sNextItemId = 0;
14 return sNextItemId++; 14 return sNextItemId++;
15 } 15 }
16 16
17 } // namespace 17 } // namespace
18 18
19 ShareableBlobDataItem::ShareableBlobDataItem( 19 ShareableBlobDataItem::ShareableBlobDataItem(
20 const std::string& referencing_blob_uuid,
21 scoped_refptr<BlobDataItem> item, 20 scoped_refptr<BlobDataItem> item,
22 ShareableBlobDataItem::State state) 21 ShareableBlobDataItem::State state)
23 : item_id_(GetAndIncrementItemId()), state_(state), item_(std::move(item)) { 22 : item_id_(GetAndIncrementItemId()), state_(state), item_(std::move(item)) {
24 DCHECK_NE(item_->type(), DataElement::TYPE_BLOB); 23 DCHECK_NE(item_->type(), DataElement::TYPE_BLOB);
25 referencing_blobs_.insert(referencing_blob_uuid);
26 } 24 }
27 25
28 ShareableBlobDataItem::~ShareableBlobDataItem() { 26 ShareableBlobDataItem::~ShareableBlobDataItem() {
29 } 27 }
30 28
31 void ShareableBlobDataItem::set_item(scoped_refptr<BlobDataItem> item) { 29 void ShareableBlobDataItem::set_item(scoped_refptr<BlobDataItem> item) {
32 item_ = std::move(item); 30 item_ = std::move(item);
33 } 31 }
34 32
35 void PrintTo(const ShareableBlobDataItem& x, ::std::ostream* os) { 33 void PrintTo(const ShareableBlobDataItem& x, ::std::ostream* os) {
(...skipping 12 matching lines...) Expand all
48 return a.item_id() == b.item_id() && *a.item() == *b.item() && 46 return a.item_id() == b.item_id() && *a.item() == *b.item() &&
49 a.referencing_blobs() == b.referencing_blobs(); 47 a.referencing_blobs() == b.referencing_blobs();
50 } 48 }
51 49
52 bool operator!=(const ShareableBlobDataItem& a, 50 bool operator!=(const ShareableBlobDataItem& a,
53 const ShareableBlobDataItem& b) { 51 const ShareableBlobDataItem& b) {
54 return !(a == b); 52 return !(a == b);
55 } 53 }
56 54
57 } // namespace storage 55 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698