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

Issue 662853003: Manage MIDI related objects and sessions' lifecycles correctly (Closed)

Created:
6 years, 2 months ago by Takashi Toyoshima
Modified:
6 years, 2 months ago
CC:
chromium-reviews, posciak+watch_chromium.org, jam, mcasas+watch_chromium.org, mkwst+moarreviews-ipc_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, mkwst+moarreviews-renderer_chromium.org, wjia+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Manage MIDI related objects and sessions' lifecycles correctly Following changes are needed to maintain MIDIPortInfoList contents consistent in each MidiMessageFilter instances when MidiManager update the list asynchronously. Essential changes: - Call EndSession iff a session is open. - Do not use client_id to communicate between browser and renderer. Multiple clients are managed in a MidiMessageFilter existing in each renderer. Minor changes: - Remove midi_manager_ checks in MIDIHost, and add CHECK insteads. - Rename MidiManagerFilter::StartSession to MidiManagerFilter::AddClient to be aligned with RemoveClient. A session can be shared with multiple clients. After this change, MidiManager::EndSession is called from each Renderer and RendererHost at the right timing, e.g., GC collects the last MIDIAccess reference in JavaScript. See, also http://crbug.com/424859. BUG=424859 Committed: https://crrev.com/71fcb150d9e2cb5e2f05069177ac611ac9c189c0 Cr-Commit-Position: refs/heads/master@{#300851}

Patch Set 1 #

Patch Set 2 : remove client_id #

Patch Set 3 : unittest #

Total comments: 24

Patch Set 4 : for review #3 (rebase was needed for try) #

Patch Set 5 : [rebase not for review, but for trybots] #

Total comments: 9

Patch Set 6 : fix rebase error that causes build errros #

Patch Set 7 : address review comments at #7 #

Total comments: 14

Patch Set 8 : [rebase - work from another machine] #

Patch Set 9 : lock free! #

Total comments: 1

