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

Unified Diff: storage/browser/blob/blob_storage_context.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_storage_context.h
diff --git a/storage/browser/blob/blob_storage_context.h b/storage/browser/blob/blob_storage_context.h
index 7ccc133626505c1e8b712167dfaf76f37e399d41..d0611ada4922e2e29abfb9c912df2d89405d35f1 100644
--- a/storage/browser/blob/blob_storage_context.h
+++ b/storage/browser/blob/blob_storage_context.h
@@ -14,6 +14,7 @@
#include "storage/browser/blob/blob_data_handle.h"
#include "storage/browser/storage_browser_export.h"
#include "storage/common/blob/blob_data.h"
+#include "storage/common/data_element.h"
class GURL;
@@ -28,7 +29,7 @@ class BlobStorageHost;
namespace storage {
-class BlobDataHandle;
+class BlobDataSnapshotHandle;
// This class handles the logistics of blob Storage within the browser process,
// and maintains a mapping from blob uuid to the data. The class is single
@@ -40,12 +41,14 @@ class STORAGE_EXPORT BlobStorageContext
BlobStorageContext();
~BlobStorageContext();
- scoped_ptr<BlobDataHandle> GetBlobDataFromUUID(const std::string& uuid);
- scoped_ptr<BlobDataHandle> GetBlobDataFromPublicURL(const GURL& url);
+ scoped_ptr<BlobDataSnapshotHandle> GetBlobDataFromUUID(
michaeln 2015/01/16 00:09:09 we may want to distinguish between retaining the s
dmurph 2015/01/16 23:45:56 Sounds good, I decoupled them, so you create a sna
+ const std::string& uuid);
+ scoped_ptr<BlobDataSnapshotHandle> GetBlobDataFromPublicURL(const GURL& url);
// Useful for coining blobs from within the browser process. If the
// blob cannot be added due to memory consumption, returns NULL.
- scoped_ptr<BlobDataHandle> AddFinishedBlob(const BlobData* blob_data);
+ scoped_ptr<BlobDataSnapshotHandle> AddFinishedBlob(
+ const BlobDataBuilder& blob_data);
// Useful for coining blob urls from within the browser process.
bool RegisterPublicBlobURL(const GURL& url, const std::string& uuid);
@@ -53,7 +56,7 @@ class STORAGE_EXPORT BlobStorageContext
private:
friend class content::BlobStorageHost;
- friend class BlobDataHandle::BlobDataHandleShared;
+ friend class BlobDataSnapshotHandle::BlobDataSnapshotHandleShared;
friend class ViewBlobInternalsJob;
enum EntryFlags {
@@ -64,39 +67,42 @@ class STORAGE_EXPORT BlobStorageContext
struct BlobMapEntry {
int refcount;
int flags;
- scoped_refptr<BlobData> data;
+ scoped_ptr<BlobDataSnapshot> data;
+ scoped_ptr<BlobDataBuilder> data_builder;
BlobMapEntry();
- BlobMapEntry(int refcount, int flags, BlobData* data);
+ BlobMapEntry(int refcount, int flags, BlobDataBuilder* data);
~BlobMapEntry();
};
- typedef std::map<std::string, BlobMapEntry>
- BlobMap;
+ typedef std::map<std::string, BlobMapEntry*> BlobMap;
typedef std::map<GURL, std::string> BlobURLMap;
void StartBuildingBlob(const std::string& uuid);
void AppendBlobDataItem(const std::string& uuid,
- const BlobData::Item& data_item);
+ const DataElement& data_item);
void FinishBuildingBlob(const std::string& uuid, const std::string& type);
void CancelBuildingBlob(const std::string& uuid);
void IncrementBlobRefCount(const std::string& uuid);
void DecrementBlobRefCount(const std::string& uuid);
- bool ExpandStorageItems(BlobData* target_blob_data,
- BlobData* src_blob_data,
+ bool ExpandStorageItems(BlobDataBuilder* target_blob_data,
+ const BlobDataSnapshot& src_blob_data,
uint64 offset,
uint64 length);
- bool AppendBytesItem(BlobData* target_blob_data,
- const char* data, int64 length);
- void AppendFileItem(BlobData* target_blob_data,
+ bool AppendBytesItem(BlobDataBuilder* target_blob_data,
+ const char* data,
+ int64 length);
+ void AppendFileItem(BlobDataBuilder* target_blob_data,
const base::FilePath& file_path,
- uint64 offset, uint64 length,
+ uint64 offset,
+ uint64 length,
const base::Time& expected_modification_time);
- void AppendFileSystemFileItem(
- BlobData* target_blob_data,
- const GURL& url, uint64 offset, uint64 length,
- const base::Time& expected_modification_time);
+ void AppendFileSystemFileItem(BlobDataBuilder* target_blob_data,
+ const GURL& url,
+ uint64 offset,
+ uint64 length,
+ const base::Time& expected_modification_time);
bool IsInUse(const std::string& uuid);
bool IsBeingBuilt(const std::string& uuid);

Powered by Google App Engine
This is Rietveld 408576698