OLD | NEW |
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 #ifndef MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ |
6 #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "media/mojo/interfaces/service_factory.mojom.h" | 10 #include "media/mojo/interfaces/service_factory.mojom.h" |
11 #include "mojo/shell/public/cpp/interface_factory_impl.h" | 11 #include "mojo/shell/public/cpp/interface_factory.h" |
| 12 #include "mojo/shell/public/cpp/message_loop_ref.h" |
12 #include "mojo/shell/public/cpp/shell_client.h" | 13 #include "mojo/shell/public/cpp/shell_client.h" |
13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
14 | 15 |
15 namespace media { | 16 namespace media { |
16 | 17 |
17 class MediaLog; | 18 class MediaLog; |
18 class MojoMediaClient; | 19 class MojoMediaClient; |
19 | 20 |
20 class MojoMediaApplication | 21 class MojoMediaApplication |
21 : public mojo::ShellClient, | 22 : public mojo::ShellClient, |
22 public mojo::InterfaceFactory<interfaces::ServiceFactory> { | 23 public mojo::InterfaceFactory<interfaces::ServiceFactory> { |
23 public: | 24 public: |
24 explicit MojoMediaApplication(scoped_ptr<MojoMediaClient> mojo_media_client); | 25 explicit MojoMediaApplication(scoped_ptr<MojoMediaClient> mojo_media_client); |
25 ~MojoMediaApplication() final; | 26 ~MojoMediaApplication() final; |
26 | 27 |
27 private: | 28 private: |
28 // mojo::ShellClient implementation. | 29 // mojo::ShellClient implementation. |
29 void Initialize(mojo::Shell* shell, | 30 void Initialize(mojo::Connector* connector, |
30 const std::string& url, | 31 const std::string& url, |
31 uint32_t id, | 32 uint32_t id, |
32 uint32_t user_id) final; | 33 uint32_t user_id) final; |
33 bool AcceptConnection(mojo::Connection* connection) final; | 34 bool AcceptConnection(mojo::Connection* connection) final; |
34 | 35 |
35 // mojo::InterfaceFactory<interfaces::ServiceFactory> implementation. | 36 // mojo::InterfaceFactory<interfaces::ServiceFactory> implementation. |
36 void Create(mojo::Connection* connection, | 37 void Create(mojo::Connection* connection, |
37 mojo::InterfaceRequest<interfaces::ServiceFactory> request) final; | 38 mojo::InterfaceRequest<interfaces::ServiceFactory> request) final; |
38 | 39 |
39 // Note: Since each instance runs on a different thread, do not share a common | 40 // Note: Since each instance runs on a different thread, do not share a common |
40 // MojoMediaClient with other instances to avoid threading issues. Hence using | 41 // MojoMediaClient with other instances to avoid threading issues. Hence using |
41 // a scoped_ptr here. | 42 // a scoped_ptr here. |
42 scoped_ptr<MojoMediaClient> mojo_media_client_; | 43 scoped_ptr<MojoMediaClient> mojo_media_client_; |
43 | 44 |
44 mojo::Shell* shell_; | 45 mojo::Connector* connector_; |
45 scoped_refptr<MediaLog> media_log_; | 46 scoped_refptr<MediaLog> media_log_; |
| 47 mojo::MessageLoopRefFactory ref_factory_; |
46 }; | 48 }; |
47 | 49 |
48 } // namespace media | 50 } // namespace media |
49 | 51 |
50 #endif // MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ | 52 #endif // MEDIA_MOJO_SERVICES_MOJO_MEDIA_APPLICATION_H_ |
OLD | NEW |