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

Side by Side Diff: content/utility/utility_service_factory.cc

Issue 2867213004: [Mojo Video Capture] Hook up video capture service behind a feature flag (Closed)
Patch Set: Rebase to May 19th Created 3 years, 7 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
« no previous file with comments | « content/utility/DEPS ('k') | media/capture/video/video_capture_system.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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 "services/data_decoder/data_decoder_service.h" 17 #include "services/data_decoder/data_decoder_service.h"
18 #include "services/data_decoder/public/interfaces/constants.mojom.h" 18 #include "services/data_decoder/public/interfaces/constants.mojom.h"
19 #include "services/shape_detection/public/interfaces/constants.mojom.h" 19 #include "services/shape_detection/public/interfaces/constants.mojom.h"
20 #include "services/shape_detection/shape_detection_service.h" 20 #include "services/shape_detection/shape_detection_service.h"
21 #include "services/video_capture/public/interfaces/constants.mojom.h"
22 #include "services/video_capture/service_impl.h"
21 23
22 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) 24 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS)
23 #include "media/mojo/services/media_service_factory.h" // nogncheck 25 #include "media/mojo/services/media_service_factory.h" // nogncheck
24 #endif 26 #endif
25 27
28 namespace {
29
30 std::unique_ptr<service_manager::Service> CreateVideoCaptureService() {
31 return base::MakeUnique<video_capture::ServiceImpl>();
32 }
33
34 } // anonymous namespace
35
26 namespace content { 36 namespace content {
27 37
28 namespace { 38 namespace {
29 39
30 std::unique_ptr<service_manager::Service> CreateDataDecoderService() { 40 std::unique_ptr<service_manager::Service> CreateDataDecoderService() {
31 content::UtilityThread::Get()->EnsureBlinkInitialized(); 41 content::UtilityThread::Get()->EnsureBlinkInitialized();
32 return data_decoder::DataDecoderService::Create(); 42 return data_decoder::DataDecoderService::Create();
33 } 43 }
34 44
35 } // namespace 45 } // namespace
36 46
37 UtilityServiceFactory::UtilityServiceFactory() 47 UtilityServiceFactory::UtilityServiceFactory()
38 : network_registry_(base::MakeUnique<service_manager::BinderRegistry>()) {} 48 : network_registry_(base::MakeUnique<service_manager::BinderRegistry>()) {}
39 49
40 UtilityServiceFactory::~UtilityServiceFactory() {} 50 UtilityServiceFactory::~UtilityServiceFactory() {}
41 51
42 void UtilityServiceFactory::RegisterServices(ServiceMap* services) { 52 void UtilityServiceFactory::RegisterServices(ServiceMap* services) {
43 GetContentClient()->utility()->RegisterServices(services); 53 GetContentClient()->utility()->RegisterServices(services);
44 54
55 ServiceInfo video_capture_info;
56 video_capture_info.factory = base::Bind(&CreateVideoCaptureService);
57 services->insert(
58 std::make_pair(video_capture::mojom::kServiceName, video_capture_info));
59
45 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) 60 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS)
46 ServiceInfo info; 61 ServiceInfo info;
47 info.factory = base::Bind(&media::CreateMediaService); 62 info.factory = base::Bind(&media::CreateMediaService);
48 services->insert(std::make_pair("media", info)); 63 services->insert(std::make_pair("media", info));
49 #endif 64 #endif
50 ServiceInfo shape_detection_info; 65 ServiceInfo shape_detection_info;
51 shape_detection_info.factory = 66 shape_detection_info.factory =
52 base::Bind(&shape_detection::ShapeDetectionService::Create); 67 base::Bind(&shape_detection::ShapeDetectionService::Create);
53 services->insert(std::make_pair(shape_detection::mojom::kServiceName, 68 services->insert(std::make_pair(shape_detection::mojom::kServiceName,
54 shape_detection_info)); 69 shape_detection_info));
(...skipping 26 matching lines...) Expand all
81 utility_thread->Shutdown(); 96 utility_thread->Shutdown();
82 utility_thread->ReleaseProcessIfNeeded(); 97 utility_thread->ReleaseProcessIfNeeded();
83 } 98 }
84 99
85 std::unique_ptr<service_manager::Service> 100 std::unique_ptr<service_manager::Service>
86 UtilityServiceFactory::CreateNetworkService() { 101 UtilityServiceFactory::CreateNetworkService() {
87 return base::MakeUnique<NetworkService>(std::move(network_registry_)); 102 return base::MakeUnique<NetworkService>(std::move(network_registry_));
88 } 103 }
89 104
90 } // namespace content 105 } // namespace content
OLDNEW
« no previous file with comments | « content/utility/DEPS ('k') | media/capture/video/video_capture_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698