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

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

Issue 2525443002: [IndexedDB] Delete callbacks state on worker thread exit. (Closed)
Patch Set: 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.cc
diff --git a/content/child/indexed_db/indexed_db_dispatcher.cc b/content/child/indexed_db/indexed_db_dispatcher.cc
index aafd24419d65f749c47d08f81e01134920406d48..a014c96391a6c6003abe8c12d10992e5d9dfbb43 100644
--- a/content/child/indexed_db/indexed_db_dispatcher.cc
+++ b/content/child/indexed_db/indexed_db_dispatcher.cc
@@ -196,24 +196,28 @@ void IndexedDBDispatcher::CursorDestroyed(int32_t ipc_cursor_id) {
void IndexedDBDispatcher::RegisterMojoOwnedCallbacks(
IndexedDBCallbacksImpl::InternalState* callbacks) {
- mojo_owned_callback_state_.insert(callbacks);
+ mojo_owned_callback_state_[callbacks] = base::WrapUnique(callbacks);
}
void IndexedDBDispatcher::UnregisterMojoOwnedCallbacks(
IndexedDBCallbacksImpl::InternalState* callbacks) {
- DCHECK(base::ContainsValue(mojo_owned_callback_state_, callbacks));
- mojo_owned_callback_state_.erase(callbacks);
+ auto it = mojo_owned_callback_state_.find(callbacks);
+ DCHECK(it != mojo_owned_callback_state_.end());
+ it->second.release();
jsbell 2016/11/21 22:38:06 Is the release() necessary?
Reilly Grant (use Gerrit) 2016/11/21 23:26:10 Yes. Otherwise erase(it) will free the object and
jsbell 2016/11/21 23:36:29 Derp. My brain was reading `reset()` for some reas
+ mojo_owned_callback_state_.erase(it);
}
void IndexedDBDispatcher::RegisterMojoOwnedDatabaseCallbacks(
blink::WebIDBDatabaseCallbacks* callbacks) {
- mojo_owned_database_callback_state_.insert(callbacks);
+ mojo_owned_database_callback_state_[callbacks] = base::WrapUnique(callbacks);
}
void IndexedDBDispatcher::UnregisterMojoOwnedDatabaseCallbacks(
blink::WebIDBDatabaseCallbacks* callbacks) {
- DCHECK(base::ContainsValue(mojo_owned_database_callback_state_, callbacks));
- mojo_owned_database_callback_state_.erase(callbacks);
+ auto it = mojo_owned_database_callback_state_.find(callbacks);
+ DCHECK(it != mojo_owned_database_callback_state_.end());
+ it->second.release();
+ mojo_owned_database_callback_state_.erase(it);
}
// Populate some WebIDBValue members (data & blob info) from the supplied

Powered by Google App Engine
This is Rietveld 408576698