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" | |
74 #include "services/service_manager/runner/common/client_util.h" | 73 #include "services/service_manager/runner/common/client_util.h" |
75 | 74 |
76 #if defined(OS_POSIX) | 75 #if defined(OS_POSIX) |
77 #include "base/posix/global_descriptors.h" | 76 #include "base/posix/global_descriptors.h" |
78 #include "content/public/common/content_descriptors.h" | 77 #include "content/public/common/content_descriptors.h" |
79 #endif | 78 #endif |
80 | 79 |
81 #if defined(OS_MACOSX) | 80 #if defined(OS_MACOSX) |
82 #include "base/allocator/allocator_interception_mac.h" | 81 #include "base/allocator/allocator_interception_mac.h" |
83 #endif | 82 #endif |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 } else { | 443 } else { |
445 service_request_token = options.in_process_service_request_token; | 444 service_request_token = options.in_process_service_request_token; |
446 } | 445 } |
447 if (!service_request_token.empty()) { | 446 if (!service_request_token.empty()) { |
448 mojo::ScopedMessagePipeHandle handle = | 447 mojo::ScopedMessagePipeHandle handle = |
449 mojo::edk::CreateChildMessagePipe(service_request_token); | 448 mojo::edk::CreateChildMessagePipe(service_request_token); |
450 DCHECK(handle.is_valid()); | 449 DCHECK(handle.is_valid()); |
451 service_manager_connection_ = ServiceManagerConnection::Create( | 450 service_manager_connection_ = ServiceManagerConnection::Create( |
452 mojo::MakeRequest<service_manager::mojom::Service>(std::move(handle)), | 451 mojo::MakeRequest<service_manager::mojom::Service>(std::move(handle)), |
453 GetIOTaskRunner()); | 452 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); | |
461 } | 453 } |
462 | 454 |
463 sync_message_filter_ = channel_->CreateSyncMessageFilter(); | 455 sync_message_filter_ = channel_->CreateSyncMessageFilter(); |
464 thread_safe_sender_ = new ThreadSafeSender( | 456 thread_safe_sender_ = new ThreadSafeSender( |
465 message_loop_->task_runner(), sync_message_filter_.get()); | 457 message_loop_->task_runner(), sync_message_filter_.get()); |
466 | 458 |
467 resource_dispatcher_.reset(new ResourceDispatcher( | 459 resource_dispatcher_.reset(new ResourceDispatcher( |
468 this, message_loop()->task_runner())); | 460 this, message_loop()->task_runner())); |
469 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 461 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
470 | 462 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 } | 622 } |
631 | 623 |
632 void ChildThreadImpl::RecordComputedAction(const std::string& action) { | 624 void ChildThreadImpl::RecordComputedAction(const std::string& action) { |
633 NOTREACHED(); | 625 NOTREACHED(); |
634 } | 626 } |
635 | 627 |
636 ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() { | 628 ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() { |
637 return service_manager_connection_.get(); | 629 return service_manager_connection_.get(); |
638 } | 630 } |
639 | 631 |
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 | |
648 service_manager::Connector* ChildThreadImpl::GetConnector() { | 632 service_manager::Connector* ChildThreadImpl::GetConnector() { |
649 return service_manager_connection_->GetConnector(); | 633 return service_manager_connection_->GetConnector(); |
650 } | 634 } |
651 | 635 |
652 const service_manager::ServiceInfo& | 636 const service_manager::ServiceInfo& |
653 ChildThreadImpl::GetChildServiceInfo() const { | 637 ChildThreadImpl::GetChildServiceInfo() const { |
654 DCHECK(IsConnectedToBrowser()); | 638 DCHECK(IsConnectedToBrowser()); |
655 return child_info_; | 639 return child_info_; |
656 } | 640 } |
657 | 641 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 connected_to_browser_ = true; | 854 connected_to_browser_ = true; |
871 child_info_ = local_info; | 855 child_info_ = local_info; |
872 browser_info_ = remote_info; | 856 browser_info_ = remote_info; |
873 } | 857 } |
874 | 858 |
875 bool ChildThreadImpl::IsInBrowserProcess() const { | 859 bool ChildThreadImpl::IsInBrowserProcess() const { |
876 return static_cast<bool>(browser_process_io_runner_); | 860 return static_cast<bool>(browser_process_io_runner_); |
877 } | 861 } |
878 | 862 |
879 } // namespace content | 863 } // namespace content |
OLD | NEW |