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

Issue 1315793008: Web MIDI: introduce MidiManager::Shutdown to shutdown gracefully (Closed)

Created:
5 years, 3 months ago by Takashi Toyoshima
Modified:
5 years, 2 months ago
Reviewers:
kinuko, yhirano
CC:
chromium-reviews, darin-cc_chromium.org, jam, toyoshim+midi_chromium.org, feature-media-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Web MIDI: introduce MidiManager::Shutdown to shutdown gracefully Platform dependent MidiManager implementations allocate extra threads lazily on the IO thread, but it does not have a chance to stop them correctly on the same IO thread, and stop it on the main thread. This patch introduces Shutdown() method to be called before the IO thread stopped so that the MidiManager implementations can stop the extra threads gracefully on the right thread. Platform specific fixes follow this change. BUG=374341 Committed: https://crrev.com/29aaa95a4444e6d4ce9bb789cc7996821f044e52 Cr-Commit-Position: refs/heads/master@{#352564}

Patch Set 1 #

Patch Set 2 : s/io/IO/g on comments #

Patch Set 3 : rebase #

Total comments: 5

Patch Set 4 : review #3 #

Patch Set 5 : fix content_unittests #

Patch Set 6 : make sure to run Finalize() #

Total comments: 2

Patch Set 7 : Fix a race on session_thread_runner_ #

Patch Set 8 : more checks in unit tests #

Total comments: 6

Patch Set 9 : review #15 #

Patch Set 10 : warning fix #

Patch Set 11 : Detached() #

Patch Set 12 : build fix (mac typo) #

Total comments: 5

Patch Set 13 : rename to Detach #

Unified diffs Side-by-side diffs Delta from patch set Stats (+155 lines, -64 lines) Patch
M content/browser/browser_main_loop.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +8 lines, -3 lines 0 comments Download
M content/browser/media/midi_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +3 lines, -2 lines 0 comments Download
M content/browser/media/midi_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +12 lines, -5 lines 0 comments Download
M content/browser/media/midi_host_unittest.cc View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
M media/midi/midi_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +21 lines, -2 lines 0 comments Download
M media/midi/midi_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +73 lines, -50 lines 0 comments Download
M media/midi/midi_manager_mac_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +6 lines, -0 lines 0 comments Download
M media/midi/midi_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 8 chunks +22 lines, -2 lines 0 comments Download
M media/midi/midi_manager_usb_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +6 lines, -0 lines 0 comments Download

Messages

