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

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

Issue 2449953008: Port messages sent by WebIDBDatabaseImpl to Mojo. (Closed)
Patch Set: Address more comments from dcheng@. Created 4 years, 1 month 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 5a77838ad928238be4d754ebf61e5715fe54d7aa..e5d7b8d983a2ce09be18c0a14a2a83ceb5e43534 100644
--- a/content/browser/indexed_db/indexed_db_dispatcher_host.h
+++ b/content/browser/indexed_db/indexed_db_dispatcher_host.h
@@ -16,29 +16,15 @@
#include "base/id_map.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
#include "content/browser/blob_storage/chrome_blob_storage_context.h"
#include "content/common/indexed_db/indexed_db.mojom.h"
#include "content/public/browser/browser_associated_interface.h"
#include "content/public/browser/browser_message_filter.h"
#include "net/url_request/url_request_context_getter.h"
#include "storage/browser/blob/blob_data_handle.h"
-#include "storage/browser/quota/quota_manager.h"
-#include "storage/common/quota/quota_status_code.h"
#include "url/gurl.h"
-struct IndexedDBDatabaseMetadata;
-struct IndexedDBHostMsg_DatabaseCount_Params;
-struct IndexedDBHostMsg_DatabaseCreateIndex_Params;
-struct IndexedDBHostMsg_DatabaseCreateObjectStore_Params;
-struct IndexedDBHostMsg_DatabaseCreateTransaction_Params;
-struct IndexedDBHostMsg_DatabaseDeleteRange_Params;
-struct IndexedDBHostMsg_DatabaseGet_Params;
-struct IndexedDBHostMsg_DatabaseGetAll_Params;
struct IndexedDBHostMsg_DatabaseObserve_Params;
-struct IndexedDBHostMsg_DatabaseOpenCursor_Params;
-struct IndexedDBHostMsg_DatabasePut_Params;
-struct IndexedDBHostMsg_DatabaseSetIndexKeys_Params;
struct IndexedDBMsg_Observation;
struct IndexedDBMsg_ObserverChanges;
@@ -56,7 +42,6 @@ class IndexedDBDatabaseCallbacks;
class IndexedDBKey;
class IndexedDBObservation;
class IndexedDBObserverChanges;
-struct IndexedDBDatabaseMetadata;
// Handles all IndexedDB related messages from a particular renderer process.
class IndexedDBDispatcherHost
@@ -89,15 +74,17 @@ class IndexedDBDispatcherHost
storage::BlobStorageContext* blob_storage_context() const {
return blob_storage_context_->context();
}
+ int ipc_process_id() const { return ipc_process_id_; }
// IndexedDBCallbacks call these methods to add the results into the
// applicable map. See below for more details.
int32_t Add(IndexedDBCursor* cursor);
- int32_t Add(IndexedDBConnection* connection,
- const url::Origin& origin);
- void RegisterTransactionId(int64_t host_transaction_id,
+ bool RegisterTransactionId(int64_t host_transaction_id,
const url::Origin& origin);
+ bool GetTransactionSize(int64_t host_transaction_id,
+ int64_t* transaction_size);
+ void AddToTransaction(int64_t host_transaction_id, int64_t value_length);
IndexedDBCursor* GetCursorFromId(int32_t ipc_cursor_id);
@@ -113,6 +100,7 @@ class IndexedDBDispatcherHost
static uint32_t TransactionIdToProcessId(int64_t host_transaction_id);
std::string HoldBlobData(const IndexedDBBlobInfo& blob_info);
+ void DropBlobData(const std::string& uuid);
// True if the channel is closing/closed and outstanding requests
// can be abandoned. Only access on IndexedDB thread.
@@ -125,9 +113,8 @@ class IndexedDBDispatcherHost
// Used in nested classes.
typedef std::map<int64_t, int64_t> TransactionIDToDatabaseIDMap;
- typedef std::map<int64_t, uint64_t> TransactionIDToSizeMap;
+ typedef std::map<int64_t, int64_t> TransactionIDToSizeMap;
typedef std::map<int64_t, url::Origin> TransactionIDToOriginMap;
- typedef std::map<int32_t, url::Origin> WebIDBObjectIDToOriginMap;
// IDMap for RefCounted types
template <typename RefCountedType>
@@ -161,90 +148,6 @@ class IndexedDBDispatcherHost
DISALLOW_COPY_AND_ASSIGN(RefIDMap);
};
- class DatabaseDispatcherHost {
- public:
- explicit DatabaseDispatcherHost(IndexedDBDispatcherHost* parent);
- ~DatabaseDispatcherHost();
-
- void CloseAll();
- bool OnMessageReceived(const IPC::Message& message);
-
- void OnCreateObjectStore(
- const IndexedDBHostMsg_DatabaseCreateObjectStore_Params& params);
- void OnDeleteObjectStore(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id);
- void OnRenameObjectStore(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- const base::string16& new_name);
- void OnCreateTransaction(
- const IndexedDBHostMsg_DatabaseCreateTransaction_Params&);
- void OnClose(int32_t ipc_database_id);
- void OnVersionChangeIgnored(int32_t ipc_database_id);
- void OnDestroyed(int32_t ipc_database_id);
-
- void OnObserve(const IndexedDBHostMsg_DatabaseObserve_Params&);
- void OnUnobserve(int32_t ipc_database_id,
- const std::vector<int32_t>& observer_ids_to_remove);
-
- void OnGet(const IndexedDBHostMsg_DatabaseGet_Params& params);
- void OnGetAll(const IndexedDBHostMsg_DatabaseGetAll_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<std::unique_ptr<storage::BlobDataHandle>> handles);
- void OnSetIndexKeys(
- const IndexedDBHostMsg_DatabaseSetIndexKeys_Params& params);
- void OnSetIndexesReady(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- const std::vector<int64_t>& ids);
- void OnOpenCursor(const IndexedDBHostMsg_DatabaseOpenCursor_Params& params);
- void OnCount(const IndexedDBHostMsg_DatabaseCount_Params& params);
- void OnDeleteRange(
- const IndexedDBHostMsg_DatabaseDeleteRange_Params& params);
- void OnClear(int32_t ipc_thread_id,
- int32_t ipc_callbacks_id,
- int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id);
- void OnCreateIndex(
- const IndexedDBHostMsg_DatabaseCreateIndex_Params& params);
- void OnDeleteIndex(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- int64_t index_id);
- void OnRenameIndex(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- int64_t index_id,
- const base::string16& new_name);
-
- void OnAbort(int32_t ipc_database_id, int64_t transaction_id);
- void OnCommit(int32_t ipc_database_id, int64_t transaction_id);
- void OnGotUsageAndQuotaForCommit(int32_t ipc_database_id,
- int64_t transaction_id,
- storage::QuotaStatusCode status,
- int64_t usage,
- int64_t quota);
-
- IndexedDBDispatcherHost* parent_;
- IDMap<IndexedDBConnection, IDMapOwnPointer> map_;
- WebIDBObjectIDToOriginMap database_origin_map_;
- TransactionIDToSizeMap transaction_size_map_;
- TransactionIDToOriginMap transaction_origin_map_;
- TransactionIDToDatabaseIDMap transaction_database_map_;
-
- // Weak pointers are used when an asynchronous quota request is made, in
- // case the dispatcher is torn down before the response returns.
- base::WeakPtrFactory<DatabaseDispatcherHost> weak_factory_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DatabaseDispatcherHost);
- };
-
class CursorDispatcherHost {
public:
explicit CursorDispatcherHost(IndexedDBDispatcherHost* parent);
@@ -281,9 +184,6 @@ class IndexedDBDispatcherHost
// Helper templates.
template <class ReturnType>
- ReturnType* GetOrTerminateProcess(IDMap<ReturnType, IDMapOwnPointer>* map,
- int32_t ipc_return_object_id);
- template <class ReturnType>
ReturnType* GetOrTerminateProcess(RefIDMap<ReturnType>* map,
int32_t ipc_return_object_id);
@@ -323,12 +223,8 @@ class IndexedDBDispatcherHost
// Message processing. Most of the work is delegated to the dispatcher hosts
// below.
void OnAckReceivedBlobs(const std::vector<std::string>& uuids);
- void OnPutHelper(
- const IndexedDBHostMsg_DatabasePut_Params& params,
- std::vector<std::unique_ptr<storage::BlobDataHandle>> handles);
void ResetDispatcherHosts();
- void DropBlobData(const std::string& uuid);
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
@@ -343,7 +239,8 @@ class IndexedDBDispatcherHost
// Only access on IndexedDB thread.
bool is_open_ = true;
- std::unique_ptr<DatabaseDispatcherHost> database_dispatcher_host_;
+ TransactionIDToSizeMap transaction_size_map_;
+ TransactionIDToOriginMap transaction_origin_map_;
std::unique_ptr<CursorDispatcherHost> cursor_dispatcher_host_;
// Used to set file permissions for blob storage.
« no previous file with comments | « content/browser/indexed_db/indexed_db_database_unittest.cc ('k') | content/browser/indexed_db/indexed_db_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698