Patch Set 10 : one line bug fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+240 lines, -213 lines) Patch
M content/browser/media/midi_host.h View 1 2 3 4 5 6 7 4 chunks +8 lines, -2 lines 0 comments Download
M content/browser/media/midi_host.cc View 1 2 3 4 chunks +16 lines, -10 lines 0 comments Download
M content/common/media/midi_messages.h View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
M content/renderer/media/midi_message_filter.h View 1 2 3 4 5 6 7 8 6 chunks +33 lines, -25 lines 0 comments Download
M content/renderer/media/midi_message_filter.cc View 1 2 3 4 5 6 7 8 9 5 chunks +136 lines, -129 lines 0 comments Download
M content/renderer/media/renderer_webmidiaccessor_impl.cc View 1 chunk +1 line, -1 line 0 comments Download
M media/midi/midi_manager.h View 1 4 chunks +5 lines, -7 lines 0 comments Download
M media/midi/midi_manager.cc View 1 2 3 4 5 6 7 8 7 chunks +17 lines, -11 lines 0 comments Download
M media/midi/midi_manager_unittest.cc View 1 2 3 4 5 6 7 11 chunks +16 lines, -21 lines 0 comments Download
M media/midi/midi_manager_usb_unittest.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -2 lines 0 comments Download
M media/midi/midi_result.h View 1 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 29 (6 generated)
Takashi Toyoshima
PTAL
6 years, 2 months ago (2014-10-18 12:35:42 UTC) #2
yhirano
"between browser and render" in the description should be "between browser and renderer"? https://codereview.chromium.org/662853003/diff/40001/content/browser/media/midi_host.cc File ...
6 years, 2 months ago (2014-10-20 12:15:15 UTC) #3
Takashi Toyoshima
https://codereview.chromium.org/662853003/diff/40001/content/browser/media/midi_host.cc File content/browser/media/midi_host.cc (right): https://codereview.chromium.org/662853003/diff/40001/content/browser/media/midi_host.cc#newcode51 content/browser/media/midi_host.cc:51: MidiHost::MidiHost(int renderer_process_id, media::MidiManager* midi_manager) Oh, thanks! But, I'm surprised ...
6 years, 2 months ago (2014-10-20 17:14:44 UTC) #4
Takashi Toyoshima
palmer@chromium.org: Please review changes in midi_messages.h (IPC) scherkus@chromium.org: Please review changes in media/
6 years, 2 months ago (2014-10-20 17:18:05 UTC) #6
scherkus (not reviewing)
few questions https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.cc File content/renderer/media/midi_message_filter.cc (right): https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.cc#newcode68 content/renderer/media/midi_message_filter.cc:68: void MidiMessageFilter::SendMidiData(uint32 port, which thread is this ...
6 years, 2 months ago (2014-10-20 18:05:48 UTC) #7
palmer
https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.h File content/renderer/media/midi_message_filter.h (right): https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.h#newcode56 content/renderer/media/midi_message_filter.h:56: double timestamp); double? Not e.g. int64 of microseconds or ...
6 years, 2 months ago (2014-10-20 18:25:49 UTC) #8
Takashi Toyoshima
https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.h File content/renderer/media/midi_message_filter.h (right): https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.h#newcode56 content/renderer/media/midi_message_filter.h:56: double timestamp); This is not changed. Just replaced from ...
6 years, 2 months ago (2014-10-20 18:37:57 UTC) #9
palmer
> This is not changed. Just replaced from line 93. We use double since this ...
6 years, 2 months ago (2014-10-20 21:34:42 UTC) #10
Takashi Toyoshima
I agreed other points, and will fix them in the next patch set. https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.cc File ...
6 years, 2 months ago (2014-10-21 01:24:07 UTC) #11
Takashi Toyoshima
PTAL Patch Set 7 https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.cc File content/renderer/media/midi_message_filter.cc (right): https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.cc#newcode199 content/renderer/media/midi_message_filter.cc:199: for (media::MidiPortInfo info : inputs_) ...
6 years, 2 months ago (2014-10-21 01:49:46 UTC) #12
yhirano
https://codereview.chromium.org/662853003/diff/120001/content/browser/media/midi_host.cc File content/browser/media/midi_host.cc (right): https://codereview.chromium.org/662853003/diff/120001/content/browser/media/midi_host.cc#newcode121 content/browser/media/midi_host.cc:121: void MidiHost::OnEndSession() { DCHECK(is_session_requested_); https://codereview.chromium.org/662853003/diff/120001/content/renderer/media/midi_message_filter.cc File content/renderer/media/midi_message_filter.cc (right): https://codereview.chromium.org/662853003/diff/120001/content/renderer/media/midi_message_filter.cc#newcode56 ...
6 years, 2 months ago (2014-10-21 13:21:20 UTC) #13
scherkus (not reviewing)
lgtm https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.cc File content/renderer/media/midi_message_filter.cc (right): https://codereview.chromium.org/662853003/diff/80001/content/renderer/media/midi_message_filter.cc#newcode68 content/renderer/media/midi_message_filter.cc:68: void MidiMessageFilter::SendMidiData(uint32 port, On 2014/10/21 01:24:07, Takashi Toyoshima ...
6 years, 2 months ago (2014-10-21 17:06:18 UTC) #14
palmer
https://codereview.chromium.org/662853003/diff/120001/content/browser/media/midi_host.cc File content/browser/media/midi_host.cc (right): https://codereview.chromium.org/662853003/diff/120001/content/browser/media/midi_host.cc#newcode77 content/browser/media/midi_host.cc:77: IPC_MESSAGE_HANDLER(MidiHostMsg_SendData, OnSendData) It's in this function that the browser ...
6 years, 2 months ago (2014-10-21 21:20:12 UTC) #15
Takashi Toyoshima
Palmer: Can you read following my two comments firstly? I'm not sure I could understand ...
6 years, 2 months ago (2014-10-22 03:50:57 UTC) #16
Takashi Toyoshima
I'll upload new version that do not need lock, and is safe on client object ...
6 years, 2 months ago (2014-10-22 05:57:40 UTC) #17
Takashi Toyoshima
https://codereview.chromium.org/662853003/diff/180001/content/renderer/media/midi_message_filter.h File content/renderer/media/midi_message_filter.h (right): https://codereview.chromium.org/662853003/diff/180001/content/renderer/media/midi_message_filter.h#newcode70 content/renderer/media/midi_message_filter.h:70: // TODO(toyoshim): MidiPortInfoList objects should be notified separately This ...
6 years, 2 months ago (2014-10-22 06:16:35 UTC) #19
palmer
LGTM https://codereview.chromium.org/662853003/diff/120001/content/browser/media/midi_host.cc File content/browser/media/midi_host.cc (right): https://codereview.chromium.org/662853003/diff/120001/content/browser/media/midi_host.cc#newcode77 content/browser/media/midi_host.cc:77: IPC_MESSAGE_HANDLER(MidiHostMsg_SendData, OnSendData) > line 114 is the check. ...
6 years, 2 months ago (2014-10-22 19:43:32 UTC) #20
yhirano
lgtm
6 years, 2 months ago (2014-10-23 03:38:18 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/662853003/200001
6 years, 2 months ago (2014-10-23 04:10:56 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel on tryserver.chromium.mac (http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel/builds/5287)
6 years, 2 months ago (2014-10-23 05:16:33 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/662853003/200001
6 years, 2 months ago (2014-10-23 05:37:12 UTC) #27
commit-bot: I haz the power
Committed patchset #10 (id:200001)
6 years, 2 months ago (2014-10-23 07:18:10 UTC) #28
commit-bot: I haz the power
6 years, 2 months ago (2014-10-23 07:19:12 UTC) #29
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/71fcb150d9e2cb5e2f05069177ac611ac9c189c0
Cr-Commit-Position: refs/heads/master@{#300851}

Powered by Google App Engine
This is Rietveld 408576698