App windows launched in windows ASH should not be messing with the AppUserModelId...
[chromium-blink-merge.git] / mojo / system / waiter_list.h
blob39ac7b0010063da32b1d9975a6d16235f81da4f7
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
3 // found in the LICENSE file.
5 #ifndef MOJO_SYSTEM_WAITER_LIST_H_
6 #define MOJO_SYSTEM_WAITER_LIST_H_
8 #include <stdint.h>
10 #include <list>
12 #include "base/macros.h"
13 #include "mojo/public/c/system/types.h"
14 #include "mojo/system/system_impl_export.h"
16 namespace mojo {
17 namespace system {
19 class Waiter;
20 struct HandleSignalsState;
22 // |WaiterList| tracks all the |Waiter|s that are waiting on a given
23 // handle/|Dispatcher|. There should be a |WaiterList| for each handle that can
24 // be waited on (in any way). In the simple case, the |WaiterList| is owned by
25 // the |Dispatcher|, whereas in more complex cases it is owned by the secondary
26 // object (see simple_dispatcher.* and the explanatory comment in core.cc). This
27 // class is thread-unsafe (all concurrent access must be protected by some
28 // lock).
29 class MOJO_SYSTEM_IMPL_EXPORT WaiterList {
30 public:
31 WaiterList();
32 ~WaiterList();
34 void AwakeWaitersForStateChange(const HandleSignalsState& state);
35 void CancelAllWaiters();
36 void AddWaiter(Waiter* waiter, MojoHandleSignals signals, uint32_t context);
37 void RemoveWaiter(Waiter* waiter);
39 private:
40 struct WaiterInfo {
41 WaiterInfo(Waiter* waiter, MojoHandleSignals signals, uint32_t context)
42 : waiter(waiter), signals(signals), context(context) {}
44 Waiter* waiter;
45 MojoHandleSignals signals;
46 uint32_t context;
48 typedef std::list<WaiterInfo> WaiterInfoList;
50 WaiterInfoList waiters_;
52 DISALLOW_COPY_AND_ASSIGN(WaiterList);
55 } // namespace system
56 } // namespace mojo
58 #endif // MOJO_SYSTEM_WAITER_LIST_H_