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

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

Issue 2339933004: [BlobStorage] BlobMemoryController & tests (Closed)
Patch Set: Comments, and made task base class for hopefully more simplicity Created 4 years, 3 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/blob_data_item.h
diff --git a/storage/browser/blob/blob_data_item.h b/storage/browser/blob/blob_data_item.h
index a711a4caf3b3fe4bc969be9e63c87bb33aa79834..0316d871eac32c7ac159d1d56d91b181cad81e81 100644
--- a/storage/browser/blob/blob_data_item.h
+++ b/storage/browser/blob/blob_data_item.h
@@ -28,7 +28,8 @@ class BlobStorageContext;
// this class is to allow the resource to stick around in the snapshot even
// after the resource was swapped in the blob (either to disk or to memory) by
// the BlobStorageContext.
-class STORAGE_EXPORT BlobDataItem : public base::RefCounted<BlobDataItem> {
+class STORAGE_EXPORT BlobDataItem
+ : public base::RefCountedThreadSafe<BlobDataItem> {
michaeln 2016/09/27 00:09:29 see comment elsewhere about thread-safe-refcounts
dmurph 2016/09/29 00:44:20 Yes, you're right, I can remove this.
public:
// The DataHandle class is used to persist resources that are needed for
// reading this BlobDataItem. This object will stay around while any reads are
@@ -43,6 +44,15 @@ class STORAGE_EXPORT BlobDataItem : public base::RefCounted<BlobDataItem> {
friend class base::RefCounted<DataHandle>;
};
+ explicit BlobDataItem(std::unique_ptr<DataElement> item);
+ BlobDataItem(std::unique_ptr<DataElement> item,
+ const scoped_refptr<DataHandle>& data_handle);
+ BlobDataItem(std::unique_ptr<DataElement> item,
+ const scoped_refptr<DataHandle>& data_handle,
+ disk_cache::Entry* entry,
+ int disk_cache_stream_index,
+ int disk_cache_side_stream_index);
+
DataElement::Type type() const { return item_->type(); }
const char* bytes() const { return item_->bytes(); }
const base::FilePath& path() const { return item_->path(); }
@@ -63,20 +73,14 @@ class STORAGE_EXPORT BlobDataItem : public base::RefCounted<BlobDataItem> {
return disk_cache_side_stream_index_;
}
+ const scoped_refptr<DataHandle>& data_handle() const { return data_handle_; }
+
private:
friend class BlobDataBuilder;
friend class BlobStorageContext;
- friend class base::RefCounted<BlobDataItem>;
+ friend class base::RefCountedThreadSafe<BlobDataItem>;
friend STORAGE_EXPORT void PrintTo(const BlobDataItem& x, ::std::ostream* os);
- explicit BlobDataItem(std::unique_ptr<DataElement> item);
- BlobDataItem(std::unique_ptr<DataElement> item,
- const scoped_refptr<DataHandle>& data_handle);
- BlobDataItem(std::unique_ptr<DataElement> item,
- const scoped_refptr<DataHandle>& data_handle,
- disk_cache::Entry* entry,
- int disk_cache_stream_index,
- int disk_cache_side_stream_index);
virtual ~BlobDataItem();
std::unique_ptr<DataElement> item_;

Powered by Google App Engine
This is Rietveld 408576698