| Index: content/browser/indexed_db/indexed_db_dispatcher_host.h
|
| diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.h b/content/browser/indexed_db/indexed_db_dispatcher_host.h
|
| index bcbbfba029b1c2bf7b15fad8d61f6f9de1c58cb5..2f8e78d33df150c3d155fb47964f9b05d2ec4392 100644
|
| --- a/content/browser/indexed_db/indexed_db_dispatcher_host.h
|
| +++ b/content/browser/indexed_db/indexed_db_dispatcher_host.h
|
| @@ -11,8 +11,11 @@
|
| #include "base/basictypes.h"
|
| #include "base/id_map.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "content/browser/fileapi/chrome_blob_storage_context.h"
|
| #include "content/public/browser/browser_message_filter.h"
|
| +#include "net/url_request/url_request_context_getter.h"
|
| #include "url/gurl.h"
|
| +#include "webkit/browser/blob/blob_data_handle.h"
|
|
|
| struct IndexedDBDatabaseMetadata;
|
| struct IndexedDBHostMsg_DatabaseCount_Params;
|
| @@ -41,12 +44,20 @@ struct IndexedDBDatabaseMetadata;
|
| class IndexedDBDispatcherHost : public BrowserMessageFilter {
|
| public:
|
| // Only call the constructor from the UI thread.
|
| - explicit IndexedDBDispatcherHost(IndexedDBContextImpl* indexed_db_context);
|
| + IndexedDBDispatcherHost(int ipc_process_id,
|
| + net::URLRequestContextGetter* request_context_getter,
|
| + IndexedDBContextImpl* indexed_db_context,
|
| + ChromeBlobStorageContext* blob_storage_context);
|
| + IndexedDBDispatcherHost(int ipc_process_id,
|
| + net::URLRequestContext* request_context,
|
| + IndexedDBContextImpl* indexed_db_context,
|
| + ChromeBlobStorageContext* blob_storage_context);
|
|
|
| static ::IndexedDBDatabaseMetadata ConvertMetadata(
|
| const content::IndexedDBDatabaseMetadata& metadata);
|
|
|
| // BrowserMessageFilter implementation.
|
| + virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
|
| virtual void OnChannelClosing() OVERRIDE;
|
| virtual void OnDestruct() const OVERRIDE;
|
| virtual base::TaskRunner* OverrideTaskRunnerForMessage(
|
| @@ -58,6 +69,9 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
|
|
|
| // A shortcut for accessing our context.
|
| IndexedDBContextImpl* Context() { return indexed_db_context_; }
|
| + webkit_blob::BlobStorageContext* blob_storage_context() {
|
| + return blob_storage_context_->context();
|
| + }
|
|
|
| // IndexedDBCallbacks call these methods to add the results into the
|
| // applicable map. See below for more details.
|
| @@ -80,6 +94,11 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
|
| static uint32 TransactionIdToRendererTransactionId(int64 host_transaction_id);
|
| static uint32 TransactionIdToProcessId(int64 host_transaction_id);
|
|
|
| + void HoldBlobDataHandle(
|
| + const std::string& uuid,
|
| + scoped_ptr<webkit_blob::BlobDataHandle>& blob_data_handle);
|
| + void DropBlobDataHandle(const std::string& uuid);
|
| +
|
| private:
|
| // Friends to enable OnDestruct() delegation.
|
| friend class BrowserThread;
|
| @@ -96,6 +115,10 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
|
| void OnIDBFactoryDeleteDatabase(
|
| const IndexedDBHostMsg_FactoryDeleteDatabase_Params& p);
|
|
|
| + void OnAckReceivedBlobs(const std::vector<std::string>& uuids);
|
| + void OnPutHelper(const IndexedDBHostMsg_DatabasePut_Params& params,
|
| + std::vector<webkit_blob::BlobDataHandle*> handles);
|
| +
|
| void ResetDispatcherHosts();
|
|
|
| // IDMap for RefCounted types
|
| @@ -166,7 +189,11 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
|
| void OnDestroyed(int32 ipc_database_id);
|
|
|
| void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params);
|
| - void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params);
|
| + // OnPutWrapper starts on the IO thread so that it can grab BlobDataHandles
|
| + // before posting to the IDB TaskRunner for the rest of the job.
|
| + void OnPutWrapper(const IndexedDBHostMsg_DatabasePut_Params& params);
|
| + void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params,
|
| + std::vector<webkit_blob::BlobDataHandle*> handles);
|
| void OnSetIndexKeys(
|
| const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params);
|
| void OnSetIndexesReady(int32 ipc_database_id,
|
| @@ -228,12 +255,23 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
|
| RefIDMap<IndexedDBCursor> map_;
|
| };
|
|
|
| + // The getter holds the context until OnChannelConnected() can be called from
|
| + // the IO thread, which will extract the net::URLRequestContext from it.
|
| + scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
| + net::URLRequestContext* request_context_;
|
| scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
|
| + scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
|
| +
|
| + typedef std::map<std::string, webkit_blob::BlobDataHandle*> BlobDataHandleMap;
|
| + BlobDataHandleMap blob_data_handle_map_;
|
|
|
| // Only access on IndexedDB thread.
|
| scoped_ptr<DatabaseDispatcherHost> database_dispatcher_host_;
|
| scoped_ptr<CursorDispatcherHost> cursor_dispatcher_host_;
|
|
|
| + // Used to set file permissions for blob storage.
|
| + int ipc_process_id_;
|
| +
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBDispatcherHost);
|
| };
|
|
|
|
|