OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/child/child_thread_impl.h" | 5 #include "content/child/child_thread_impl.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "mojo/edk/embedder/named_platform_channel_pair.h" | 63 #include "mojo/edk/embedder/named_platform_channel_pair.h" |
64 #include "mojo/edk/embedder/platform_channel_pair.h" | 64 #include "mojo/edk/embedder/platform_channel_pair.h" |
65 #include "mojo/edk/embedder/scoped_ipc_support.h" | 65 #include "mojo/edk/embedder/scoped_ipc_support.h" |
66 #include "mojo/public/cpp/system/buffer.h" | 66 #include "mojo/public/cpp/system/buffer.h" |
67 #include "mojo/public/cpp/system/platform_handle.h" | 67 #include "mojo/public/cpp/system/platform_handle.h" |
68 #include "services/device/public/cpp/power_monitor/power_monitor_broadcast_sourc
e.h" | 68 #include "services/device/public/cpp/power_monitor/power_monitor_broadcast_sourc
e.h" |
69 #include "services/resource_coordinator/public/cpp/memory/memory_dump_manager_de
legate_impl.h" | 69 #include "services/resource_coordinator/public/cpp/memory/memory_dump_manager_de
legate_impl.h" |
70 #include "services/service_manager/public/cpp/connector.h" | 70 #include "services/service_manager/public/cpp/connector.h" |
71 #include "services/service_manager/public/cpp/interface_factory.h" | 71 #include "services/service_manager/public/cpp/interface_factory.h" |
72 #include "services/service_manager/public/cpp/interface_provider.h" | 72 #include "services/service_manager/public/cpp/interface_provider.h" |
| 73 #include "services/service_manager/public/cpp/interface_registry.h" |
73 #include "services/service_manager/runner/common/client_util.h" | 74 #include "services/service_manager/runner/common/client_util.h" |
74 | 75 |
75 #if defined(OS_POSIX) | 76 #if defined(OS_POSIX) |
76 #include "base/posix/global_descriptors.h" | 77 #include "base/posix/global_descriptors.h" |
77 #include "content/public/common/content_descriptors.h" | 78 #include "content/public/common/content_descriptors.h" |
78 #endif | 79 #endif |
79 | 80 |
80 #if defined(OS_MACOSX) | 81 #if defined(OS_MACOSX) |
81 #include "base/allocator/allocator_interception_mac.h" | 82 #include "base/allocator/allocator_interception_mac.h" |
82 #endif | 83 #endif |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 } else { | 444 } else { |
444 service_request_token = options.in_process_service_request_token; | 445 service_request_token = options.in_process_service_request_token; |
445 } | 446 } |
446 if (!service_request_token.empty()) { | 447 if (!service_request_token.empty()) { |
447 mojo::ScopedMessagePipeHandle handle = | 448 mojo::ScopedMessagePipeHandle handle = |
448 mojo::edk::CreateChildMessagePipe(service_request_token); | 449 mojo::edk::CreateChildMessagePipe(service_request_token); |
449 DCHECK(handle.is_valid()); | 450 DCHECK(handle.is_valid()); |
450 service_manager_connection_ = ServiceManagerConnection::Create( | 451 service_manager_connection_ = ServiceManagerConnection::Create( |
451 mojo::MakeRequest<service_manager::mojom::Service>(std::move(handle)), | 452 mojo::MakeRequest<service_manager::mojom::Service>(std::move(handle)), |
452 GetIOTaskRunner()); | 453 GetIOTaskRunner()); |
| 454 |
| 455 // TODO(rockot): Remove this once all child-to-browser interface connections |
| 456 // are made via a Connector rather than directly through an |
| 457 // InterfaceProvider, and all exposed interfaces are exposed via a |
| 458 // ConnectionFilter. |
| 459 service_manager_connection_->SetupInterfaceRequestProxies( |
| 460 GetInterfaceRegistry(), nullptr); |
453 } | 461 } |
454 | 462 |
455 sync_message_filter_ = channel_->CreateSyncMessageFilter(); | 463 sync_message_filter_ = channel_->CreateSyncMessageFilter(); |
456 thread_safe_sender_ = new ThreadSafeSender( | 464 thread_safe_sender_ = new ThreadSafeSender( |
457 message_loop_->task_runner(), sync_message_filter_.get()); | 465 message_loop_->task_runner(), sync_message_filter_.get()); |
458 | 466 |
459 resource_dispatcher_.reset(new ResourceDispatcher( | 467 resource_dispatcher_.reset(new ResourceDispatcher( |
460 this, message_loop()->task_runner())); | 468 this, message_loop()->task_runner())); |
461 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 469 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
462 | 470 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 } | 630 } |
623 | 631 |
624 void ChildThreadImpl::RecordComputedAction(const std::string& action) { | 632 void ChildThreadImpl::RecordComputedAction(const std::string& action) { |
625 NOTREACHED(); | 633 NOTREACHED(); |
626 } | 634 } |
627 | 635 |
628 ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() { | 636 ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() { |
629 return service_manager_connection_.get(); | 637 return service_manager_connection_.get(); |
630 } | 638 } |
631 | 639 |
| 640 service_manager::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistry() { |
| 641 if (!interface_registry_.get()) { |
| 642 interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>( |
| 643 service_manager::mojom::kServiceManager_ConnectorSpec); |
| 644 } |
| 645 return interface_registry_.get(); |
| 646 } |
| 647 |
632 service_manager::Connector* ChildThreadImpl::GetConnector() { | 648 service_manager::Connector* ChildThreadImpl::GetConnector() { |
633 return service_manager_connection_->GetConnector(); | 649 return service_manager_connection_->GetConnector(); |
634 } | 650 } |
635 | 651 |
636 const service_manager::ServiceInfo& | 652 const service_manager::ServiceInfo& |
637 ChildThreadImpl::GetChildServiceInfo() const { | 653 ChildThreadImpl::GetChildServiceInfo() const { |
638 DCHECK(IsConnectedToBrowser()); | 654 DCHECK(IsConnectedToBrowser()); |
639 return child_info_; | 655 return child_info_; |
640 } | 656 } |
641 | 657 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 connected_to_browser_ = true; | 870 connected_to_browser_ = true; |
855 child_info_ = local_info; | 871 child_info_ = local_info; |
856 browser_info_ = remote_info; | 872 browser_info_ = remote_info; |
857 } | 873 } |
858 | 874 |
859 bool ChildThreadImpl::IsInBrowserProcess() const { | 875 bool ChildThreadImpl::IsInBrowserProcess() const { |
860 return static_cast<bool>(browser_process_io_runner_); | 876 return static_cast<bool>(browser_process_io_runner_); |
861 } | 877 } |
862 | 878 |
863 } // namespace content | 879 } // namespace content |
OLD | NEW |