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

Issue 2727733004: [IndexedDB] Closing mojo connections when renderer quits (Closed)

Created:
3 years, 9 months ago by dmurph
Modified:
3 years, 8 months ago
CC:
Aaron Boodman, abarth-chromium, chromium-reviews, cmumford, darin (slow to review), darin-cc_chromium.org, jam, jsbell+idb_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[IndexedDB] Closing mojo connections when renderer exits. Changes IndexedDBDispatcherHost to be owned by a unique_ptr instead of ref counted, and makes the mojo connections for the database and the cursor interfaces strongly stored (owned) by the dispatcher host. The dispatcher host now supports weak pointers, which are used by the IndexedDB.*Callbacks (still refcounted, and probably by necessity) to ignore responses when the host is gone. The host also observes renderer exit - which can happen well before the render process host is destroyed - to destruct the bindings and clear the weak pointers. Finally, minor cleanup includes minimizing dependencies, adding the connection error listener on IndexedDBDatabaseCallbacks to cut that off as early as possible, and formally create the IDBHelper on the dispatcher host to make the idb thread separation cleaner. BUG=696055 Review-Url: https://codereview.chromium.org/2727733004 Cr-Commit-Position: refs/heads/master@{#463786} Committed: https://chromium.googlesource.com/chromium/src/+/1f18ca937688b4e0ee570b4d506f5ac21ead5b93

Patch Set 1 #

Total comments: 10

Patch Set 2 : comments, still figuring out how to test #

Total comments: 8

Patch Set 3 : RefPtr refactor, IDBHelper in DispatcherHost, explicit exit handling #

Patch Set 4 : added connection error listener #

Patch Set 5 : Cleaned up logging #

Total comments: 2

Patch Set 6 : Removed raw pointer from IndexedDBCallbacks, Impl creation now on IO thread #

Patch Set 7 : No more raw pointers where we're not guarenteed lifetime #

Total comments: 8

Patch Set 8 : tests running #

Total comments: 11

Patch Set 9 : comments #

Patch Set 10 : fixed browsertest race condition #

Patch Set 11 : rebase #

Patch Set 12 : fix and rebase #

Total comments: 16

Patch Set 13 : comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+574 lines, -223 lines) Patch
M content/browser/indexed_db/cursor_impl.h View 1 2 3 4 5 6 3 chunks +8 lines, -4 lines 0 comments Download
M content/browser/indexed_db/cursor_impl.cc View 1 2 3 4 5 6 5 chunks +15 lines, -12 lines 0 comments Download
M content/browser/indexed_db/database_impl.h View 1 2 3 4 5 6 3 chunks +12 lines, -4 lines 0 comments Download
M content/browser/indexed_db/database_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 35 chunks +75 lines, -28 lines 0 comments Download
M content/browser/indexed_db/indexed_db_callbacks.h View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +16 lines, -9 lines 0 comments Download
M content/browser/indexed_db/indexed_db_callbacks.cc View 1 2 3 4 5 6 7 8 9 10 11 12 28 chunks +203 lines, -76 lines 0 comments Download
M content/browser/indexed_db/indexed_db_database_callbacks.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +6 lines, -4 lines 0 comments Download
M content/browser/indexed_db/indexed_db_database_callbacks.cc View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +27 lines, -14 lines 0 comments Download
M content/browser/indexed_db/indexed_db_database_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +6 lines, -1 line 0 comments Download
M content/browser/indexed_db/indexed_db_dispatcher_host.h View 1 2 3 4 5 6 7 8 4 chunks +47 lines, -26 lines 0 comments Download
M content/browser/indexed_db/indexed_db_dispatcher_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 8 chunks +110 lines, -35 lines 0 comments Download
M content/browser/indexed_db/indexed_db_factory_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -1 line 0 comments Download
M content/browser/indexed_db/indexed_db_unittest.cc View 1 2 3 4 5 6 7 2 chunks +5 lines, -1 line 0 comments Download
M content/browser/indexed_db/mock_indexed_db_callbacks.cc View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/indexed_db/mock_indexed_db_database_callbacks.cc View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_process_host_impl.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +3 lines, -1 line 0 comments Download
M mojo/public/cpp/bindings/associated_binding.h View 1 2 3 4 1 chunk +4 lines, -3 lines 0 comments Download
A mojo/public/cpp/bindings/strong_associated_binding_set.h View 1 2 1 chunk +25 lines, -0 lines 0 comments Download

