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

Unified Diff: storage/browser/blob/shareable_blob_data_item.h

Issue 2055053003: [BlobAsync] Disk support for blob storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: storage/browser/blob/shareable_blob_data_item.h
diff --git a/storage/browser/blob/shareable_blob_data_item.h b/storage/browser/blob/shareable_blob_data_item.h
index 4c2f9c1833262d18dfa82b622abdfef8585b9541..e4fd4c68839013a78898a80f08964a921f454bc0 100644
--- a/storage/browser/blob/shareable_blob_data_item.h
+++ b/storage/browser/blob/shareable_blob_data_item.h
@@ -23,22 +23,31 @@ class InternalBlobData;
// The data in this class (the item) is immutable, but the item itself can be
// swapped out with an item with the same data but a different backing (think
// RAM vs file backed).
-class ShareableBlobDataItem : public base::RefCounted<ShareableBlobDataItem> {
+class ShareableBlobDataItem
+ : public base::RefCountedThreadSafe<ShareableBlobDataItem> {
michaeln 2016/07/14 01:44:43 Why does this need to be a threadsafe refcount? If
dmurph 2016/07/15 20:18:15 We pass this to a file thread in the BlobMemoryCon
michaeln 2016/08/15 22:44:42 But if the Shareable item can be deref'd on the ba
public:
- ShareableBlobDataItem(const std::string& blob_uuid,
- const scoped_refptr<BlobDataItem>& item);
+ ShareableBlobDataItem(scoped_refptr<BlobDataItem> item);
const scoped_refptr<BlobDataItem>& item();
+ // This is a unique auto-incrementing id assigned to this item on
+ // construction. It is used to keep track of this item in an LRU data
+ // structure for eviction to disk.
+ uint64_t item_id() const { return item_id_; }
+
base::hash_set<std::string>& referencing_blobs() {
return referencing_blobs_;
}
private:
- friend class base::RefCounted<ShareableBlobDataItem>;
+ friend class base::RefCountedThreadSafe<ShareableBlobDataItem>;
friend class InternalBlobData;
+ friend class BlobMemoryController;
+ friend class BlobStorageContext;
~ShareableBlobDataItem();
+ // This is a unique identifier for this ShareableBlobDataItem.
+ uint64_t item_id_;
scoped_refptr<BlobDataItem> item_;
base::hash_set<std::string> referencing_blobs_;

Powered by Google App Engine
This is Rietveld 408576698