Total messages: 28 (4 generated)
Takashi Toyoshima
PTAL.
5 years, 3 months ago (2015-09-04 06:48:43 UTC) #2
yhirano
https://codereview.chromium.org/1315793008/diff/40001/media/midi/midi_manager.cc File media/midi/midi_manager.cc (right): https://codereview.chromium.org/1315793008/diff/40001/media/midi/midi_manager.cc#newcode55 media/midi/midi_manager.cc:55: DCHECK(shutted_down_); Shouldn't we check that it is correctly finalized? ...
5 years, 3 months ago (2015-09-07 06:00:25 UTC) #3
Takashi Toyoshima
https://codereview.chromium.org/1315793008/diff/40001/media/midi/midi_manager.cc File media/midi/midi_manager.cc (right): https://codereview.chromium.org/1315793008/diff/40001/media/midi/midi_manager.cc#newcode55 media/midi/midi_manager.cc:55: DCHECK(shutted_down_); We can do nothing here to recover even ...
5 years, 3 months ago (2015-09-07 19:04:39 UTC) #4
Takashi Toyoshima
PTAL. +kinuko for browser_main_loop.cc.
5 years, 3 months ago (2015-09-07 19:51:09 UTC) #6
yhirano
https://codereview.chromium.org/1315793008/diff/40001/media/midi/midi_manager.cc File media/midi/midi_manager.cc (right): https://codereview.chromium.org/1315793008/diff/40001/media/midi/midi_manager.cc#newcode55 media/midi/midi_manager.cc:55: DCHECK(shutted_down_); On 2015/09/07 19:04:39, Takashi Toyoshima (ooo-Sep.30) wrote: > ...
5 years, 3 months ago (2015-09-08 04:59:37 UTC) #7
Takashi Toyoshima
Ah, good point. The browser main thread joins the IO thread before deleting MidiManager and ...
5 years, 3 months ago (2015-09-08 14:11:20 UTC) #8
Takashi Toyoshima
PTAL Patch Set 6.
5 years, 3 months ago (2015-09-08 17:34:37 UTC) #9
yhirano
https://codereview.chromium.org/1315793008/diff/100001/media/midi/midi_manager.cc File media/midi/midi_manager.cc (right): https://codereview.chromium.org/1315793008/diff/100001/media/midi/midi_manager.cc#newcode68 media/midi/midi_manager.cc:68: if (session_thread_runner_) { We need to protect more code ...
5 years, 3 months ago (2015-09-10 07:37:30 UTC) #10
Takashi Toyoshima
https://codereview.chromium.org/1315793008/diff/100001/media/midi/midi_manager.cc File media/midi/midi_manager.cc (right): https://codereview.chromium.org/1315793008/diff/100001/media/midi/midi_manager.cc#newcode68 media/midi/midi_manager.cc:68: if (session_thread_runner_) { You are right. I change code ...
5 years, 3 months ago (2015-09-10 08:19:15 UTC) #11
Takashi Toyoshima
Also, add more checks in unit tests. Maybe we should have new unit tests for ...
5 years, 3 months ago (2015-09-10 08:44:15 UTC) #12
yhirano
I'm a bit confused. It seems we need to block IPC operations as well. By ...
5 years, 3 months ago (2015-09-11 12:32:49 UTC) #13
yhirano
On 2015/09/11 12:32:49, yhirano wrote: > I'm a bit confused. > > It seems we ...
5 years, 3 months ago (2015-09-11 15:56:06 UTC) #14
yhirano
https://codereview.chromium.org/1315793008/diff/140001/media/midi/midi_manager.cc File media/midi/midi_manager.cc (right): https://codereview.chromium.org/1315793008/diff/140001/media/midi/midi_manager.cc#newcode116 media/midi/midi_manager.cc:116: if (finalized_) Should we call CompleteStartSession with INITIALIZATION_ERROR? https://codereview.chromium.org/1315793008/diff/140001/media/midi/midi_manager.h ...
5 years, 3 months ago (2015-09-11 15:59:47 UTC) #15
Takashi Toyoshima
ptal https://codereview.chromium.org/1315793008/diff/140001/media/midi/midi_manager.cc File media/midi/midi_manager.cc (right): https://codereview.chromium.org/1315793008/diff/140001/media/midi/midi_manager.cc#newcode116 media/midi/midi_manager.cc:116: if (finalized_) This isn't easy because I do ...
5 years, 3 months ago (2015-09-17 07:30:49 UTC) #16
Takashi Toyoshima
Note: patch set 9 has a warning to cause build errors. I fixed it in ...
5 years, 3 months ago (2015-09-18 02:59:58 UTC) #17
yhirano
https://codereview.chromium.org/1315793008/diff/140001/media/midi/midi_manager.h File media/midi/midi_manager.h (right): https://codereview.chromium.org/1315793008/diff/140001/media/midi/midi_manager.h#newcode63 media/midi/midi_manager.h:63: virtual void AccumulateMidiBytesSent(size_t n) = 0; On 2015/09/17 07:30:49, ...
5 years, 2 months ago (2015-09-28 07:50:00 UTC) #18
Takashi Toyoshima
PTAL https://codereview.chromium.org/1315793008/diff/140001/media/midi/midi_manager.h File media/midi/midi_manager.h (right): https://codereview.chromium.org/1315793008/diff/140001/media/midi/midi_manager.h#newcode63 media/midi/midi_manager.h:63: virtual void AccumulateMidiBytesSent(size_t n) = 0; I see. ...
5 years, 2 months ago (2015-10-02 15:19:24 UTC) #19
yhirano
lgtm https://codereview.chromium.org/1315793008/diff/220001/media/midi/midi_manager.h File media/midi/midi_manager.h (right): https://codereview.chromium.org/1315793008/diff/220001/media/midi/midi_manager.h#newcode67 media/midi/midi_manager.h:67: virtual void Detached() = 0; [optional] OnDetached() or ...
5 years, 2 months ago (2015-10-05 06:59:02 UTC) #20
Takashi Toyoshima
Kinuko: can you review content/browser/browser_main_loop.cc? https://codereview.chromium.org/1315793008/diff/220001/media/midi/midi_manager.h File media/midi/midi_manager.h (right): https://codereview.chromium.org/1315793008/diff/220001/media/midi/midi_manager.h#newcode67 media/midi/midi_manager.h:67: virtual void Detached() = ...
5 years, 2 months ago (2015-10-05 07:25:10 UTC) #21
kinuko
browser_main_loop lgtm https://codereview.chromium.org/1315793008/diff/220001/content/browser/browser_main_loop.cc File content/browser/browser_main_loop.cc (right): https://codereview.chromium.org/1315793008/diff/220001/content/browser/browser_main_loop.cc#newcode694 content/browser/browser_main_loop.cc:694: // but must be created on the ...
5 years, 2 months ago (2015-10-05 08:56:32 UTC) #22
Takashi Toyoshima
https://codereview.chromium.org/1315793008/diff/220001/content/browser/browser_main_loop.cc File content/browser/browser_main_loop.cc (right): https://codereview.chromium.org/1315793008/diff/220001/content/browser/browser_main_loop.cc#newcode694 content/browser/browser_main_loop.cc:694: // but must be created on the main thread. ...
5 years, 2 months ago (2015-10-05 16:11:06 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1315793008/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1315793008/240001
5 years, 2 months ago (2015-10-06 06:42:57 UTC) #26
commit-bot: I haz the power
Committed patchset #13 (id:240001)
5 years, 2 months ago (2015-10-06 07:54:29 UTC) #27
commit-bot: I haz the power
5 years, 2 months ago (2015-10-06 07:55:41 UTC) #28
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/29aaa95a4444e6d4ce9bb789cc7996821f044e52
Cr-Commit-Position: refs/heads/master@{#352564}

Powered by Google App Engine
This is Rietveld 408576698