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

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

Issue 810403004: [Storage] Blob Storage Refactoring pt 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: memory leak fixed Created 5 years, 11 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_handle.h
diff --git a/storage/browser/blob/blob_data_handle.h b/storage/browser/blob/blob_data_handle.h
index 0b1d151c612e078ae6a91c3c052657a4f7d08e6a..47e42984f8df79d4504d1d2449b49a7119589be6 100644
--- a/storage/browser/blob/blob_data_handle.h
+++ b/storage/browser/blob/blob_data_handle.h
@@ -18,52 +18,56 @@ class SequencedTaskRunner;
namespace storage {
-class BlobData;
+class BlobDataSnapshot;
class BlobStorageContext;
// A scoper object for use in chrome's main browser process, ensures
// the underlying BlobData and its uuid remain in BlobStorageContext's
// collection for the duration. This object has delete semantics and
-// maybe deleted on any thread.
-class STORAGE_EXPORT BlobDataHandle
+// may be deleted on any thread.
+class STORAGE_EXPORT BlobDataSnapshotHandle
: public base::SupportsUserData::Data {
public:
- BlobDataHandle(const BlobDataHandle& other); // May be copied on any thread.
- ~BlobDataHandle() override; // Maybe be deleted on any thread.
- BlobData* data() const; // May only be accessed on the IO thread.
+ BlobDataSnapshotHandle(
+ const BlobDataSnapshotHandle& other); // May be copied on any thread.
+ ~BlobDataSnapshotHandle() override; // May be deleted on any thread.
+ const BlobDataSnapshot* data() const; // May be accessed on any thread.
- std::string uuid() const; // May be accessed on any thread.
+ const std::string& uuid() const; // May be accessed on any thread.
private:
- class BlobDataHandleShared
- : public base::RefCountedThreadSafe<BlobDataHandleShared> {
+ // Internal class whose destructor is guarenteed to be called on the IO
+ // thread.
+ class BlobDataSnapshotHandleShared
+ : public base::RefCountedThreadSafe<BlobDataSnapshotHandleShared> {
public:
- BlobDataHandleShared(BlobData* blob_data,
- BlobStorageContext* context,
- base::SequencedTaskRunner* task_runner);
+ BlobDataSnapshotHandleShared(BlobDataSnapshot* blob_data,
+ BlobStorageContext* context,
+ base::SequencedTaskRunner* task_runner);
- BlobData* data() const;
+ BlobDataSnapshot* data() const;
const std::string& uuid() const;
private:
- friend class base::DeleteHelper<BlobDataHandleShared>;
- friend class base::RefCountedThreadSafe<BlobDataHandleShared>;
- friend class BlobDataHandle;
+ friend class base::DeleteHelper<BlobDataSnapshotHandleShared>;
+ friend class base::RefCountedThreadSafe<BlobDataSnapshotHandleShared>;
+ friend class BlobDataSnapshotHandle;
- virtual ~BlobDataHandleShared();
+ virtual ~BlobDataSnapshotHandleShared();
- scoped_refptr<BlobData> blob_data_;
+ scoped_ptr<BlobDataSnapshot> blob_data_;
base::WeakPtr<BlobStorageContext> context_;
- DISALLOW_COPY_AND_ASSIGN(BlobDataHandleShared);
+ DISALLOW_COPY_AND_ASSIGN(BlobDataSnapshotHandleShared);
};
friend class BlobStorageContext;
- BlobDataHandle(BlobData* blob_data, BlobStorageContext* context,
- base::SequencedTaskRunner* task_runner);
+ BlobDataSnapshotHandle(BlobDataSnapshot* blob_data,
+ BlobStorageContext* context,
+ base::SequencedTaskRunner* task_runner);
scoped_refptr<base::SequencedTaskRunner> io_task_runner_;
- scoped_refptr<BlobDataHandleShared> shared_;
+ scoped_refptr<BlobDataSnapshotHandleShared> shared_;
};
} // namespace storage

Powered by Google App Engine
This is Rietveld 408576698