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

Side by Side Diff: media/mojo/services/mojo_media_application.h

Issue 1200323003: media: Quit MojoMediaApplication when no service is bound. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/cancelable_callback.h"
5 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
6 #include "media/mojo/interfaces/content_decryption_module.mojom.h" 7 #include "media/mojo/interfaces/content_decryption_module.mojom.h"
7 #include "media/mojo/interfaces/media_renderer.mojom.h" 8 #include "media/mojo/interfaces/media_renderer.mojom.h"
8 #include "media/mojo/services/mojo_cdm_service_context.h" 9 #include "media/mojo/services/mojo_cdm_service_context.h"
9 #include "mojo/application/public/cpp/application_delegate.h" 10 #include "mojo/application/public/cpp/application_delegate.h"
10 #include "mojo/application/public/cpp/interface_factory_impl.h" 11 #include "mojo/application/public/cpp/interface_factory_impl.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
13 namespace media { 14 namespace media {
14 15
15 class MojoMediaApplication 16 class MojoMediaApplication
16 : public mojo::ApplicationDelegate, 17 : public mojo::ApplicationDelegate,
17 public mojo::InterfaceFactory<mojo::ContentDecryptionModule>, 18 public mojo::InterfaceFactory<mojo::ContentDecryptionModule>,
18 public mojo::InterfaceFactory<mojo::MediaRenderer> { 19 public mojo::InterfaceFactory<mojo::MediaRenderer> {
19 public: 20 public:
20 static GURL AppUrl(); 21 static GURL AppUrl();
21 static scoped_ptr<mojo::ApplicationDelegate> CreateApp(); 22 static scoped_ptr<mojo::ApplicationDelegate> CreateApp();
22 23
23 MojoMediaApplication(); 24 MojoMediaApplication();
24 ~MojoMediaApplication() final; 25 ~MojoMediaApplication() final;
25 26
26 private: 27 private:
27 // mojo::ApplicationDelegate implementation. 28 // mojo::ApplicationDelegate implementation.
28 void Initialize(mojo::ApplicationImpl* app) final; 29 void Initialize(mojo::ApplicationImpl* app) final;
29 bool ConfigureIncomingConnection( 30 bool ConfigureIncomingConnection(
30 mojo::ApplicationConnection* connection) final; 31 mojo::ApplicationConnection* connection) final;
32 void Quit() final;
31 33
32 // mojo::InterfaceFactory<mojo::ContentDecryptionModule> implementation. 34 // mojo::InterfaceFactory<mojo::ContentDecryptionModule> implementation.
33 void Create( 35 void Create(
34 mojo::ApplicationConnection* connection, 36 mojo::ApplicationConnection* connection,
35 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request) final; 37 mojo::InterfaceRequest<mojo::ContentDecryptionModule> request) final;
36 38
37 // mojo::InterfaceFactory<mojo::MediaRenderer> implementation. 39 // mojo::InterfaceFactory<mojo::MediaRenderer> implementation.
38 void Create(mojo::ApplicationConnection* connection, 40 void Create(mojo::ApplicationConnection* connection,
39 mojo::InterfaceRequest<mojo::MediaRenderer> request) final; 41 mojo::InterfaceRequest<mojo::MediaRenderer> request) final;
40 42
43 // Sets the app for destruction after a period of idle time. If any top-level
44 // services (e.g. CDM) are bound before the timeout elapses, it's canceled.
45 void StartIdleTimer();
46
47 void OnConnectionError();
48
41 MojoCdmServiceContext cdm_service_context_; 49 MojoCdmServiceContext cdm_service_context_;
50 mojo::ApplicationImpl* app_impl_;
51 size_t active_service_count_;
52
53 // Callback used to shut down the app after a period of inactivity.
54 base::CancelableClosure idle_timeout_callback_;
42 }; 55 };
sky 2015/06/24 03:03:31 DISALLOW_...
xhwang 2015/06/26 16:30:07 Done.
43 56
44 } // namespace media 57 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698