Chromium Code Reviews| 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 5934c6f7dfc84b23617f37b0f2f0cd23f21e6f01..2fc36d7e928c21e54fd42c4c6b3be25564bf9979 100644 |
| --- a/content/browser/indexed_db/indexed_db_dispatcher_host.h |
| +++ b/content/browser/indexed_db/indexed_db_dispatcher_host.h |
| @@ -16,32 +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 IndexedDBHostMsg_FactoryDeleteDatabase_Params; |
| -struct IndexedDBHostMsg_FactoryGetDatabaseNames_Params; |
| -struct IndexedDBHostMsg_FactoryOpen_Params; |
| struct IndexedDBMsg_Observation; |
| struct IndexedDBMsg_ObserverChanges; |
| @@ -57,11 +40,8 @@ class IndexedDBContextImpl; |
| class IndexedDBCursor; |
| class IndexedDBDatabaseCallbacks; |
| class IndexedDBKey; |
| -class IndexedDBKeyPath; |
| -class IndexedDBKeyRange; |
| class IndexedDBObservation; |
| class IndexedDBObserverChanges; |
| -struct IndexedDBDatabaseMetadata; |
| // Handles all IndexedDB related messages from a particular renderer process. |
| class IndexedDBDispatcherHost |
| @@ -94,15 +74,17 @@ class IndexedDBDispatcherHost |
| storage::BlobStorageContext* blob_storage_context() const { |
| return blob_storage_context_->context(); |
| } |
| + int ipc_process_id() { return ipc_process_id_; } |
|
cmumford
2016/10/28 18:40:53
const
Reilly Grant (use Gerrit)
2016/11/03 21:32:21
Done.
|
| // 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); |
| @@ -118,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. |
| @@ -132,7 +115,6 @@ class IndexedDBDispatcherHost |
| typedef std::map<int64_t, int64_t> TransactionIDToDatabaseIDMap; |
| typedef std::map<int64_t, uint64_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> |
| @@ -166,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); |
| @@ -286,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); |
| @@ -328,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_; |
| @@ -348,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. |