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

Side by Side Diff: mojo/common/handle_watcher.cc

Issue 93793009: Implement ServiceManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow Android to be built Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/common/handle_watcher.h" 5 #include "mojo/common/handle_watcher.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 MojoWaitFlags wait_flags, 190 MojoWaitFlags wait_flags,
191 base::TimeTicks deadline, 191 base::TimeTicks deadline,
192 const base::Callback<void(MojoResult)>& callback) { 192 const base::Callback<void(MojoResult)>& callback) {
193 WatchData data; 193 WatchData data;
194 data.id = watcher_id_generator_.GetNext(); 194 data.id = watcher_id_generator_.GetNext();
195 data.handle = handle; 195 data.handle = handle;
196 data.callback = callback; 196 data.callback = callback;
197 data.wait_flags = wait_flags; 197 data.wait_flags = wait_flags;
198 data.deadline = deadline; 198 data.deadline = deadline;
199 data.message_loop = base::MessageLoopProxy::current(); 199 data.message_loop = base::MessageLoopProxy::current();
200 DCHECK_NE(static_cast<base::MessageLoopProxy*>(NULL), data.message_loop);
200 // We outlive |thread_|, so it's safe to use Unretained() here. 201 // We outlive |thread_|, so it's safe to use Unretained() here.
201 thread_.message_loop()->PostTask( 202 thread_.message_loop()->PostTask(
202 FROM_HERE, 203 FROM_HERE,
203 base::Bind(&WatcherBackend::StartWatching, 204 base::Bind(&WatcherBackend::StartWatching,
204 base::Unretained(&backend_), 205 base::Unretained(&backend_),
205 data)); 206 data));
206 return data.id; 207 return data.id;
207 } 208 }
208 209
209 void WatcherThreadManager::StopWatching(WatcherID watcher_id) { 210 void WatcherThreadManager::StopWatching(WatcherID watcher_id) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 308 }
308 309
309 // static 310 // static
310 base::TimeTicks HandleWatcher::MojoDeadlineToTimeTicks(MojoDeadline deadline) { 311 base::TimeTicks HandleWatcher::MojoDeadlineToTimeTicks(MojoDeadline deadline) {
311 return deadline == MOJO_DEADLINE_INDEFINITE ? base::TimeTicks() : 312 return deadline == MOJO_DEADLINE_INDEFINITE ? base::TimeTicks() :
312 NowTicks() + base::TimeDelta::FromMicroseconds(deadline); 313 NowTicks() + base::TimeDelta::FromMicroseconds(deadline);
313 } 314 }
314 315
315 } // namespace common 316 } // namespace common
316 } // namespace mojo 317 } // namespace mojo
OLDNEW
« no previous file with comments | « build/android/adb_run_mojo_shell ('k') | mojo/examples/sample_app/native_viewport_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698