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

Unified Diff: content/browser/mojo/mojo_application_host.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/browser/mojo/mojo_application_host.h ('k') | content/browser/utility_process_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/mojo/mojo_application_host.cc
diff --git a/content/browser/mojo/mojo_application_host.cc b/content/browser/mojo/mojo_application_host.cc
index c1103e15bbbc2e19d402bb0107b5203f55b3c63e..6456a943a53e2847ee157ee554a788a0d459a54c 100644
--- a/content/browser/mojo/mojo_application_host.cc
+++ b/content/browser/mojo/mojo_application_host.cc
@@ -10,6 +10,7 @@
#include "content/common/mojo/mojo_messages.h"
#include "content/public/browser/browser_thread.h"
#include "ipc/ipc_sender.h"
+#include "mojo/edk/embedder/embedder.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
namespace content {
@@ -84,6 +85,22 @@ void MojoApplicationHost::Activate(IPC::Sender* sender,
IPC::GetPlatformFileForTransit(client_file, true)));
}
+std::string MojoApplicationHost::InitWithToken() {
+ DCHECK(!client_handle_.is_valid()) << "Already initialized!";
+ DCHECK(!did_activate_);
+
+ std::string token = mojo::edk::GenerateRandomToken();
+ mojo::ScopedMessagePipeHandle pipe =
+ mojo::edk::CreateParentMessagePipe(token);
+ DCHECK(pipe.is_valid());
+ application_setup_.reset(new ApplicationSetupImpl(
+ &service_registry_,
+ mojo::MakeRequest<mojom::ApplicationSetup>(std::move(pipe))));
+
+ did_activate_ = true;
+ return token;
+}
+
void MojoApplicationHost::OverrideIOTaskRunnerForTest(
scoped_refptr<base::TaskRunner> io_task_runner) {
io_task_runner_override_ = io_task_runner;
« no previous file with comments | « content/browser/mojo/mojo_application_host.h ('k') | content/browser/utility_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698