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

Unified Diff: ipc/mojo/ipc_channel_mojo_host.cc

Issue 553283002: IPC::ChannelMojo: Introduce IPC::MojoBootstrap for Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed build error Created 6 years, 3 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 | « ipc/mojo/ipc_channel_mojo_host.h ('k') | ipc/mojo/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_channel_mojo_host.cc
diff --git a/ipc/mojo/ipc_channel_mojo_host.cc b/ipc/mojo/ipc_channel_mojo_host.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4318a15f54379e5fb568ebd15735eb313b2ebf14
--- /dev/null
+++ b/ipc/mojo/ipc_channel_mojo_host.cc
@@ -0,0 +1,47 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ipc/mojo/ipc_channel_mojo_host.h"
+
+#include "base/bind.h"
+#include "base/message_loop/message_loop.h"
+#include "ipc/mojo/ipc_channel_mojo.h"
+
+namespace IPC {
+
+ChannelMojoHost::ChannelMojoHost(scoped_refptr<base::TaskRunner> task_runner)
+ : weak_factory_(this), task_runner_(task_runner), channel_(NULL) {
+}
+
+ChannelMojoHost::~ChannelMojoHost() {
+}
+
+void ChannelMojoHost::OnClientLaunched(base::ProcessHandle process) {
+ if (task_runner_ == base::MessageLoop::current()->message_loop_proxy()) {
+ InvokeOnClientLaunched(process);
+ } else {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&ChannelMojoHost::InvokeOnClientLaunched,
+ weak_factory_.GetWeakPtr(),
+ process));
+ }
+}
+
+void ChannelMojoHost::InvokeOnClientLaunched(base::ProcessHandle process) {
+ if (!channel_)
+ return;
+ channel_->OnClientLaunched(process);
+}
+
+void ChannelMojoHost::OnChannelCreated(ChannelMojo* channel) {
+ DCHECK(channel_ == NULL);
+ channel_ = channel;
+}
+
+void ChannelMojoHost::OnChannelDestroyed() {
+ DCHECK(channel_ != NULL);
+ channel_ = NULL;
+}
+
+} // namespace IPC
« no previous file with comments | « ipc/mojo/ipc_channel_mojo_host.h ('k') | ipc/mojo/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698