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

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

Issue 895933007: [Storage] Blob items are now shared between blobs. Ready for disk swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Documentation fix Created 5 years, 10 months 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
(Empty)
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
Alexei Svitkine (slow) 2015/02/10 16:05:06 Nit: No (c) for new copyright messages - fix all t
dmurph 2015/02/10 22:17:47 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef STORAGE_BROWSER_BLOB_SHAREABLE_BLOB_DATA_ITEM_H_
6 #define STORAGE_BROWSER_BLOB_SHAREABLE_BLOB_DATA_ITEM_H_
7
8 #include "base/containers/hash_tables.h"
9 #include "base/hash.h"
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "storage/common/data_element.h"
13
14 namespace storage {
Alexei Svitkine (slow) 2015/02/10 16:05:06 Nit: Add an empty line below this.
dmurph 2015/02/10 22:17:47 Done.
15 class BlobDataItem;
16
17 // This class allows blob items to be shared between blobs, and is only used by
18 // BlobStorageContext. This class contains both the blob data item and the uuids
19 // of all the blobs using this item.
20 // The data in this class (the item) is immutable, but the item itself can be
21 // swapped out with an item with the same data but a different backing (think
22 // RAM vs file backed).
23 class ShareableBlobDataItem : public base::RefCounted<ShareableBlobDataItem> {
24 public:
25 ShareableBlobDataItem(const std::string& blob_uuid,
26 const scoped_refptr<BlobDataItem>& item);
27
28 const scoped_refptr<BlobDataItem>& item();
29
30 base::hash_set<std::string>& referencing_blobs() {
31 return referencing_blobs_;
32 }
33
34 private:
35 friend class base::RefCounted<ShareableBlobDataItem>;
36 ~ShareableBlobDataItem();
Alexei Svitkine (slow) 2015/02/10 16:05:05 Nit: Add an empty line below this.
dmurph 2015/02/10 22:17:47 Done.
37 scoped_refptr<BlobDataItem> item_;
38
39 base::hash_set<std::string> referencing_blobs_;
40
41 DISALLOW_COPY_AND_ASSIGN(ShareableBlobDataItem);
42 };
43 } // namespace storage
Alexei Svitkine (slow) 2015/02/10 16:05:06 Nit: Add an empty line above.
dmurph 2015/02/10 22:17:47 Done.
44 #endif // STORAGE_BROWSER_BLOB_SHAREABLE_BLOB_DATA_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698