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

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

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_SERVICE_FACTORY_IMPL_H_ 5 #ifndef MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_
6 #define MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_ 6 #define MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "media/mojo/interfaces/service_factory.mojom.h" 11 #include "media/mojo/interfaces/service_factory.mojom.h"
12 #include "media/mojo/services/mojo_cdm_service_context.h" 12 #include "media/mojo/services/mojo_cdm_service_context.h"
13 #include "mojo/public/cpp/bindings/strong_binding.h"
14 #include "services/shell/public/cpp/connector.h" 13 #include "services/shell/public/cpp/connector.h"
15 #include "services/shell/public/cpp/service_context_ref.h" 14 #include "services/shell/public/cpp/service_context_ref.h"
16 15
17 namespace shell { 16 namespace shell {
18 namespace mojom { 17 namespace mojom {
19 class InterfaceProvider; 18 class InterfaceProvider;
20 } 19 }
21 } 20 }
22 21
23 namespace media { 22 namespace media {
24 23
25 class CdmFactory; 24 class CdmFactory;
26 class MediaLog; 25 class MediaLog;
27 class MojoMediaClient; 26 class MojoMediaClient;
28 class RendererFactory; 27 class RendererFactory;
29 28
30 class ServiceFactoryImpl : public mojom::ServiceFactory { 29 class ServiceFactoryImpl : public mojom::ServiceFactory {
31 public: 30 public:
32 ServiceFactoryImpl(mojo::InterfaceRequest<mojom::ServiceFactory> request, 31 ServiceFactoryImpl(shell::mojom::InterfaceProviderPtr interfaces,
33 shell::mojom::InterfaceProviderPtr interfaces,
34 scoped_refptr<MediaLog> media_log, 32 scoped_refptr<MediaLog> media_log,
35 std::unique_ptr<shell::ServiceContextRef> connection_ref, 33 std::unique_ptr<shell::ServiceContextRef> connection_ref,
36 MojoMediaClient* mojo_media_client); 34 MojoMediaClient* mojo_media_client);
37 ~ServiceFactoryImpl() final; 35 ~ServiceFactoryImpl() final;
38 36
39 // mojom::ServiceFactory implementation. 37 // mojom::ServiceFactory implementation.
40 void CreateAudioDecoder(mojom::AudioDecoderRequest request) final; 38 void CreateAudioDecoder(mojom::AudioDecoderRequest request) final;
41 void CreateVideoDecoder(mojom::VideoDecoderRequest request) final; 39 void CreateVideoDecoder(mojom::VideoDecoderRequest request) final;
42 void CreateRenderer(const mojo::String& audio_device_id, 40 void CreateRenderer(const mojo::String& audio_device_id,
43 mojom::RendererRequest request) final; 41 mojom::RendererRequest request) final;
44 void CreateCdm(mojom::ContentDecryptionModuleRequest request) final; 42 void CreateCdm(mojom::ContentDecryptionModuleRequest request) final;
45 43
46 private: 44 private:
47 #if defined(ENABLE_MOJO_RENDERER) 45 #if defined(ENABLE_MOJO_RENDERER)
48 RendererFactory* GetRendererFactory(); 46 RendererFactory* GetRendererFactory();
49 #endif // defined(ENABLE_MOJO_RENDERER) 47 #endif // defined(ENABLE_MOJO_RENDERER)
50 48
51 #if defined(ENABLE_MOJO_CDM) 49 #if defined(ENABLE_MOJO_CDM)
52 CdmFactory* GetCdmFactory(); 50 CdmFactory* GetCdmFactory();
53 #endif // defined(ENABLE_MOJO_CDM) 51 #endif // defined(ENABLE_MOJO_CDM)
54 52
55 MojoCdmServiceContext cdm_service_context_; 53 MojoCdmServiceContext cdm_service_context_;
56 mojo::StrongBinding<mojom::ServiceFactory> binding_;
57 54
58 #if defined(ENABLE_MOJO_RENDERER) 55 #if defined(ENABLE_MOJO_RENDERER)
59 std::unique_ptr<RendererFactory> renderer_factory_; 56 std::unique_ptr<RendererFactory> renderer_factory_;
60 #endif // defined(ENABLE_MOJO_RENDERER) 57 #endif // defined(ENABLE_MOJO_RENDERER)
61 58
62 #if defined(ENABLE_MOJO_CDM) 59 #if defined(ENABLE_MOJO_CDM)
63 std::unique_ptr<CdmFactory> cdm_factory_; 60 std::unique_ptr<CdmFactory> cdm_factory_;
64 shell::mojom::InterfaceProviderPtr interfaces_; 61 shell::mojom::InterfaceProviderPtr interfaces_;
65 #endif // defined(ENABLE_MOJO_CDM) 62 #endif // defined(ENABLE_MOJO_CDM)
66 63
67 scoped_refptr<MediaLog> media_log_; 64 scoped_refptr<MediaLog> media_log_;
68 std::unique_ptr<shell::ServiceContextRef> connection_ref_; 65 std::unique_ptr<shell::ServiceContextRef> connection_ref_;
69 MojoMediaClient* mojo_media_client_; 66 MojoMediaClient* mojo_media_client_;
70 67
71 DISALLOW_COPY_AND_ASSIGN(ServiceFactoryImpl); 68 DISALLOW_COPY_AND_ASSIGN(ServiceFactoryImpl);
72 }; 69 };
73 70
74 } // namespace media 71 } // namespace media
75 72
76 #endif // MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_ 73 #endif // MEDIA_MOJO_SERVICES_SERVICE_FACTORY_IMPL_H_
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_video_decoder_service.cc ('k') | media/mojo/services/service_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698