OLD | NEW |
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/shell/handle_watcher.h" | 5 #include "mojo/common/handle_watcher.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/message_loop/message_loop_proxy.h" | 15 #include "base/message_loop/message_loop_proxy.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "base/time/tick_clock.h" | 18 #include "base/time/tick_clock.h" |
19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
20 #include "mojo/shell/scoped_message_pipe.h" | 20 #include "mojo/common/scoped_message_pipe.h" |
21 | 21 |
22 namespace mojo { | 22 namespace mojo { |
23 namespace shell { | 23 namespace common { |
24 | 24 |
25 typedef int WatcherID; | 25 typedef int WatcherID; |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 const char kWatcherThreadName[] = "handle-watcher-thread"; | 29 const char kWatcherThreadName[] = "handle-watcher-thread"; |
30 | 30 |
31 // WatcherThreadManager -------------------------------------------------------- | 31 // WatcherThreadManager -------------------------------------------------------- |
32 | 32 |
33 // WatcherThreadManager manages listening for the handles. It is a singleton. It | 33 // WatcherThreadManager manages listening for the handles. It is a singleton. It |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 base::TimeTicks HandleWatcher::NowTicks() { | 389 base::TimeTicks HandleWatcher::NowTicks() { |
390 return tick_clock_ ? tick_clock_->NowTicks() : base::TimeTicks::Now(); | 390 return tick_clock_ ? tick_clock_->NowTicks() : base::TimeTicks::Now(); |
391 } | 391 } |
392 | 392 |
393 // static | 393 // static |
394 base::TimeTicks HandleWatcher::MojoDeadlineToTimeTicks(MojoDeadline deadline) { | 394 base::TimeTicks HandleWatcher::MojoDeadlineToTimeTicks(MojoDeadline deadline) { |
395 return deadline == MOJO_DEADLINE_INDEFINITE ? base::TimeTicks() : | 395 return deadline == MOJO_DEADLINE_INDEFINITE ? base::TimeTicks() : |
396 NowTicks() + base::TimeDelta::FromMicroseconds(deadline); | 396 NowTicks() + base::TimeDelta::FromMicroseconds(deadline); |
397 } | 397 } |
398 | 398 |
399 } // namespace shell | 399 } // namespace common |
400 } // namespace mojo | 400 } // namespace mojo |
OLD | NEW |