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

Side by Side Diff: ipc/mojo/ipc_channel_mojo_host.cc

Issue 1127153003: ipc: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « ipc/mojo/ipc_channel_mojo.cc ('k') | ipc/mojo/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ipc/mojo/ipc_channel_mojo_host.h" 5 #include "ipc/mojo/ipc_channel_mojo_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
9 #include "ipc/mojo/ipc_channel_mojo.h" 10 #include "ipc/mojo/ipc_channel_mojo.h"
10 11
11 namespace IPC { 12 namespace IPC {
12 13
13 class ChannelMojoHost::ChannelDelegateTraits { 14 class ChannelMojoHost::ChannelDelegateTraits {
14 public: 15 public:
15 static void Destruct(const ChannelMojoHost::ChannelDelegate* ptr); 16 static void Destruct(const ChannelMojoHost::ChannelDelegate* ptr);
16 }; 17 };
17 18
18 // The delete class lives on the IO thread to talk to ChannelMojo on 19 // The delete class lives on the IO thread to talk to ChannelMojo on
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 scoped_refptr<base::SequencedTaskRunner> io_task_runner) 91 scoped_refptr<base::SequencedTaskRunner> io_task_runner)
91 : io_task_runner_(io_task_runner), 92 : io_task_runner_(io_task_runner),
92 channel_delegate_(new ChannelDelegate(io_task_runner)), 93 channel_delegate_(new ChannelDelegate(io_task_runner)),
93 weak_factory_(this) { 94 weak_factory_(this) {
94 } 95 }
95 96
96 ChannelMojoHost::~ChannelMojoHost() { 97 ChannelMojoHost::~ChannelMojoHost() {
97 } 98 }
98 99
99 void ChannelMojoHost::OnClientLaunched(base::ProcessHandle process) { 100 void ChannelMojoHost::OnClientLaunched(base::ProcessHandle process) {
100 if (io_task_runner_ == base::MessageLoop::current()->message_loop_proxy()) { 101 if (io_task_runner_ == base::MessageLoop::current()->task_runner()) {
101 channel_delegate_->OnClientLaunched(process); 102 channel_delegate_->OnClientLaunched(process);
102 } else { 103 } else {
103 io_task_runner_->PostTask(FROM_HERE, 104 io_task_runner_->PostTask(FROM_HERE,
104 base::Bind(&ChannelDelegate::OnClientLaunched, 105 base::Bind(&ChannelDelegate::OnClientLaunched,
105 channel_delegate_, process)); 106 channel_delegate_, process));
106 } 107 }
107 } 108 }
108 109
109 ChannelMojo::Delegate* ChannelMojoHost::channel_delegate() const { 110 ChannelMojo::Delegate* ChannelMojoHost::channel_delegate() const {
110 return channel_delegate_.get(); 111 return channel_delegate_.get();
111 } 112 }
112 113
113 // static 114 // static
114 void ChannelMojoHost::ChannelDelegateTraits::Destruct( 115 void ChannelMojoHost::ChannelDelegateTraits::Destruct(
115 const ChannelMojoHost::ChannelDelegate* ptr) { 116 const ChannelMojoHost::ChannelDelegate* ptr) {
116 ptr->DeleteThisSoon(); 117 ptr->DeleteThisSoon();
117 } 118 }
118 119
119 } // namespace IPC 120 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/mojo/ipc_channel_mojo.cc ('k') | ipc/mojo/ipc_channel_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698