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

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
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index 45b0ec6d299da122f6ce29c251dfa1484294973f..eb827b42593eb3989c7d0b9de96b34f210bd8007 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -657,8 +657,8 @@ 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());
+ interface_registry_ =
+ base::MakeUnique<service_manager::InterfaceRegistry>();
}
return interface_registry_.get();
}
@@ -672,6 +672,16 @@ service_manager::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() {
return remote_interfaces_.get();
}
+const service_manager::ServiceInfo&
+ ChildThreadImpl::GetChildServiceInfo() const {
+ return child_info_;
+}
+
+const service_manager::ServiceInfo&
+ ChildThreadImpl::GetBrowserServiceInfo() const {
+ return browser_info_;
+}
+
IPC::MessageRouter* ChildThreadImpl::GetRouter() {
DCHECK(message_loop_->task_runner()->BelongsToCurrentThread());
return &router_;
@@ -765,6 +775,9 @@ 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::OnConnect, weak_factory_.GetWeakPtr()));
}
bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
@@ -868,6 +881,15 @@ void ChildThreadImpl::GetAssociatedInterface(
route->OnAssociatedInterfaceRequest(name, request.PassHandle());
}
+void ChildThreadImpl::OnConnect(
+ const service_manager::ServiceInfo& local_info,
+ const service_manager::ServiceInfo& remote_info) {
+ if (remote_info.identity.name() != kBrowserServiceName)
+ return;
+ child_info_ = local_info;
+ browser_info_ = remote_info;
+}
+
bool ChildThreadImpl::IsInBrowserProcess() const {
return static_cast<bool>(browser_process_io_runner_);
}

Powered by Google App Engine
This is Rietveld 408576698