Add an extension override bubble and warning box for proxy extensions. (2nd attempt...
[chromium-blink-merge.git] / mojo / system / waiter_list.h
blob7266e2c7b9d3ea9b1bfd19613893f32da51457e1
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 <list>
10 #include "base/basictypes.h"
11 #include "mojo/public/c/system/types.h"
12 #include "mojo/system/system_impl_export.h"
14 namespace mojo {
15 namespace system {
17 class Waiter;
19 // |WaiterList| tracks all the |Waiter|s that are waiting on a given
20 // handle/|Dispatcher|. There should be a |WaiterList| for each handle that can
21 // be waited on (in any way). In the simple case, the |WaiterList| is owned by
22 // the |Dispatcher|, whereas in more complex cases it is owned by the secondary
23 // object (see simple_dispatcher.* and the explanatory comment in core.cc). This
24 // class is thread-unsafe (all concurrent access must be protected by some
25 // lock).
26 class MOJO_SYSTEM_IMPL_EXPORT WaiterList {
27 public:
28 WaiterList();
29 ~WaiterList();
31 void AwakeWaitersForStateChange(MojoWaitFlags satisfied_flags,
32 MojoWaitFlags satisfiable_flags);
33 void CancelAllWaiters();
34 void AddWaiter(Waiter* waiter, MojoWaitFlags flags, MojoResult wake_result);
35 void RemoveWaiter(Waiter* waiter);
37 private:
38 struct WaiterInfo {
39 WaiterInfo(Waiter* waiter, MojoWaitFlags flags, MojoResult wake_result)
40 : waiter(waiter), flags(flags), wake_result(wake_result) {}
42 Waiter* waiter;
43 MojoWaitFlags flags;
44 MojoResult wake_result;
46 typedef std::list<WaiterInfo> WaiterInfoList;
48 WaiterInfoList waiters_;
50 DISALLOW_COPY_AND_ASSIGN(WaiterList);
53 } // namespace system
54 } // namespace mojo
56 #endif // MOJO_SYSTEM_WAITER_LIST_H_