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

Unified Diff: content/child/mojo/mojo_application.cc

Issue 1877743002: Use token-based initialisation for the utility process MojoApplication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Always use token init. Created 4 years, 8 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/mojo/mojo_application.h ('k') | content/common/in_process_child_thread_params.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/mojo/mojo_application.cc
diff --git a/content/child/mojo/mojo_application.cc b/content/child/mojo/mojo_application.cc
index cd369d3d541e95437d3f0a4fc197adde0138ece7..0864424b94070799f4514b23e80a82fbb5bf5db7 100644
--- a/content/child/mojo/mojo_application.cc
+++ b/content/child/mojo/mojo_application.cc
@@ -12,6 +12,7 @@
#include "content/common/mojo/channel_init.h"
#include "content/common/mojo/mojo_messages.h"
#include "ipc/ipc_message.h"
+#include "mojo/edk/embedder/embedder.h"
#include "mojo/public/cpp/bindings/interface_ptr.h"
namespace content {
@@ -34,6 +35,23 @@ bool MojoApplication::OnMessageReceived(const IPC::Message& msg) {
return handled;
}
+void MojoApplication::InitWithToken(std::string token) {
+ mojo::ScopedMessagePipeHandle handle =
+ mojo::edk::CreateChildMessagePipe(token);
+ DCHECK(handle.is_valid());
+
+ mojom::ApplicationSetupPtr application_setup;
+ application_setup.Bind(
+ mojo::InterfacePtrInfo<mojom::ApplicationSetup>(std::move(handle), 0u));
+
+ mojo::shell::mojom::InterfaceProviderPtr services;
+ mojo::shell::mojom::InterfaceProviderPtr exposed_services;
+ service_registry_.Bind(GetProxy(&exposed_services));
+ application_setup->ExchangeInterfaceProviders(GetProxy(&services),
+ std::move(exposed_services));
+ service_registry_.BindRemoteServiceProvider(std::move(services));
+}
+
void MojoApplication::OnActivate(
const IPC::PlatformFileForTransit& file) {
#if defined(OS_POSIX)
« no previous file with comments | « content/child/mojo/mojo_application.h ('k') | content/common/in_process_child_thread_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698