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

Issue 1200323003: media: Quit MojoMediaApplication when no service is bound. (Closed)

Created:
5 years, 6 months ago by xhwang
Modified:
5 years, 1 month ago
CC:
chromium-reviews, qsr+mojo_chromium.org, Aaron Boodman, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, feature-media-reviews_chromium.org, darin (slow to review), ben+mojo_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

media: Quit MojoMediaApplication when no service is bound. After 30 seconds without any service bound, we'll quit the mojo media application to release resources. In particular, when we host the app in the utility process, this is needed so that the utility process can be killed when no service is bound for long time. Also changes AppRefCount to supported delayed release. BUG=479935 TEST=Tested with the mojo media app hosted in the utility process.

Patch Set 1 #

Total comments: 6

Patch Set 2 : add test #

Patch Set 3 : #

Patch Set 4 : Use AppRefCount. #

Patch Set 5 : #

Total comments: 6

Patch Set 6 : rebase only #

Patch Set 7 : comments addressed #

Patch Set 8 : rebase only #

Unified diffs Side-by-side diffs Delta from patch set Stats (+103 lines, -15 lines) Patch
M media/mojo/services/media_apptest.cc View 1 2 3 3 chunks +18 lines, -1 line 0 comments Download
M media/mojo/services/mojo_cdm_service.h View 1 2 3 3 chunks +8 lines, -2 lines 0 comments Download
M media/mojo/services/mojo_cdm_service.cc View 1 2 3 2 chunks +6 lines, -1 line 0 comments Download
M media/mojo/services/mojo_media_application.h View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M media/mojo/services/mojo_media_application.cc View 1 2 3 4 5 6 4 chunks +22 lines, -3 lines 0 comments Download
M media/mojo/services/mojo_renderer_service.h View 1 2 3 3 chunks +5 lines, -3 lines 0 comments Download
M media/mojo/services/mojo_renderer_service.cc View 1 2 3 4 5 3 chunks +5 lines, -1 line 0 comments Download
M mojo/application/public/cpp/app_lifetime_helper.h View 1 2 3 2 chunks +6 lines, -0 lines 0 comments Download
M mojo/application/public/cpp/application_impl.h View 1 2 3 4 5 6 7 1 chunk +5 lines, -1 line 0 comments Download
M mojo/application/public/cpp/lib/app_lifetime_helper.cc View 1 2 3 4 4 chunks +18 lines, -3 lines 0 comments Download
M mojo/application/public/cpp/lib/application_impl.cc View 1 2 3 4 5 6 7 2 chunks +7 lines, -0 lines 0 comments Download
M mojo/tools/data/apptests View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 25 (3 generated)
xhwang
I am basically copying the logic in device/devices_app/devices_app.cc. sandersd: PTAL sky: Since rockot@ is OOO, ...
5 years, 6 months ago (2015-06-23 22:31:07 UTC) #3
sandersd (OOO until July 31)
Can we ask/file a bug for this to be implemented in the shell? It doesn't ...
5 years, 6 months ago (2015-06-23 23:46:53 UTC) #4
sky
How about some test coverage? Also, I don't think a general policy like this belongs ...
5 years, 6 months ago (2015-06-24 03:03:32 UTC) #5
xhwang
Comments only: On 2015/06/24 03:03:32, sky wrote: > How about some test coverage? I'll try ...
5 years, 6 months ago (2015-06-25 18:09:45 UTC) #6
xhwang
https://codereview.chromium.org/1200323003/diff/1/media/mojo/services/mojo_media_application.cc File media/mojo/services/mojo_media_application.cc (right): https://codereview.chromium.org/1200323003/diff/1/media/mojo/services/mojo_media_application.cc#newcode65 media/mojo/services/mojo_media_application.cc:65: &MojoMediaApplication::OnConnectionError, base::Unretained(this))); On 2015/06/24 03:03:31, sky wrote: > I'm ...
5 years, 6 months ago (2015-06-25 18:09:52 UTC) #7
xhwang
+jam, who added AppLifetimeHelper. jam: Shall we try to use AppLifetimeHelper for application lifetime management? ...
5 years, 6 months ago (2015-06-25 18:15:32 UTC) #9
xhwang
sky: I added a unittest and addressed all comments. PTAL again. https://codereview.chromium.org/1200323003/diff/1/media/mojo/services/mojo_media_application.cc File media/mojo/services/mojo_media_application.cc (right): ...
5 years, 6 months ago (2015-06-26 16:30:07 UTC) #10
sky
On 2015/06/25 18:15:32, xhwang wrote: > +jam, who added AppLifetimeHelper. > > jam: Shall we ...
5 years, 5 months ago (2015-06-29 14:49:50 UTC) #11
xhwang
On 2015/06/29 14:49:50, sky wrote: > On 2015/06/25 18:15:32, xhwang wrote: > > +jam, who ...
5 years, 5 months ago (2015-06-29 16:38:33 UTC) #12
xhwang
sky/jam: I guess I didn't really know how AddRefCount worked. Now I read it again ...
5 years, 5 months ago (2015-06-30 07:53:56 UTC) #13
sandersd (OOO until July 31)
Still lgtm, and we're getting close to an overall satisfactory solution. Thanks! https://codereview.chromium.org/1200323003/diff/80001/media/mojo/services/mojo_media_application.cc File media/mojo/services/mojo_media_application.cc ...
5 years, 5 months ago (2015-06-30 21:32:48 UTC) #14
xhwang
rebase only
5 years, 5 months ago (2015-07-07 20:11:53 UTC) #15
xhwang
comments addressed
5 years, 5 months ago (2015-07-07 20:29:10 UTC) #16
xhwang
https://codereview.chromium.org/1200323003/diff/80001/media/mojo/services/mojo_media_application.cc File media/mojo/services/mojo_media_application.cc (right): https://codereview.chromium.org/1200323003/diff/80001/media/mojo/services/mojo_media_application.cc#newcode20 media/mojo/services/mojo_media_application.cc:20: const char kFastAppDestruction[] = "fast-app-destruction"; On 2015/06/30 21:32:47, sandersd ...
5 years, 5 months ago (2015-07-07 20:29:24 UTC) #17
xhwang
rebase only
5 years, 5 months ago (2015-07-07 20:45:40 UTC) #18
xhwang
jam: PTAL since sky@ is OOO. rockot: FYI
5 years, 5 months ago (2015-07-07 21:02:22 UTC) #19
jam
why do we need a delay in applifetime helper? i.e. are you sure this optimization ...
5 years, 5 months ago (2015-07-08 21:15:37 UTC) #20
xhwang
On 2015/07/08 21:15:37, jam wrote: > why do we need a delay in applifetime helper? ...
5 years, 5 months ago (2015-07-08 21:47:38 UTC) #21
Ken Rockot(use gerrit already)
On 2015/07/08 21:47:38, xhwang wrote: > On 2015/07/08 21:15:37, jam wrote: > > why do ...
5 years, 5 months ago (2015-07-08 22:05:55 UTC) #22
jam
On 2015/07/08 22:05:55, Ken Rockot wrote: > On 2015/07/08 21:47:38, xhwang wrote: > > On ...
5 years, 5 months ago (2015-07-09 16:31:48 UTC) #23
xhwang
On 2015/07/09 16:31:48, jam wrote: > On 2015/07/08 22:05:55, Ken Rockot wrote: > > On ...
5 years, 5 months ago (2015-07-09 17:07:23 UTC) #24
jam
5 years, 5 months ago (2015-07-10 16:30:54 UTC) #25
On 2015/07/09 17:07:23, xhwang wrote:
> On 2015/07/09 16:31:48, jam wrote:
> > On 2015/07/08 22:05:55, Ken Rockot wrote:
> > > On 2015/07/08 21:47:38, xhwang wrote:
> > > > On 2015/07/08 21:15:37, jam wrote:
> > > > > why do we need a delay in applifetime helper? i.e. are you sure this
> > > > > optimization is necessary?
> > > > 
> > > > Good question. Say we are running the mojo media application in the
> utility
> > > > process. So when mojo media application is destroyed, the utility
process
> > will
> > > > be terminated immediately [1].
> > > > 
> > > > Now assume the JS app is playing episode 2 after episode 1. The JS app
> first
> > > > destroys the media element for episode 1, then creates a new media
element
> > for
> > > > episode 2. When the first media element is destroyed, it will disconnect
> the
> > > > mojo media service. Without delayed app destruction, we'll destroyed the
> app
> > > > immediately, which will destroy the utility process. Then when we create
> the
> > > > second media element, we'll restart a utility process and reload the
mojo
> > > media
> > > > app. I felt this is inefficient.
> > > > 
> > > > An alternative would be to delay the destruction of the utility process.
> But
> > I
> > > > felt the current approach is better since it also increases the chance
to
> > > reuse
> > > > the app (not just the process).
> > > > 
> > > > Currently we have 30s delay in destructing the PPAPI process when no
PPAPI
> > > > instance is created. This change is consistent with that as well.
> > > > 
> > > > [1]
> > > >
> > >
> >
>
https://code.google.com/p/chromium/codesearch#chromium/src/content/utility/ut...
> > > 
> > > It seems likely to me that frequent app startup/shutdown cycling will
become
> a
> > > common problem without some kind of timeout window like this.
> > > 
> > > Thinking about it some more though, maybe this is something that can be
> > > addressed by ApplicationManager policy rather than each individual app?
i.e.
> > the
> > > shell could impose a grace period between receiving QuitApplication from
an
> > app
> > > and issuing OnQuitRequested back to the app.
> > 
> > 
> > Yep I'm familiar with the NPAPI (and later PPAPI) case since I wrote that
> after
> > we noticed performance problems. Here I'm looking for data that we need
extra
> > complexity before adding it. The plugin case was different because Flash was
> > doing a lot of startup initialization. It's not clear to me that our apps
will
> > be slow to load (and if so, we need to make them load faster).
> 
> Thanks for the background info. 
> 
> Currently the media app is mostly a shell, it relies on platform specific
media
> renderers (including decoders) and CDMs to do the real work. So the load time
> will mostly depend on the those platform specific implementations. I don't
have
> any real data yet, but I should be able to collect data for the desktop case
> where we need to load the Widevine CDM. But note that the media app can be
used
> on different platforms where the platform specific implementations could be
very
> different. It's hard to make assumptions on the performance for all of them.
> 
> That being said, is the overhead of starting a new process a concern at all?

having some numbers to know the magnitude of the overhead is needed to reason
about this..

Powered by Google App Engine
This is Rietveld 408576698