Messages

Total messages: 62 (36 generated)
dmurph
Hello all, This patch should fix the one major change from the mojo switch, and ...
3 years, 9 months ago (2017-03-03 01:34:14 UTC) #2
pwnall
Is the dependency on the other CL necessary? Also, can you explain how you test ...
3 years, 9 months ago (2017-03-03 01:41:12 UTC) #3
Reilly Grant (use Gerrit)
https://codereview.chromium.org/2727733004/diff/1/content/browser/indexed_db/indexed_db_dispatcher_host.h File content/browser/indexed_db/indexed_db_dispatcher_host.h (right): https://codereview.chromium.org/2727733004/diff/1/content/browser/indexed_db/indexed_db_dispatcher_host.h#newcode23 content/browser/indexed_db/indexed_db_dispatcher_host.h:23: #include "mojo/public/cpp/bindings/strong_associated_binding_set.h" This header is missing from the patch.
3 years, 9 months ago (2017-03-03 01:51:47 UTC) #4
Reilly Grant (use Gerrit)
https://codereview.chromium.org/2727733004/diff/1/content/browser/indexed_db/cursor_impl.h File content/browser/indexed_db/cursor_impl.h (right): https://codereview.chromium.org/2727733004/diff/1/content/browser/indexed_db/cursor_impl.h#newcode50 content/browser/indexed_db/cursor_impl.h:50: IndexedDBDispatcherHost* dispatcher_host_; Add comment: // This raw pointer is ...
3 years, 9 months ago (2017-03-03 01:59:59 UTC) #5
dmurph
I'm still trying to figure out how to test this in the best way. https://codereview.chromium.org/2727733004/diff/1/content/browser/indexed_db/cursor_impl.h ...
3 years, 9 months ago (2017-03-04 00:39:41 UTC) #7
dmurph
+rockot for mojo changes.
3 years, 9 months ago (2017-03-04 00:40:10 UTC) #10
Reilly Grant (use Gerrit)
lgtm with nits https://codereview.chromium.org/2727733004/diff/20001/content/browser/indexed_db/indexed_db_backing_store.cc File content/browser/indexed_db/indexed_db_backing_store.cc (right): https://codereview.chromium.org/2727733004/diff/20001/content/browser/indexed_db/indexed_db_backing_store.cc#newcode3299 content/browser/indexed_db/indexed_db_backing_store.cc:3299: IDB_TRACE("IndexedDBBackingStore::Cursor::ContinueNext"); The changes in this file ...
3 years, 9 months ago (2017-03-04 01:26:14 UTC) #11
cmumford
https://codereview.chromium.org/2727733004/diff/20001/mojo/public/cpp/bindings/associated_binding.h File mojo/public/cpp/bindings/associated_binding.h (right): https://codereview.chromium.org/2727733004/diff/20001/mojo/public/cpp/bindings/associated_binding.h#newcode99 mojo/public/cpp/bindings/associated_binding.h:99: // |Bind| method. Does not take ownership of |impl|, ...
3 years, 9 months ago (2017-03-07 20:24:23 UTC) #14
dmurph
Note: This patch needs a bit more lifetime changes. Will take a little more time ...
3 years, 9 months ago (2017-03-07 20:26:06 UTC) #15
Ken Rockot(use gerrit already)
Sorry I seem to have missed this review. LGTM
3 years, 9 months ago (2017-03-07 20:27:45 UTC) #16
Ken Rockot(use gerrit already)
On 2017/03/07 at 20:27:45, Ken Rockot wrote: > Sorry I seem to have missed this ...
3 years, 9 months ago (2017-03-07 20:30:50 UTC) #17
dmurph
Hello all, can you PTAL at this patch? I updated the patch description to try ...
3 years, 9 months ago (2017-03-09 20:44:15 UTC) #20
Reilly Grant (use Gerrit)
https://codereview.chromium.org/2727733004/diff/80001/content/browser/indexed_db/indexed_db_callbacks.h File content/browser/indexed_db/indexed_db_callbacks.h (right): https://codereview.chromium.org/2727733004/diff/80001/content/browser/indexed_db/indexed_db_callbacks.h#newcode110 content/browser/indexed_db/indexed_db_callbacks.h:110: IndexedDBDispatcherHost* dispatcher_host_; I'm less confident that this is safe ...
3 years, 9 months ago (2017-03-10 00:11:22 UTC) #21
dmurph
Still pre-tests update patch. https://codereview.chromium.org/2727733004/diff/80001/content/browser/indexed_db/indexed_db_callbacks.h File content/browser/indexed_db/indexed_db_callbacks.h (right): https://codereview.chromium.org/2727733004/diff/80001/content/browser/indexed_db/indexed_db_callbacks.h#newcode110 content/browser/indexed_db/indexed_db_callbacks.h:110: IndexedDBDispatcherHost* dispatcher_host_; On 2017/03/10 00:11:22, ...
3 years, 9 months ago (2017-03-10 23:40:26 UTC) #22
Reilly Grant (use Gerrit)
Looking good. https://codereview.chromium.org/2727733004/diff/120001/content/browser/indexed_db/database_impl.cc File content/browser/indexed_db/database_impl.cc (right): https://codereview.chromium.org/2727733004/diff/120001/content/browser/indexed_db/database_impl.cc#newcode463 content/browser/indexed_db/database_impl.cc:463: LOG(ERROR) << "about to call closed"; Leftover ...
3 years, 9 months ago (2017-03-11 00:31:40 UTC) #23
pwnall
The code LGTM w/ nits, with the caveat that I haven't taken a close look ...
3 years, 9 months ago (2017-03-27 21:55:12 UTC) #28
dmurph
I removed the testing in favor of doing the lifetime testing (which currently never happens ...
3 years, 8 months ago (2017-03-29 18:40:25 UTC) #31
dmurph
This patch is so good that it exposed a previously rare race condition. Fixed that ...
3 years, 8 months ago (2017-03-29 22:55:41 UTC) #35
dmurph
+jam for render_process_host_impl.cc/h Chris/Josh, can you PTAL?
3 years, 8 months ago (2017-04-11 00:28:47 UTC) #47
dmurph
+jam for render_process_host_impl.cc/h
3 years, 8 months ago (2017-04-11 00:29:08 UTC) #49
jam
lgtm
3 years, 8 months ago (2017-04-11 01:13:54 UTC) #50
jsbell
Can we turn more of the comments about task runner affinity into assertions? https://codereview.chromium.org/2727733004/diff/220001/content/browser/indexed_db/database_impl.cc File ...
3 years, 8 months ago (2017-04-11 16:58:04 UTC) #51
dmurph
Thanks! https://codereview.chromium.org/2727733004/diff/220001/content/browser/indexed_db/database_impl.cc File content/browser/indexed_db/database_impl.cc (right): https://codereview.chromium.org/2727733004/diff/220001/content/browser/indexed_db/database_impl.cc#newcode32 content/browser/indexed_db/database_impl.cc:32: // Expect to be created on IO thread, ...
3 years, 8 months ago (2017-04-11 19:32:50 UTC) #53
jsbell
lgtm!
3 years, 8 months ago (2017-04-11 20:35:48 UTC) #55
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2727733004/240001
3 years, 8 months ago (2017-04-11 20:48:16 UTC) #59
commit-bot: I haz the power
3 years, 8 months ago (2017-04-11 21:52:08 UTC) #62
Message was sent while issue was closed.
Committed patchset #13 (id:240001) as
https://chromium.googlesource.com/chromium/src/+/1f18ca937688b4e0ee570b4d506f...

Powered by Google App Engine
This is Rietveld 408576698