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

Unified Diff: content/browser/mojo/mojo_application_host.cc

Issue 1585493002: [mojo] Ports EDK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/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 12895d5c35336b261916132d8e37ab19838c7530..1f568efdb69eec5b4e6f7dccc3d79a1faf6ea61c 100644
--- a/content/browser/mojo/mojo_application_host.cc
+++ b/content/browser/mojo/mojo_application_host.cc
@@ -50,7 +50,7 @@ class ApplicationSetupImpl : public ApplicationSetup {
} // namespace
MojoApplicationHost::MojoApplicationHost()
- : did_activate_(false) {
+ : did_activate_(false), weak_factory_(this) {
#if defined(OS_ANDROID)
service_registry_android_.reset(
new ServiceRegistryAndroid(&service_registry_));
@@ -74,18 +74,15 @@ bool MojoApplicationHost::Init() {
->task_runner();
}
- mojo::ScopedMessagePipeHandle message_pipe = channel_init_.Init(
- PlatformFileFromScopedPlatformHandle(channel_pair.PassServerHandle()),
- io_task_runner);
- if (!message_pipe.is_valid())
- return false;
-
// Forward this to the client once we know its process handle.
client_handle_ = channel_pair.PassClientHandle();
- application_setup_.reset(new ApplicationSetupImpl(
- &service_registry_,
- mojo::MakeRequest<ApplicationSetup>(std::move(message_pipe))));
+ channel_init_.Init(
+ PlatformFileFromScopedPlatformHandle(channel_pair.PassServerHandle()),
+ io_task_runner,
+ base::Bind(&MojoApplicationHost::OnMessagePipeCreated,
+ weak_factory_.GetWeakPtr()));
+
return true;
}
@@ -109,4 +106,12 @@ void MojoApplicationHost::OverrideIOTaskRunnerForTest(
io_task_runner_override_ = io_task_runner;
}
+void MojoApplicationHost::OnMessagePipeCreated(
+ mojo::ScopedMessagePipeHandle pipe) {
+ DCHECK(pipe.is_valid());
+ application_setup_.reset(new ApplicationSetupImpl(
+ &service_registry_,
+ mojo::MakeRequest<ApplicationSetup>(std::move(pipe))));
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698