Chromium Code Reviews| 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 #include <utility> | |
| 10 #include <vector> | |
| 9 | 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/message_loop/message_pump.h" | 14 #include "base/message_loop/message_pump.h" |
| 13 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 14 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 15 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 16 #include "mojo/public/cpp/system/core.h" | 18 #include "mojo/public/cpp/system/core.h" |
| 17 | 19 |
| 18 namespace mojo { | 20 namespace mojo { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 Handler() : handler(NULL), wait_signals(MOJO_HANDLE_SIGNAL_NONE), id(0) {} | 76 Handler() : handler(NULL), wait_signals(MOJO_HANDLE_SIGNAL_NONE), id(0) {} |
| 75 | 77 |
| 76 MessagePumpMojoHandler* handler; | 78 MessagePumpMojoHandler* handler; |
| 77 MojoHandleSignals wait_signals; | 79 MojoHandleSignals wait_signals; |
| 78 base::TimeTicks deadline; | 80 base::TimeTicks deadline; |
| 79 // See description of |MessagePumpMojo::next_handler_id_| for details. | 81 // See description of |MessagePumpMojo::next_handler_id_| for details. |
| 80 int id; | 82 int id; |
| 81 }; | 83 }; |
| 82 | 84 |
| 83 typedef std::map<Handle, Handler> HandleToHandler; | 85 typedef std::map<Handle, Handler> HandleToHandler; |
| 86 typedef std::vector<std::pair<Handle, Handler>> HandleToHandlerList; | |
|
qsr
2015/05/28 09:33:48
This doesn't seem to be needed in the .h file.
Anand Mistry (off Chromium)
2015/05/28 23:27:45
Handler is a private member, so the compiler barfs
| |
| 84 | 87 |
| 85 // Implementation of Run(). | 88 // Implementation of Run(). |
| 86 void DoRunLoop(RunState* run_state, Delegate* delegate); | 89 void DoRunLoop(RunState* run_state, Delegate* delegate); |
| 87 | 90 |
| 88 // Services the set of handles ready. If |block| is true this waits for a | 91 // Services the set of handles ready. If |block| is true this waits for a |
| 89 // handle to become ready, otherwise this does not block. Returns |true| if a | 92 // handle to become ready, otherwise this does not block. Returns |true| if a |
| 90 // handle has become ready, |false| otherwise. | 93 // handle has become ready, |false| otherwise. |
| 91 bool DoInternalWork(const RunState& run_state, bool block); | 94 bool DoInternalWork(const RunState& run_state, bool block); |
| 92 | 95 |
| 93 // Removes the given invalid handle. This is called if MojoWaitMany finds an | 96 // Removes the given invalid handle. This is called if MojoWaitMany finds an |
| 94 // invalid handle. | 97 // invalid handle. |
| 95 void RemoveInvalidHandle(const WaitState& wait_state, | 98 void RemoveInvalidHandle(const WaitState& wait_state, |
| 96 MojoResult result, | 99 MojoResult result, |
| 97 uint32_t result_index); | 100 uint32_t result_index); |
| 98 | 101 |
| 99 void SignalControlPipe(const RunState& run_state); | 102 void SignalControlPipe(const RunState& run_state); |
| 100 | 103 |
| 101 WaitState GetWaitState(const RunState& run_state) const; | 104 void GetWaitState(const RunState& run_state, WaitState* wait_state) const; |
| 102 | 105 |
| 103 // Returns the deadline for the call to MojoWaitMany(). | 106 // Returns the deadline for the call to MojoWaitMany(). |
| 104 MojoDeadline GetDeadlineForWait(const RunState& run_state) const; | 107 MojoDeadline GetDeadlineForWait(const RunState& run_state) const; |
| 105 | 108 |
| 106 void WillSignalHandler(); | 109 void WillSignalHandler(); |
| 107 void DidSignalHandler(); | 110 void DidSignalHandler(); |
| 108 | 111 |
| 109 // If non-NULL we're running (inside Run()). Member is reference to value on | 112 // If non-NULL we're running (inside Run()). Member is reference to value on |
| 110 // stack. | 113 // stack. |
| 111 RunState* run_state_; | 114 RunState* run_state_; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 126 | 129 |
| 127 ObserverList<Observer> observers_; | 130 ObserverList<Observer> observers_; |
| 128 | 131 |
| 129 DISALLOW_COPY_AND_ASSIGN(MessagePumpMojo); | 132 DISALLOW_COPY_AND_ASSIGN(MessagePumpMojo); |
| 130 }; | 133 }; |
| 131 | 134 |
| 132 } // namespace common | 135 } // namespace common |
| 133 } // namespace mojo | 136 } // namespace mojo |
| 134 | 137 |
| 135 #endif // MOJO_COMMON_MESSAGE_PUMP_MOJO_H_ | 138 #endif // MOJO_COMMON_MESSAGE_PUMP_MOJO_H_ |
| OLD | NEW |