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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 2456493003: Add frame-specific InterfaceProviderSpec. (Closed)
Patch Set: . Created 4 years, 1 month 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/child/child_thread_impl.h ('k') | content/common/frame.mojom » ('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 (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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 NOTREACHED(); 637 NOTREACHED();
638 } 638 }
639 639
640 ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() { 640 ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() {
641 return service_manager_connection_.get(); 641 return service_manager_connection_.get();
642 } 642 }
643 643
644 service_manager::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistry() { 644 service_manager::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistry() {
645 if (!interface_registry_.get()) { 645 if (!interface_registry_.get()) {
646 interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>( 646 interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>(
647 service_manager::Identity(), service_manager::InterfaceProviderSpec()); 647 service_manager::mojom::kServiceManager_ConnectorSpec);
648 } 648 }
649 return interface_registry_.get(); 649 return interface_registry_.get();
650 } 650 }
651 651
652 service_manager::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() { 652 service_manager::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() {
653 if (browser_connection_) 653 if (browser_connection_)
654 return browser_connection_->GetRemoteInterfaces(); 654 return browser_connection_->GetRemoteInterfaces();
655 655
656 if (!remote_interfaces_.get()) 656 if (!remote_interfaces_.get())
657 remote_interfaces_.reset(new service_manager::InterfaceProvider); 657 remote_interfaces_.reset(new service_manager::InterfaceProvider);
658 return remote_interfaces_.get(); 658 return remote_interfaces_.get();
659 } 659 }
660 660
661 const service_manager::ServiceInfo&
662 ChildThreadImpl::GetChildServiceInfo() const {
663 DCHECK(IsConnectedToBrowser());
664 return child_info_;
665 }
666
667 const service_manager::ServiceInfo&
668 ChildThreadImpl::GetBrowserServiceInfo() const {
669 DCHECK(IsConnectedToBrowser());
670 return browser_info_;
671 }
672
673 bool ChildThreadImpl::IsConnectedToBrowser() const {
674 return connected_to_browser_;
675 }
676
661 IPC::MessageRouter* ChildThreadImpl::GetRouter() { 677 IPC::MessageRouter* ChildThreadImpl::GetRouter() {
662 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread()); 678 DCHECK(message_loop_->task_runner()->BelongsToCurrentThread());
663 return &router_; 679 return &router_;
664 } 680 }
665 681
666 mojom::RouteProvider* ChildThreadImpl::GetRemoteRouteProvider() { 682 mojom::RouteProvider* ChildThreadImpl::GetRemoteRouteProvider() {
667 if (!remote_route_provider_) { 683 if (!remote_route_provider_) {
668 DCHECK(channel_); 684 DCHECK(channel_);
669 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); 685 channel_->GetRemoteAssociatedInterface(&remote_route_provider_);
670 } 686 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 760
745 if (msg.routing_id() == MSG_ROUTING_CONTROL) 761 if (msg.routing_id() == MSG_ROUTING_CONTROL)
746 return OnControlMessageReceived(msg); 762 return OnControlMessageReceived(msg);
747 763
748 return router_.OnMessageReceived(msg); 764 return router_.OnMessageReceived(msg);
749 } 765 }
750 766
751 void ChildThreadImpl::StartServiceManagerConnection() { 767 void ChildThreadImpl::StartServiceManagerConnection() {
752 DCHECK(service_manager_connection_); 768 DCHECK(service_manager_connection_);
753 service_manager_connection_->Start(); 769 service_manager_connection_->Start();
770 // We don't care about storing the id, since if this pipe closes we're toast.
771 service_manager_connection_->AddOnConnectHandler(
772 base::Bind(&ChildThreadImpl::OnServiceConnect,
773 weak_factory_.GetWeakPtr()));
754 } 774 }
755 775
756 bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { 776 bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
757 return false; 777 return false;
758 } 778 }
759 779
760 void ChildThreadImpl::OnProcessBackgrounded(bool backgrounded) { 780 void ChildThreadImpl::OnProcessBackgrounded(bool backgrounded) {
761 // Set timer slack to maximum on main thread when in background. 781 // Set timer slack to maximum on main thread when in background.
762 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; 782 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
763 if (backgrounded) 783 if (backgrounded)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 void ChildThreadImpl::GetAssociatedInterface( 867 void ChildThreadImpl::GetAssociatedInterface(
848 const std::string& name, 868 const std::string& name,
849 mojom::AssociatedInterfaceAssociatedRequest request) { 869 mojom::AssociatedInterfaceAssociatedRequest request) {
850 int32_t routing_id = static_cast<int32_t>(reinterpret_cast<uintptr_t>( 870 int32_t routing_id = static_cast<int32_t>(reinterpret_cast<uintptr_t>(
851 associated_interface_provider_bindings_.dispatch_context())); 871 associated_interface_provider_bindings_.dispatch_context()));
852 Listener* route = router_.GetRoute(routing_id); 872 Listener* route = router_.GetRoute(routing_id);
853 if (route) 873 if (route)
854 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); 874 route->OnAssociatedInterfaceRequest(name, request.PassHandle());
855 } 875 }
856 876
877 void ChildThreadImpl::OnServiceConnect(
878 const service_manager::ServiceInfo& local_info,
879 const service_manager::ServiceInfo& remote_info) {
880 if (remote_info.identity.name() != kBrowserServiceName)
881 return;
882 DCHECK(!connected_to_browser_);
883 connected_to_browser_ = true;
884 child_info_ = local_info;
885 browser_info_ = remote_info;
886 }
887
857 bool ChildThreadImpl::IsInBrowserProcess() const { 888 bool ChildThreadImpl::IsInBrowserProcess() const {
858 return static_cast<bool>(browser_process_io_runner_); 889 return static_cast<bool>(browser_process_io_runner_);
859 } 890 }
860 891
861 } // namespace content 892 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/common/frame.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698