| Index: webkit/blob/blob_storage_controller.h
|
| ===================================================================
|
| --- webkit/blob/blob_storage_controller.h (revision 102629)
|
| +++ webkit/blob/blob_storage_controller.h (working copy)
|
| @@ -5,9 +5,13 @@
|
| #ifndef WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_
|
| #define WEBKIT_BLOB_BLOB_STORAGE_CONTROLLER_H_
|
|
|
| +#include <map>
|
| +#include <string>
|
| +
|
| #include "base/hash_tables.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/process.h"
|
| +#include "webkit/blob/blob_data.h"
|
|
|
| class GURL;
|
| class FilePath;
|
| @@ -21,15 +25,15 @@
|
|
|
| namespace webkit_blob {
|
|
|
| -class BlobData;
|
| -
|
| // This class handles the logistics of blob Storage within the browser process.
|
| class BlobStorageController {
|
| public:
|
| BlobStorageController();
|
| ~BlobStorageController();
|
|
|
| - void RegisterBlobUrl(const GURL& url, const BlobData* blob_data);
|
| + void RegisterUnfinalizedBlobUrl(const GURL& url);
|
| + void AppendBlobDataItem(const GURL& url, const BlobData::Item& data_item);
|
| + void FinalizeBlob(const GURL& url, const std::string& content_type);
|
| void RegisterBlobUrlFrom(const GURL& url, const GURL& src_url);
|
| void UnregisterBlobUrl(const GURL& url);
|
| BlobData* GetBlobDataFromUrl(const GURL& url);
|
| @@ -41,6 +45,9 @@
|
| private:
|
| friend class ViewBlobInternalsJob;
|
|
|
| + typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap;
|
| + typedef std::map<BlobData*, int> BlobDataUsageMap;
|
| +
|
| void AppendStorageItems(BlobData* target_blob_data,
|
| BlobData* src_blob_data,
|
| uint64 offset,
|
| @@ -49,9 +56,21 @@
|
| const FilePath& file_path, uint64 offset, uint64 length,
|
| const base::Time& expected_modification_time);
|
|
|
| - typedef base::hash_map<std::string, scoped_refptr<BlobData> > BlobMap;
|
| + bool RemoveFromMapHelper(BlobMap* map, const GURL& url);
|
| +
|
| + void IncrementBlobDataUsage(BlobData* blob_data);
|
| + // Returns true if no longer is use.
|
| + bool DecrementBlobDataUsage(BlobData* blob_data);
|
| +
|
| BlobMap blob_map_;
|
| + BlobMap unfinalized_blob_map_;
|
|
|
| + // Used to keep track of how much memory is being utitlized for blob data.
|
| + // Multiple urls can refer to the same blob data, the map keeps track of
|
| + // how many urls refer to a BlobData.
|
| + BlobDataUsageMap blob_data_usage_count_;
|
| + int64 memory_usage_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(BlobStorageController);
|
| };
|
|
|
|
|