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

Unified Diff: content/child/indexed_db/indexed_db_dispatcher.h

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unobserve functionality Created 4 years, 6 months 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 2efdcbc23d45d5390ec72c6911d310749cbacd32..b6486024260776bf20fab39e920eb3d71c9ee7b9 100644
--- a/content/child/indexed_db/indexed_db_dispatcher.h
+++ b/content/child/indexed_db/indexed_db_dispatcher.h
@@ -75,9 +75,11 @@ 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);
- void AddIDBObserver(int32_t ipc_database_id,
- int64_t transaction_id,
- blink::IDBObserver* observer);
+ int32_t AddIDBObserver(int32_t ipc_database_id,
+ int64_t transaction_id,
+ blink::IDBObserver* observer);
+ std::vector<int32_t> RemoveIDBObserver(int32_t ipc_database_id,
+ blink::IDBObserver* observer);
void RequestIDBFactoryGetDatabaseNames(blink::WebIDBCallbacks* callbacks,
const url::Origin& origin);
@@ -256,14 +258,6 @@ class CONTENT_EXPORT IndexedDBDispatcher : public WorkerThread::Observer {
void ResetCursorPrefetchCaches(int64_t transaction_id,
int32_t ipc_exception_cursor_id);
- // int64_t nextObserverId() {
- // // Only keep a 32-bit counter to allow ports to use the other 32
- // // bits of the id.
- // // overflow??
- // static int currentObserverId = 0;
- // return atomicIncrement(&currentObserverId);
- // }
-
scoped_refptr<ThreadSafeSender> thread_safe_sender_;
// Maximum size (in bytes) of value/key pair allowed for put requests. Any
@@ -271,7 +265,6 @@ class CONTENT_EXPORT IndexedDBDispatcher : public WorkerThread::Observer {
// Used by unit tests to exercise behavior without allocating huge chunks
// of memory.
size_t max_put_value_size_ = kMaxIDBMessageSizeInBytes;
- int maxObserverId = 0;
// 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_;
@@ -285,9 +278,8 @@ 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_;
- std::map<int64_t, blink::IDBObserver*> observers_;
+ std::map<int32_t, blink::IDBObserver*> observers_;
DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher);
};

Powered by Google App Engine
This is Rietveld 408576698