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

Unified Diff: content/child/child_thread_impl.cc

Issue 2456493003: Add frame-specific InterfaceProviderSpec. (Closed)
Patch Set: . Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/common/frame.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index 8cd4f524326e5182e999e7e0ac34761c1e8a23ac..2bcb5e49ee44329da081ddf4b52953c946df0536 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -644,7 +644,7 @@ ServiceManagerConnection* ChildThreadImpl::GetServiceManagerConnection() {
service_manager::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistry() {
if (!interface_registry_.get()) {
interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>(
- service_manager::Identity(), service_manager::InterfaceProviderSpec());
+ service_manager::mojom::kServiceManager_ConnectorSpec);
}
return interface_registry_.get();
}
@@ -658,6 +658,22 @@ service_manager::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() {
return remote_interfaces_.get();
}
+const service_manager::ServiceInfo&
+ ChildThreadImpl::GetChildServiceInfo() const {
+ DCHECK(IsConnectedToBrowser());
+ return child_info_;
+}
+
+const service_manager::ServiceInfo&
+ ChildThreadImpl::GetBrowserServiceInfo() const {
+ DCHECK(IsConnectedToBrowser());
+ return browser_info_;
+}
+
+bool ChildThreadImpl::IsConnectedToBrowser() const {
+ return connected_to_browser_;
+}
+
IPC::MessageRouter* ChildThreadImpl::GetRouter() {
DCHECK(message_loop_->task_runner()->BelongsToCurrentThread());
return &router_;
@@ -751,6 +767,10 @@ bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) {
void ChildThreadImpl::StartServiceManagerConnection() {
DCHECK(service_manager_connection_);
service_manager_connection_->Start();
+ // We don't care about storing the id, since if this pipe closes we're toast.
+ service_manager_connection_->AddOnConnectHandler(
+ base::Bind(&ChildThreadImpl::OnServiceConnect,
+ weak_factory_.GetWeakPtr()));
}
bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
@@ -854,6 +874,17 @@ void ChildThreadImpl::GetAssociatedInterface(
route->OnAssociatedInterfaceRequest(name, request.PassHandle());
}
+void ChildThreadImpl::OnServiceConnect(
+ const service_manager::ServiceInfo& local_info,
+ const service_manager::ServiceInfo& remote_info) {
+ if (remote_info.identity.name() != kBrowserServiceName)
+ return;
+ DCHECK(!connected_to_browser_);
+ connected_to_browser_ = true;
+ child_info_ = local_info;
+ browser_info_ = remote_info;
+}
+
bool ChildThreadImpl::IsInBrowserProcess() const {
return static_cast<bool>(browser_process_io_runner_);
}
« 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