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

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

Issue 1676913002: [mojo] Delete third_party/mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: let's try that again Created 4 years, 10 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/DEPS ('k') | ipc/mojo/ipc_channel_mojo.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/async_handle_waiter.h" 5 #include "ipc/mojo/async_handle_waiter.h"
6 6
7 #include "base/atomic_ref_count.h" 7 #include "base/atomic_ref_count.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" 13 #include "mojo/edk/embedder/embedder.h"
14 14
15 namespace IPC { 15 namespace IPC {
16 namespace internal { 16 namespace internal {
17 17
18 class AsyncHandleWaiterContextTraits { 18 class AsyncHandleWaiterContextTraits {
19 public: 19 public:
20 static void Destruct(const AsyncHandleWaiter::Context* context); 20 static void Destruct(const AsyncHandleWaiter::Context* context);
21 }; 21 };
22 22
23 // The thread-safe part of |AsyncHandleWaiter|. 23 // The thread-safe part of |AsyncHandleWaiter|.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 : callback_(callback), 135 : callback_(callback),
136 weak_factory_(this) { 136 weak_factory_(this) {
137 context_ = new Context(weak_factory_.GetWeakPtr()); 137 context_ = new Context(weak_factory_.GetWeakPtr());
138 } 138 }
139 139
140 AsyncHandleWaiter::~AsyncHandleWaiter() { 140 AsyncHandleWaiter::~AsyncHandleWaiter() {
141 } 141 }
142 142
143 MojoResult AsyncHandleWaiter::Wait(MojoHandle handle, 143 MojoResult AsyncHandleWaiter::Wait(MojoHandle handle,
144 MojoHandleSignals signals) { 144 MojoHandleSignals signals) {
145 return mojo::embedder::AsyncWait( 145 return mojo::edk::AsyncWait(handle, signals,
146 handle, signals, base::Bind(&Context::HandleIsReady, context_)); 146 base::Bind(&Context::HandleIsReady, context_));
147 } 147 }
148 148
149 void AsyncHandleWaiter::InvokeCallback(MojoResult result) { 149 void AsyncHandleWaiter::InvokeCallback(MojoResult result) {
150 callback_.Run(result); 150 callback_.Run(result);
151 } 151 }
152 152
153 base::MessageLoopForIO::IOObserver* AsyncHandleWaiter::GetIOObserverForTest() { 153 base::MessageLoopForIO::IOObserver* AsyncHandleWaiter::GetIOObserverForTest() {
154 return context_.get(); 154 return context_.get();
155 } 155 }
156 156
157 base::Callback<void(MojoResult)> AsyncHandleWaiter::GetWaitCallbackForTest() { 157 base::Callback<void(MojoResult)> AsyncHandleWaiter::GetWaitCallbackForTest() {
158 return base::Bind(&Context::HandleIsReady, context_); 158 return base::Bind(&Context::HandleIsReady, context_);
159 } 159 }
160 160
161 // static 161 // static
162 void AsyncHandleWaiterContextTraits::Destruct( 162 void AsyncHandleWaiterContextTraits::Destruct(
163 const AsyncHandleWaiter::Context* context) { 163 const AsyncHandleWaiter::Context* context) {
164 context->io_runner_->PostTask( 164 context->io_runner_->PostTask(
165 FROM_HERE, 165 FROM_HERE,
166 base::Bind(&base::DeletePointer<const AsyncHandleWaiter::Context>, 166 base::Bind(&base::DeletePointer<const AsyncHandleWaiter::Context>,
167 base::Unretained(context))); 167 base::Unretained(context)));
168 } 168 }
169 169
170 } // namespace internal 170 } // namespace internal
171 } // namespace IPC 171 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/mojo/DEPS ('k') | ipc/mojo/ipc_channel_mojo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698