OLD | NEW |
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 #include "content/utility/utility_service_factory.h" | 5 #include "content/utility/utility_service_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "content/child/child_process.h" | 9 #include "content/child/child_process.h" |
10 #include "content/network/network_service.h" | 10 #include "content/network/network_service.h" |
11 #include "content/public/common/content_client.h" | 11 #include "content/public/common/content_client.h" |
12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
13 #include "content/public/common/service_names.mojom.h" | 13 #include "content/public/common/service_names.mojom.h" |
14 #include "content/public/utility/content_utility_client.h" | 14 #include "content/public/utility/content_utility_client.h" |
15 #include "content/public/utility/utility_thread.h" | 15 #include "content/public/utility/utility_thread.h" |
16 #include "content/utility/utility_thread_impl.h" | 16 #include "content/utility/utility_thread_impl.h" |
| 17 #include "media/mojo/features.h" |
17 #include "services/data_decoder/data_decoder_service.h" | 18 #include "services/data_decoder/data_decoder_service.h" |
18 #include "services/data_decoder/public/interfaces/constants.mojom.h" | 19 #include "services/data_decoder/public/interfaces/constants.mojom.h" |
19 #include "services/shape_detection/public/interfaces/constants.mojom.h" | 20 #include "services/shape_detection/public/interfaces/constants.mojom.h" |
20 #include "services/shape_detection/shape_detection_service.h" | 21 #include "services/shape_detection/shape_detection_service.h" |
21 #include "services/video_capture/public/interfaces/constants.mojom.h" | 22 #include "services/video_capture/public/interfaces/constants.mojom.h" |
22 #include "services/video_capture/service_impl.h" | 23 #include "services/video_capture/service_impl.h" |
23 | 24 |
24 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) | 25 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) |
25 #include "media/mojo/services/media_service_factory.h" // nogncheck | 26 #include "media/mojo/services/media_service_factory.h" // nogncheck |
26 #endif | 27 #endif |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 std::unique_ptr<service_manager::Service> CreateVideoCaptureService() { | 31 std::unique_ptr<service_manager::Service> CreateVideoCaptureService() { |
31 return base::MakeUnique<video_capture::ServiceImpl>(); | 32 return base::MakeUnique<video_capture::ServiceImpl>(); |
32 } | 33 } |
33 | 34 |
34 } // anonymous namespace | 35 } // anonymous namespace |
(...skipping 15 matching lines...) Expand all Loading... |
50 UtilityServiceFactory::~UtilityServiceFactory() {} | 51 UtilityServiceFactory::~UtilityServiceFactory() {} |
51 | 52 |
52 void UtilityServiceFactory::RegisterServices(ServiceMap* services) { | 53 void UtilityServiceFactory::RegisterServices(ServiceMap* services) { |
53 GetContentClient()->utility()->RegisterServices(services); | 54 GetContentClient()->utility()->RegisterServices(services); |
54 | 55 |
55 ServiceInfo video_capture_info; | 56 ServiceInfo video_capture_info; |
56 video_capture_info.factory = base::Bind(&CreateVideoCaptureService); | 57 video_capture_info.factory = base::Bind(&CreateVideoCaptureService); |
57 services->insert( | 58 services->insert( |
58 std::make_pair(video_capture::mojom::kServiceName, video_capture_info)); | 59 std::make_pair(video_capture::mojom::kServiceName, video_capture_info)); |
59 | 60 |
60 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) | 61 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) |
61 ServiceInfo info; | 62 ServiceInfo info; |
62 info.factory = base::Bind(&media::CreateMediaService); | 63 info.factory = base::Bind(&media::CreateMediaService); |
63 services->insert(std::make_pair("media", info)); | 64 services->insert(std::make_pair("media", info)); |
64 #endif | 65 #endif |
| 66 |
65 ServiceInfo shape_detection_info; | 67 ServiceInfo shape_detection_info; |
66 shape_detection_info.factory = | 68 shape_detection_info.factory = |
67 base::Bind(&shape_detection::ShapeDetectionService::Create); | 69 base::Bind(&shape_detection::ShapeDetectionService::Create); |
68 services->insert(std::make_pair(shape_detection::mojom::kServiceName, | 70 services->insert(std::make_pair(shape_detection::mojom::kServiceName, |
69 shape_detection_info)); | 71 shape_detection_info)); |
70 | 72 |
71 ServiceInfo data_decoder_info; | 73 ServiceInfo data_decoder_info; |
72 data_decoder_info.factory = base::Bind(&CreateDataDecoderService); | 74 data_decoder_info.factory = base::Bind(&CreateDataDecoderService); |
73 services->insert( | 75 services->insert( |
74 std::make_pair(data_decoder::mojom::kServiceName, data_decoder_info)); | 76 std::make_pair(data_decoder::mojom::kServiceName, data_decoder_info)); |
(...skipping 21 matching lines...) Expand all Loading... |
96 utility_thread->Shutdown(); | 98 utility_thread->Shutdown(); |
97 utility_thread->ReleaseProcessIfNeeded(); | 99 utility_thread->ReleaseProcessIfNeeded(); |
98 } | 100 } |
99 | 101 |
100 std::unique_ptr<service_manager::Service> | 102 std::unique_ptr<service_manager::Service> |
101 UtilityServiceFactory::CreateNetworkService() { | 103 UtilityServiceFactory::CreateNetworkService() { |
102 return base::MakeUnique<NetworkService>(std::move(network_registry_)); | 104 return base::MakeUnique<NetworkService>(std::move(network_registry_)); |
103 } | 105 } |
104 | 106 |
105 } // namespace content | 107 } // namespace content |
OLD | NEW |