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

Unified Diff: content/browser/indexed_db/indexed_db_dispatcher_host.h

Issue 18023022: Blob support for IDB [Chromium] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small cleanup Created 7 years 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: 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..f43d6ffec6c979033921e0bfa3779df941915684 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,22 @@ 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 +71,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 +96,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 +117,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 +191,9 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter {
void OnDestroyed(int32 ipc_database_id);
void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params);
- void OnPut(const IndexedDBHostMsg_DatabasePut_Params& params);
+ 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);
};

Powered by Google App Engine
This is Rietveld 408576698