| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_WAIT_SET_DISPATCHER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_WAIT_SET_DISPATCHER_H_ |
| 6 #define MOJO_EDK_SYSTEM_WAIT_SET_DISPATCHER_H_ | 6 #define MOJO_EDK_SYSTEM_WAIT_SET_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| 11 #include <unordered_map> | 11 #include <unordered_map> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "mojo/edk/system/awakable_list.h" | 17 #include "mojo/edk/system/awakable_list.h" |
| 18 #include "mojo/edk/system/dispatcher.h" | 18 #include "mojo/edk/system/dispatcher.h" |
| 19 #include "mojo/edk/system/system_impl_export.h" | 19 #include "mojo/edk/system/system_impl_export.h" |
| 20 | 20 |
| 21 namespace mojo { | 21 namespace mojo { |
| 22 namespace edk { | 22 namespace edk { |
| 23 | 23 |
| 24 class MOJO_SYSTEM_IMPL_EXPORT WaitSetDispatcher : public Dispatcher { | 24 class MOJO_SYSTEM_IMPL_EXPORT WaitSetDispatcher : public Dispatcher { |
| 25 public: | 25 public: |
| 26 WaitSetDispatcher(); | 26 WaitSetDispatcher(); |
| 27 | 27 |
| 28 // Dispatcher: | 28 // Dispatcher: |
| 29 Type GetType() const override; | 29 Type GetType() const override; |
| 30 MojoResult Close() override; | 30 MojoResult Close(RequestContext* request_context) override; |
| 31 MojoResult AddWaitingDispatcher(const scoped_refptr<Dispatcher>& dispatcher, | 31 MojoResult AddWaitingDispatcher(const scoped_refptr<Dispatcher>& dispatcher, |
| 32 MojoHandleSignals signals, | 32 MojoHandleSignals signals, |
| 33 uintptr_t context) override; | 33 uintptr_t context) override; |
| 34 MojoResult RemoveWaitingDispatcher( | 34 MojoResult RemoveWaitingDispatcher( |
| 35 const scoped_refptr<Dispatcher>& dispatcher) override; | 35 const scoped_refptr<Dispatcher>& dispatcher) override; |
| 36 MojoResult GetReadyDispatchers(uint32_t* count, | 36 MojoResult GetReadyDispatchers(uint32_t* count, |
| 37 DispatcherVector* dispatchers, | 37 DispatcherVector* dispatchers, |
| 38 MojoResult* results, | 38 MojoResult* results, |
| 39 uintptr_t* contexts) override; | 39 uintptr_t* contexts) override; |
| 40 HandleSignalsState GetHandleSignalsState() const override; | 40 HandleSignalsState GetHandleSignalsState() const override; |
| 41 MojoResult AddAwakable(Awakable* awakable, | 41 MojoResult AddAwakable(Awakable* awakable, |
| 42 MojoHandleSignals signals, | 42 MojoHandleSignals signals, |
| 43 uintptr_t context, | 43 uintptr_t context, |
| 44 HandleSignalsState* signals_state) override; | 44 HandleSignalsState* signals_state) override; |
| 45 void RemoveAwakable(Awakable* awakable, | 45 void RemoveAwakable(Awakable* awakable, |
| 46 HandleSignalsState* signals_state) override; | 46 HandleSignalsState* signals_state) override; |
| 47 bool BeginTransit() override; | 47 bool BeginTransit(RequestContext* request_context) override; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 // Internal implementation of Awakable. | 50 // Internal implementation of Awakable. |
| 51 class Waiter; | 51 class Waiter; |
| 52 | 52 |
| 53 struct WaitState { | 53 struct WaitState { |
| 54 WaitState(); | 54 WaitState(); |
| 55 ~WaitState(); | 55 ~WaitState(); |
| 56 | 56 |
| 57 scoped_refptr<Dispatcher> dispatcher; | 57 scoped_refptr<Dispatcher> dispatcher; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // Waiter used to wait on dispatchers. | 93 // Waiter used to wait on dispatchers. |
| 94 scoped_ptr<Waiter> waiter_; | 94 scoped_ptr<Waiter> waiter_; |
| 95 | 95 |
| 96 DISALLOW_COPY_AND_ASSIGN(WaitSetDispatcher); | 96 DISALLOW_COPY_AND_ASSIGN(WaitSetDispatcher); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 } // namespace edk | 99 } // namespace edk |
| 100 } // namespace mojo | 100 } // namespace mojo |
| 101 | 101 |
| 102 #endif // MOJO_EDK_SYSTEM_WAIT_SET_DISPATCHER_H_ | 102 #endif // MOJO_EDK_SYSTEM_WAIT_SET_DISPATCHER_H_ |
| OLD | NEW |