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/common/message_pump_mojo.h" | 5 #include "mojo/common/message_pump_mojo.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "mojo/common/message_pump_mojo_handler.h" | 13 #include "mojo/common/message_pump_mojo_handler.h" |
14 #include "mojo/common/time_helper.h" | 14 #include "mojo/common/time_helper.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace common { | 17 namespace common { |
18 | 18 |
19 // State needed for one iteration of WaitMany. The first handle and flags | 19 // State needed for one iteration of WaitMany. The first handle and flags |
20 // corresponds to that of the control pipe. | 20 // corresponds to that of the control pipe. |
21 struct MessagePumpMojo::WaitState { | 21 struct MessagePumpMojo::WaitState { |
22 std::vector<Handle> handles; | 22 std::vector<Handle> handles; |
23 std::vector<MojoWaitFlags> wait_flags; | 23 std::vector<MojoWaitFlags> wait_flags; |
24 }; | 24 }; |
25 | 25 |
26 struct MessagePumpMojo::RunState { | 26 struct MessagePumpMojo::RunState { |
27 RunState() : should_quit(false) { | 27 RunState() : should_quit(false) { |
28 CreateMessagePipe(&read_handle, &write_handle); | 28 CreateMessagePipe(NULL, &read_handle, &write_handle); |
29 } | 29 } |
30 | 30 |
31 base::TimeTicks delayed_work_time; | 31 base::TimeTicks delayed_work_time; |
32 | 32 |
33 // Used to wake up WaitForWork(). | 33 // Used to wake up WaitForWork(). |
34 ScopedMessagePipeHandle read_handle; | 34 ScopedMessagePipeHandle read_handle; |
35 ScopedMessagePipeHandle write_handle; | 35 ScopedMessagePipeHandle write_handle; |
36 | 36 |
37 bool should_quit; | 37 bool should_quit; |
38 }; | 38 }; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 min_time = i->second.deadline; | 234 min_time = i->second.deadline; |
235 } | 235 } |
236 return min_time.is_null() ? MOJO_DEADLINE_INDEFINITE : | 236 return min_time.is_null() ? MOJO_DEADLINE_INDEFINITE : |
237 std::max(static_cast<MojoDeadline>(0), | 237 std::max(static_cast<MojoDeadline>(0), |
238 static_cast<MojoDeadline>( | 238 static_cast<MojoDeadline>( |
239 (min_time - internal::NowTicks()).InMicroseconds())); | 239 (min_time - internal::NowTicks()).InMicroseconds())); |
240 } | 240 } |
241 | 241 |
242 } // namespace common | 242 } // namespace common |
243 } // namespace mojo | 243 } // namespace mojo |
OLD | NEW |