| 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_EDK_SYSTEM_AWAKABLE_LIST_H_ | 5 #ifndef MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_ |
| 6 #define MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_ | 6 #define MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // each handle that can be waited on (in any way). In the simple case, the | 23 // each handle that can be waited on (in any way). In the simple case, the |
| 24 // |AwakableList| is owned by the |Dispatcher|, whereas in more complex cases it | 24 // |AwakableList| is owned by the |Dispatcher|, whereas in more complex cases it |
| 25 // is owned by the secondary object (see simple_dispatcher.* and the explanatory | 25 // is owned by the secondary object (see simple_dispatcher.* and the explanatory |
| 26 // comment in core.cc). This class is thread-unsafe (all concurrent access must | 26 // comment in core.cc). This class is thread-unsafe (all concurrent access must |
| 27 // be protected by some lock). | 27 // be protected by some lock). |
| 28 class AwakableList { | 28 class AwakableList { |
| 29 public: | 29 public: |
| 30 AwakableList(); | 30 AwakableList(); |
| 31 ~AwakableList(); | 31 ~AwakableList(); |
| 32 | 32 |
| 33 void AwakeForStateChange(const HandleSignalsState& state); | 33 void OnStateChange(const HandleSignalsState& old_state, |
| 34 const HandleSignalsState& new_state); |
| 34 void CancelAll(); | 35 void CancelAll(); |
| 35 void Add(Awakable* awakable, MojoHandleSignals signals, uint64_t context); | 36 void Add(Awakable* awakable, MojoHandleSignals signals, uint64_t context); |
| 36 void Remove(Awakable* awakable); | 37 void Remove(Awakable* awakable); |
| 37 void RemoveWithContext(Awakable* awakable, uint64_t context); | 38 void RemoveWithContext(Awakable* awakable, uint64_t context); |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 struct AwakeInfo { | 41 struct AwakeInfo { |
| 41 AwakeInfo(Awakable* awakable, MojoHandleSignals signals, uint64_t context) | 42 AwakeInfo(Awakable* awakable, MojoHandleSignals signals, uint64_t context) |
| 42 : awakable(awakable), signals(signals), context(context) {} | 43 : awakable(awakable), signals(signals), context(context) {} |
| 43 | 44 |
| 44 Awakable* awakable; | 45 Awakable* awakable; |
| 45 MojoHandleSignals signals; | 46 MojoHandleSignals signals; |
| 46 uint64_t context; | 47 uint64_t context; |
| 47 }; | 48 }; |
| 48 using AwakeInfoList = std::vector<AwakeInfo>; | 49 using AwakeInfoList = std::vector<AwakeInfo>; |
| 49 | 50 |
| 50 AwakeInfoList awakables_; | 51 AwakeInfoList awakables_; |
| 51 | 52 |
| 52 MOJO_DISALLOW_COPY_AND_ASSIGN(AwakableList); | 53 MOJO_DISALLOW_COPY_AND_ASSIGN(AwakableList); |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 } // namespace system | 56 } // namespace system |
| 56 } // namespace mojo | 57 } // namespace mojo |
| 57 | 58 |
| 58 #endif // MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_ | 59 #endif // MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_ |
| OLD | NEW |