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 #ifndef MOJO_COMMON_MESSAGE_PUMP_MOJO_H_ | 5 #ifndef MOJO_COMMON_MESSAGE_PUMP_MOJO_H_ |
6 #define MOJO_COMMON_MESSAGE_PUMP_MOJO_H_ | 6 #define MOJO_COMMON_MESSAGE_PUMP_MOJO_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
| 10 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop/message_pump.h" | 12 #include "base/message_loop/message_pump.h" |
12 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
14 #include "mojo/common/mojo_common_export.h" | 15 #include "mojo/common/mojo_common_export.h" |
15 #include "mojo/public/cpp/system/core.h" | 16 #include "mojo/public/cpp/system/core.h" |
16 | 17 |
17 namespace mojo { | 18 namespace mojo { |
18 namespace common { | 19 namespace common { |
19 | 20 |
(...skipping 18 matching lines...) Expand all Loading... |
38 // handler can be registered for a specified handle. | 39 // handler can be registered for a specified handle. |
39 // NOTE: a value of 0 for |deadline| indicates an indefinite timeout. | 40 // NOTE: a value of 0 for |deadline| indicates an indefinite timeout. |
40 void AddHandler(MessagePumpMojoHandler* handler, | 41 void AddHandler(MessagePumpMojoHandler* handler, |
41 const Handle& handle, | 42 const Handle& handle, |
42 MojoHandleSignals wait_signals, | 43 MojoHandleSignals wait_signals, |
43 base::TimeTicks deadline); | 44 base::TimeTicks deadline); |
44 | 45 |
45 void RemoveHandler(const Handle& handle); | 46 void RemoveHandler(const Handle& handle); |
46 | 47 |
47 // MessagePump: | 48 // MessagePump: |
48 virtual void Run(Delegate* delegate) OVERRIDE; | 49 virtual void Run(Delegate* delegate) override; |
49 virtual void Quit() OVERRIDE; | 50 virtual void Quit() override; |
50 virtual void ScheduleWork() OVERRIDE; | 51 virtual void ScheduleWork() override; |
51 virtual void ScheduleDelayedWork( | 52 virtual void ScheduleDelayedWork( |
52 const base::TimeTicks& delayed_work_time) OVERRIDE; | 53 const base::TimeTicks& delayed_work_time) override; |
53 | 54 |
54 private: | 55 private: |
55 struct RunState; | 56 struct RunState; |
56 struct WaitState; | 57 struct WaitState; |
57 | 58 |
58 // Contains the data needed to track a request to AddHandler(). | 59 // Contains the data needed to track a request to AddHandler(). |
59 struct Handler { | 60 struct Handler { |
60 Handler() : handler(NULL), wait_signals(MOJO_HANDLE_SIGNAL_NONE), id(0) {} | 61 Handler() : handler(NULL), wait_signals(MOJO_HANDLE_SIGNAL_NONE), id(0) {} |
61 | 62 |
62 MessagePumpMojoHandler* handler; | 63 MessagePumpMojoHandler* handler; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // notify it. | 105 // notify it. |
105 int next_handler_id_; | 106 int next_handler_id_; |
106 | 107 |
107 DISALLOW_COPY_AND_ASSIGN(MessagePumpMojo); | 108 DISALLOW_COPY_AND_ASSIGN(MessagePumpMojo); |
108 }; | 109 }; |
109 | 110 |
110 } // namespace common | 111 } // namespace common |
111 } // namespace mojo | 112 } // namespace mojo |
112 | 113 |
113 #endif // MOJO_COMMON_MESSAGE_PUMP_MOJO_H_ | 114 #endif // MOJO_COMMON_MESSAGE_PUMP_MOJO_H_ |
OLD | NEW |