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

Unified Diff: content/child/indexed_db/indexed_db_dispatcher.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/child/indexed_db/indexed_db_dispatcher.h
diff --git a/content/child/indexed_db/indexed_db_dispatcher.h b/content/child/indexed_db/indexed_db_dispatcher.h
index d5288c252196ec58b93ecdab74a98773be9faea1..3d75d37bc6dc1ba54beb815020c0774b9306c01e 100644
--- a/content/child/indexed_db/indexed_db_dispatcher.h
+++ b/content/child/indexed_db/indexed_db_dispatcher.h
@@ -76,20 +76,10 @@ class CONTENT_EXPORT IndexedDBDispatcher : public WorkerThread::Observer {
// This method is virtual so it can be overridden in unit tests.
virtual bool Send(IPC::Message* msg);
- int32_t AddIDBObserver(int32_t ipc_database_id,
- int64_t transaction_id,
- std::unique_ptr<blink::WebIDBObserver> observer);
+ int32_t RegisterObserver(std::unique_ptr<blink::WebIDBObserver> observer);
- // The observer with ID's in |observer_ids_to_remove| observe the
- // |ipc_database_id|.
- // We remove our local references to these observer objects, and send an IPC
- // to clean up the observers from the backend.
- void RemoveIDBObserversFromDatabase(
- int32_t ipc_database_id,
- const std::vector<int32_t>& observer_ids_to_remove);
-
- // Removes observers from our local map observers_ . No IPC message generated.
- void RemoveIDBObservers(const std::set<int32_t>& observer_ids_to_remove);
+ // Removes observers from our local map observers_.
+ void RemoveObservers(const std::vector<int32_t>& observer_ids_to_remove);
// This method is virtual so it can be overridden in unit tests.
virtual void RequestIDBCursorAdvance(unsigned long count,
@@ -114,76 +104,15 @@ class CONTENT_EXPORT IndexedDBDispatcher : public WorkerThread::Observer {
int unused_prefetches,
int32_t ipc_cursor_id);
- void RequestIDBDatabaseClose(int32_t ipc_database_id);
-
- void NotifyIDBDatabaseVersionChangeIgnored(int32_t ipc_database_id);
-
- void RequestIDBDatabaseCreateTransaction(
- int32_t ipc_database_id,
- int64_t transaction_id,
- blink::WebVector<long long> object_store_ids,
- blink::WebIDBTransactionMode mode);
-
- void RequestIDBDatabaseGet(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- int64_t index_id,
- const IndexedDBKeyRange& key_range,
- bool key_only,
- blink::WebIDBCallbacks* callbacks);
-
- void RequestIDBDatabaseGetAll(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- int64_t index_id,
- const IndexedDBKeyRange& key_range,
- bool key_only,
- int64_t max_count,
- blink::WebIDBCallbacks* callbacks);
-
- void RequestIDBDatabasePut(
- int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- const blink::WebData& value,
- const blink::WebVector<blink::WebBlobInfo>& web_blob_info,
- const IndexedDBKey& key,
- blink::WebIDBPutMode put_mode,
- blink::WebIDBCallbacks* callbacks,
- const blink::WebVector<long long>& index_ids,
- const blink::WebVector<blink::WebVector<blink::WebIDBKey>>& index_keys);
-
- void RequestIDBDatabaseOpenCursor(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- int64_t index_id,
- const IndexedDBKeyRange& key_range,
- blink::WebIDBCursorDirection direction,
- bool key_only,
- blink::WebIDBTaskType task_type,
- blink::WebIDBCallbacks* callbacks);
-
- void RequestIDBDatabaseCount(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- int64_t index_id,
- const IndexedDBKeyRange& key_range,
- blink::WebIDBCallbacks* callbacks);
-
- void RequestIDBDatabaseDeleteRange(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- const IndexedDBKeyRange& key_range,
- blink::WebIDBCallbacks* callbacks);
-
- void RequestIDBDatabaseClear(int32_t ipc_database_id,
- int64_t transaction_id,
- int64_t object_store_id,
- blink::WebIDBCallbacks* callbacks);
+ void RegisterCursor(int32_t ipc_cursor_id, WebIDBCursorImpl* cursor);
virtual void CursorDestroyed(int32_t ipc_cursor_id);
- void DatabaseDestroyed(int32_t ipc_database_id);
- blink::WebIDBDatabase* RegisterDatabase(int32_t ipc_database_id);
+
+ enum { kAllCursors = -1 };
+
+ // Reset cursor prefetch caches for all cursors except exception_cursor_id.
+ void ResetCursorPrefetchCaches(int64_t transaction_id,
+ int32_t ipc_exception_cursor_id);
void RegisterMojoOwnedCallbacks(
IndexedDBCallbacksImpl::InternalState* callback_state);
@@ -197,10 +126,6 @@ class CONTENT_EXPORT IndexedDBDispatcher : public WorkerThread::Observer {
private:
FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, CursorReset);
FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, CursorTransactionId);
- FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest);
- FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, KeyAndValueSizeTest);
-
- enum { kAllCursors = -1 };
static int32_t CurrentWorkerId() { return WorkerThread::GetCurrentId(); }
@@ -212,22 +137,14 @@ class CONTENT_EXPORT IndexedDBDispatcher : public WorkerThread::Observer {
}
// IDBCallback message handlers.
- void OnSuccessIndexedDBKey(int32_t ipc_thread_id,
- int32_t ipc_callbacks_id,
- const IndexedDBKey& key);
-
- void OnSuccessOpenCursor(
- const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p);
void OnSuccessCursorContinue(
const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p);
void OnSuccessCursorPrefetch(
const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p);
void OnSuccessValue(const IndexedDBMsg_CallbacksSuccessValue_Params& p);
- void OnSuccessArray(const IndexedDBMsg_CallbacksSuccessArray_Params& p);
void OnSuccessInteger(int32_t ipc_thread_id,
int32_t ipc_callbacks_id,
int64_t value);
- void OnSuccessUndefined(int32_t ipc_thread_id, int32_t ipc_callbacks_id);
void OnError(int32_t ipc_thread_id,
int32_t ipc_callbacks_id,
int code,
@@ -235,18 +152,8 @@ class CONTENT_EXPORT IndexedDBDispatcher : public WorkerThread::Observer {
void OnDatabaseChanges(int32_t ipc_thread_id,
const IndexedDBMsg_ObserverChanges&);
- // Reset cursor prefetch caches for all cursors except exception_cursor_id.
- void ResetCursorPrefetchCaches(int64_t transaction_id,
- int32_t ipc_exception_cursor_id);
-
scoped_refptr<ThreadSafeSender> thread_safe_sender_;
- // Maximum size (in bytes) of value/key pair allowed for put requests. Any
- // requests larger than this size will be rejected.
- // Used by unit tests to exercise behavior without allocating huge chunks
- // of memory.
- size_t max_put_value_size_ = kMaxIDBMessageSizeInBytes;
-
// Careful! WebIDBCallbacks wraps non-threadsafe data types. It must be
// destroyed and used on the same thread it was created on.
IDMap<blink::WebIDBCallbacks, IDMapOwnPointer> pending_callbacks_;
@@ -270,8 +177,6 @@ class CONTENT_EXPORT IndexedDBDispatcher : public WorkerThread::Observer {
// Map from cursor id to WebIDBCursorImpl.
std::map<int32_t, WebIDBCursorImpl*> cursors_;
- std::map<int32_t, WebIDBDatabaseImpl*> databases_;
-
DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher);
};
« no previous file with comments | « content/child/indexed_db/indexed_db_callbacks_impl.cc ('k') | content/child/indexed_db/indexed_db_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698