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

Unified Diff: mojo/common/mojo_channel_init.cc

Issue 236813002: Move Mojo channel initialization closer to IPC::Channel setup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more missing deps Created 6 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 | « mojo/common/mojo_channel_init.h ('k') | mojo/mojo.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/mojo_channel_init.cc
diff --git a/mojo/common/mojo_channel_init.cc b/mojo/common/mojo_channel_init.cc
deleted file mode 100644
index 96190f9d5d051fd33ad2152f3af075fe3be0ae76..0000000000000000000000000000000000000000
--- a/mojo/common/mojo_channel_init.cc
+++ /dev/null
@@ -1,59 +0,0 @@
-// 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 "mojo/common/mojo_channel_init.h"
-
-#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
-#include "mojo/embedder/embedder.h"
-
-namespace mojo {
-namespace common {
-
-MojoChannelInit::MojoChannelInit()
- : channel_info_(NULL),
- weak_factory_(this) {
-}
-
-MojoChannelInit::~MojoChannelInit() {
- bootstrap_message_pipe_.reset();
- if (channel_info_) {
- io_thread_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&mojo::embedder::DestroyChannelOnIOThread, channel_info_));
- }
-}
-
-void MojoChannelInit::Init(
- base::PlatformFile file,
- scoped_refptr<base::TaskRunner> io_thread_task_runner) {
- DCHECK(!io_thread_task_runner_.get()); // Should only init once.
- io_thread_task_runner_ = io_thread_task_runner;
- bootstrap_message_pipe_ = mojo::embedder::CreateChannel(
- mojo::embedder::ScopedPlatformHandle(
- mojo::embedder::PlatformHandle(file)),
- io_thread_task_runner,
- base::Bind(&MojoChannelInit::OnCreatedChannel, weak_factory_.GetWeakPtr(),
- io_thread_task_runner),
- base::MessageLoop::current()->message_loop_proxy()).Pass();
-}
-
-// static
-void MojoChannelInit::OnCreatedChannel(
- base::WeakPtr<MojoChannelInit> host,
- scoped_refptr<base::TaskRunner> io_thread,
- embedder::ChannelInfo* channel) {
- // By the time we get here |host| may have been destroyed. If so, shutdown the
- // channel.
- if (!host.get()) {
- io_thread->PostTask(
- FROM_HERE,
- base::Bind(&mojo::embedder::DestroyChannelOnIOThread, channel));
- return;
- }
- host->channel_info_ = channel;
-}
-
-} // namespace common
-} // namespace mojo
« no previous file with comments | « mojo/common/mojo_channel_init.h ('k') | mojo/mojo.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698