| 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 "media/mojo/features.h" |
| 18 #include "services/data_decoder/data_decoder_service.h" | 18 #include "services/data_decoder/data_decoder_service.h" |
| 19 #include "services/data_decoder/public/interfaces/constants.mojom.h" | 19 #include "services/data_decoder/public/interfaces/constants.mojom.h" |
| 20 #include "services/shape_detection/public/interfaces/constants.mojom.h" | 20 #include "services/shape_detection/public/interfaces/constants.mojom.h" |
| 21 #include "services/shape_detection/shape_detection_service.h" | 21 #include "services/shape_detection/shape_detection_service.h" |
| 22 #include "services/video_capture/public/interfaces/constants.mojom.h" |
| 23 #include "services/video_capture/service_impl.h" |
| 22 | 24 |
| 23 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) | 25 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) |
| 24 #include "media/mojo/services/media_service_factory.h" // nogncheck | 26 #include "media/mojo/services/media_service_factory.h" // nogncheck |
| 25 #endif | 27 #endif |
| 26 | 28 |
| 29 namespace { |
| 30 |
| 31 std::unique_ptr<service_manager::Service> CreateVideoCaptureService() { |
| 32 return base::MakeUnique<video_capture::ServiceImpl>(); |
| 33 } |
| 34 |
| 35 } // anonymous namespace |
| 36 |
| 27 namespace content { | 37 namespace content { |
| 28 | 38 |
| 29 namespace { | 39 namespace { |
| 30 | 40 |
| 31 std::unique_ptr<service_manager::Service> CreateDataDecoderService() { | 41 std::unique_ptr<service_manager::Service> CreateDataDecoderService() { |
| 32 content::UtilityThread::Get()->EnsureBlinkInitialized(); | 42 content::UtilityThread::Get()->EnsureBlinkInitialized(); |
| 33 return data_decoder::DataDecoderService::Create(); | 43 return data_decoder::DataDecoderService::Create(); |
| 34 } | 44 } |
| 35 | 45 |
| 36 } // namespace | 46 } // namespace |
| 37 | 47 |
| 38 UtilityServiceFactory::UtilityServiceFactory() | 48 UtilityServiceFactory::UtilityServiceFactory() |
| 39 : network_registry_(base::MakeUnique<service_manager::BinderRegistry>()) {} | 49 : network_registry_(base::MakeUnique<service_manager::BinderRegistry>()) {} |
| 40 | 50 |
| 41 UtilityServiceFactory::~UtilityServiceFactory() {} | 51 UtilityServiceFactory::~UtilityServiceFactory() {} |
| 42 | 52 |
| 43 void UtilityServiceFactory::RegisterServices(ServiceMap* services) { | 53 void UtilityServiceFactory::RegisterServices(ServiceMap* services) { |
| 44 GetContentClient()->utility()->RegisterServices(services); | 54 GetContentClient()->utility()->RegisterServices(services); |
| 45 | 55 |
| 56 ServiceInfo video_capture_info; |
| 57 video_capture_info.factory = base::Bind(&CreateVideoCaptureService); |
| 58 services->insert( |
| 59 std::make_pair(video_capture::mojom::kServiceName, video_capture_info)); |
| 60 |
| 46 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) | 61 #if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) |
| 47 ServiceInfo info; | 62 ServiceInfo info; |
| 48 info.factory = base::Bind(&media::CreateMediaService); | 63 info.factory = base::Bind(&media::CreateMediaService); |
| 49 services->insert(std::make_pair("media", info)); | 64 services->insert(std::make_pair("media", info)); |
| 50 #endif | 65 #endif |
| 51 | 66 |
| 52 ServiceInfo shape_detection_info; | 67 ServiceInfo shape_detection_info; |
| 53 shape_detection_info.factory = | 68 shape_detection_info.factory = |
| 54 base::Bind(&shape_detection::ShapeDetectionService::Create); | 69 base::Bind(&shape_detection::ShapeDetectionService::Create); |
| 55 services->insert(std::make_pair(shape_detection::mojom::kServiceName, | 70 services->insert(std::make_pair(shape_detection::mojom::kServiceName, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 83 utility_thread->Shutdown(); | 98 utility_thread->Shutdown(); |
| 84 utility_thread->ReleaseProcessIfNeeded(); | 99 utility_thread->ReleaseProcessIfNeeded(); |
| 85 } | 100 } |
| 86 | 101 |
| 87 std::unique_ptr<service_manager::Service> | 102 std::unique_ptr<service_manager::Service> |
| 88 UtilityServiceFactory::CreateNetworkService() { | 103 UtilityServiceFactory::CreateNetworkService() { |
| 89 return base::MakeUnique<NetworkService>(std::move(network_registry_)); | 104 return base::MakeUnique<NetworkService>(std::move(network_registry_)); |
| 90 } | 105 } |
| 91 | 106 |
| 92 } // namespace content | 107 } // namespace content |
| OLD | NEW |