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/browser/service_manager/service_manager_context.h" | 5 #include "content/browser/service_manager/service_manager_context.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 #include "services/data_decoder/public/interfaces/constants.mojom.h" | 42 #include "services/data_decoder/public/interfaces/constants.mojom.h" |
43 #include "services/device/device_service.h" | 43 #include "services/device/device_service.h" |
44 #include "services/device/public/interfaces/constants.mojom.h" | 44 #include "services/device/public/interfaces/constants.mojom.h" |
45 #include "services/service_manager/connect_params.h" | 45 #include "services/service_manager/connect_params.h" |
46 #include "services/service_manager/public/cpp/connector.h" | 46 #include "services/service_manager/public/cpp/connector.h" |
47 #include "services/service_manager/public/cpp/service.h" | 47 #include "services/service_manager/public/cpp/service.h" |
48 #include "services/service_manager/public/interfaces/service.mojom.h" | 48 #include "services/service_manager/public/interfaces/service.mojom.h" |
49 #include "services/service_manager/runner/common/client_util.h" | 49 #include "services/service_manager/runner/common/client_util.h" |
50 #include "services/service_manager/service_manager.h" | 50 #include "services/service_manager/service_manager.h" |
51 #include "services/shape_detection/public/interfaces/constants.mojom.h" | 51 #include "services/shape_detection/public/interfaces/constants.mojom.h" |
52 #include "services/video_capture/public/interfaces/constants.mojom.h" | |
52 | 53 |
53 namespace content { | 54 namespace content { |
54 | 55 |
55 namespace { | 56 namespace { |
56 | 57 |
57 base::LazyInstance<std::unique_ptr<service_manager::Connector>>::Leaky | 58 base::LazyInstance<std::unique_ptr<service_manager::Connector>>::Leaky |
58 g_io_thread_connector = LAZY_INSTANCE_INITIALIZER; | 59 g_io_thread_connector = LAZY_INSTANCE_INITIALIZER; |
59 | 60 |
60 void DestroyConnectorOnIOThread() { g_io_thread_connector.Get().reset(); } | 61 void DestroyConnectorOnIOThread() { g_io_thread_connector.Get().reset(); } |
61 | 62 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 ->RegisterUnsandboxedOutOfProcessServices(&unsandboxed_services); | 337 ->RegisterUnsandboxedOutOfProcessServices(&unsandboxed_services); |
337 | 338 |
338 bool network_service_enabled = | 339 bool network_service_enabled = |
339 base::CommandLine::ForCurrentProcess()->HasSwitch( | 340 base::CommandLine::ForCurrentProcess()->HasSwitch( |
340 switches::kEnableNetworkService); | 341 switches::kEnableNetworkService); |
341 if (network_service_enabled) { | 342 if (network_service_enabled) { |
342 unsandboxed_services.insert( | 343 unsandboxed_services.insert( |
343 std::make_pair(content::mojom::kNetworkServiceName, | 344 std::make_pair(content::mojom::kNetworkServiceName, |
344 base::ASCIIToUTF16("Network Service"))); | 345 base::ASCIIToUTF16("Network Service"))); |
345 } | 346 } |
347 unsandboxed_services.insert( | |
mcasas
2017/05/10 02:33:33
Shouldn't we have a command line check like in l.3
chfremer
2017/05/10 17:59:40
You are right. Unless the feature is enabled, we d
| |
348 std::make_pair(video_capture::mojom::kServiceName, | |
349 base::ASCIIToUTF16("Video Capture Service"))); | |
346 | 350 |
347 for (const auto& service : unsandboxed_services) { | 351 for (const auto& service : unsandboxed_services) { |
348 packaged_services_connection_->AddServiceRequestHandler( | 352 packaged_services_connection_->AddServiceRequestHandler( |
349 service.first, base::Bind(&StartServiceInUtilityProcess, service.first, | 353 service.first, base::Bind(&StartServiceInUtilityProcess, service.first, |
350 service.second, false /* use_sandbox */)); | 354 service.second, false /* use_sandbox */)); |
351 } | 355 } |
352 | 356 |
353 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | 357 #if (ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
354 packaged_services_connection_->AddServiceRequestHandler( | 358 packaged_services_connection_->AddServiceRequestHandler( |
355 "media", base::Bind(&StartServiceInGpuProcess, "media")); | 359 "media", base::Bind(&StartServiceInGpuProcess, "media")); |
(...skipping 30 matching lines...) Expand all Loading... | |
386 base::Bind(&DestroyConnectorOnIOThread)); | 390 base::Bind(&DestroyConnectorOnIOThread)); |
387 } | 391 } |
388 | 392 |
389 // static | 393 // static |
390 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { | 394 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { |
391 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 395 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
392 return g_io_thread_connector.Get().get(); | 396 return g_io_thread_connector.Get().get(); |
393 } | 397 } |
394 | 398 |
395 } // namespace content | 399 } // namespace content |
OLD | NEW |