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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 mojo::edk::SetParentPipeHandle(std::move(platform_channel)); | 260 mojo::edk::SetParentPipeHandle(std::move(platform_channel)); |
261 } | 261 } |
262 | 262 |
263 class ChannelBootstrapFilter : public ConnectionFilter { | 263 class ChannelBootstrapFilter : public ConnectionFilter { |
264 public: | 264 public: |
265 explicit ChannelBootstrapFilter(IPC::mojom::ChannelBootstrapPtrInfo bootstrap) | 265 explicit ChannelBootstrapFilter(IPC::mojom::ChannelBootstrapPtrInfo bootstrap) |
266 : bootstrap_(std::move(bootstrap)) {} | 266 : bootstrap_(std::move(bootstrap)) {} |
267 | 267 |
268 private: | 268 private: |
269 // ConnectionFilter: | 269 // ConnectionFilter: |
270 void OnBindInterface(const service_manager::ServiceInfo& source_info, | 270 void OnBindInterface(const service_manager::BindSourceInfo& source_info, |
271 const std::string& interface_name, | 271 const std::string& interface_name, |
272 mojo::ScopedMessagePipeHandle* interface_pipe, | 272 mojo::ScopedMessagePipeHandle* interface_pipe, |
273 service_manager::Connector* connector) override { | 273 service_manager::Connector* connector) override { |
274 if (source_info.identity.name() != mojom::kBrowserServiceName) | 274 if (source_info.identity.name() != mojom::kBrowserServiceName) |
275 return; | 275 return; |
276 | 276 |
277 if (interface_name == IPC::mojom::ChannelBootstrap::Name_) { | 277 if (interface_name == IPC::mojom::ChannelBootstrap::Name_) { |
278 DCHECK(bootstrap_.is_valid()); | 278 DCHECK(bootstrap_.is_valid()); |
279 mojo::FuseInterface(mojo::MakeRequest<IPC::mojom::ChannelBootstrap>( | 279 mojo::FuseInterface(mojo::MakeRequest<IPC::mojom::ChannelBootstrap>( |
280 std::move(*interface_pipe)), | 280 std::move(*interface_pipe)), |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 } | 624 } |
625 | 625 |
626 ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() { | 626 ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() { |
627 return service_manager_connection_.get(); | 627 return service_manager_connection_.get(); |
628 } | 628 } |
629 | 629 |
630 service_manager::Connector* ChildThreadImpl::GetConnector() { | 630 service_manager::Connector* ChildThreadImpl::GetConnector() { |
631 return service_manager_connection_->GetConnector(); | 631 return service_manager_connection_->GetConnector(); |
632 } | 632 } |
633 | 633 |
634 const service_manager::ServiceInfo& | 634 const service_manager::BindSourceInfo& ChildThreadImpl::GetBrowserServiceInfo() |
635 ChildThreadImpl::GetChildServiceInfo() const { | 635 const { |
636 DCHECK(IsConnectedToBrowser()); | |
637 return child_info_; | |
638 } | |
639 | |
640 const service_manager::ServiceInfo& | |
641 ChildThreadImpl::GetBrowserServiceInfo() const { | |
642 DCHECK(IsConnectedToBrowser()); | 636 DCHECK(IsConnectedToBrowser()); |
643 return browser_info_; | 637 return browser_info_; |
644 } | 638 } |
645 | 639 |
646 bool ChildThreadImpl::IsConnectedToBrowser() const { | 640 bool ChildThreadImpl::IsConnectedToBrowser() const { |
647 return connected_to_browser_; | 641 return connected_to_browser_; |
648 } | 642 } |
649 | 643 |
650 IPC::MessageRouter* ChildThreadImpl::GetRouter() { | 644 IPC::MessageRouter* ChildThreadImpl::GetRouter() { |
651 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread()); | 645 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread()); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 const std::string& name, | 831 const std::string& name, |
838 mojom::AssociatedInterfaceAssociatedRequest request) { | 832 mojom::AssociatedInterfaceAssociatedRequest request) { |
839 int32_t routing_id = | 833 int32_t routing_id = |
840 associated_interface_provider_bindings_.dispatch_context(); | 834 associated_interface_provider_bindings_.dispatch_context(); |
841 Listener* route = router_.GetRoute(routing_id); | 835 Listener* route = router_.GetRoute(routing_id); |
842 if (route) | 836 if (route) |
843 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); | 837 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); |
844 } | 838 } |
845 | 839 |
846 void ChildThreadImpl::OnServiceConnect( | 840 void ChildThreadImpl::OnServiceConnect( |
847 const service_manager::ServiceInfo& local_info, | 841 const service_manager::BindSourceInfo& remote_info) { |
848 const service_manager::ServiceInfo& remote_info) { | |
849 if (remote_info.identity.name() != mojom::kBrowserServiceName) | 842 if (remote_info.identity.name() != mojom::kBrowserServiceName) |
850 return; | 843 return; |
851 DCHECK(!connected_to_browser_); | 844 DCHECK(!connected_to_browser_); |
852 connected_to_browser_ = true; | 845 connected_to_browser_ = true; |
853 child_info_ = local_info; | |
854 browser_info_ = remote_info; | 846 browser_info_ = remote_info; |
855 } | 847 } |
856 | 848 |
857 bool ChildThreadImpl::IsInBrowserProcess() const { | 849 bool ChildThreadImpl::IsInBrowserProcess() const { |
858 return static_cast<bool>(browser_process_io_runner_); | 850 return static_cast<bool>(browser_process_io_runner_); |
859 } | 851 } |
860 | 852 |
861 } // namespace content | 853 } // namespace content |
OLD | NEW |