Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: mojo/system/waiter_list.h

Issue 325213004: Mojo: Wrap the satisfied/unsatisfied wait flags state in a single object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/system/wait_flags_state.h ('k') | mojo/system/waiter_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SYSTEM_WAITER_LIST_H_ 5 #ifndef MOJO_SYSTEM_WAITER_LIST_H_
6 #define MOJO_SYSTEM_WAITER_LIST_H_ 6 #define MOJO_SYSTEM_WAITER_LIST_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "mojo/public/c/system/types.h" 11 #include "mojo/public/c/system/types.h"
12 #include "mojo/system/system_impl_export.h" 12 #include "mojo/system/system_impl_export.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace system { 15 namespace system {
16 16
17 class Waiter; 17 class Waiter;
18 struct WaitFlagsState;
18 19
19 // |WaiterList| tracks all the |Waiter|s that are waiting on a given 20 // |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 // 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 // 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 // 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 // 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 // class is thread-unsafe (all concurrent access must be protected by some
25 // lock). 26 // lock).
26 class MOJO_SYSTEM_IMPL_EXPORT WaiterList { 27 class MOJO_SYSTEM_IMPL_EXPORT WaiterList {
27 public: 28 public:
28 WaiterList(); 29 WaiterList();
29 ~WaiterList(); 30 ~WaiterList();
30 31
32 void AwakeWaitersForStateChange(const WaitFlagsState& state);
33 //FIXME Remove:
31 void AwakeWaitersForStateChange(MojoWaitFlags satisfied_flags, 34 void AwakeWaitersForStateChange(MojoWaitFlags satisfied_flags,
32 MojoWaitFlags satisfiable_flags); 35 MojoWaitFlags satisfiable_flags);
33 void CancelAllWaiters(); 36 void CancelAllWaiters();
34 void AddWaiter(Waiter* waiter, MojoWaitFlags flags, MojoResult wake_result); 37 void AddWaiter(Waiter* waiter, MojoWaitFlags flags, MojoResult wake_result);
35 void RemoveWaiter(Waiter* waiter); 38 void RemoveWaiter(Waiter* waiter);
36 39
37 private: 40 private:
38 struct WaiterInfo { 41 struct WaiterInfo {
39 WaiterInfo(Waiter* waiter, MojoWaitFlags flags, MojoResult wake_result) 42 WaiterInfo(Waiter* waiter, MojoWaitFlags flags, MojoResult wake_result)
40 : waiter(waiter), flags(flags), wake_result(wake_result) {} 43 : waiter(waiter), flags(flags), wake_result(wake_result) {}
41 44
42 Waiter* waiter; 45 Waiter* waiter;
43 MojoWaitFlags flags; 46 MojoWaitFlags flags;
44 MojoResult wake_result; 47 MojoResult wake_result;
45 }; 48 };
46 typedef std::list<WaiterInfo> WaiterInfoList; 49 typedef std::list<WaiterInfo> WaiterInfoList;
47 50
48 WaiterInfoList waiters_; 51 WaiterInfoList waiters_;
49 52
50 DISALLOW_COPY_AND_ASSIGN(WaiterList); 53 DISALLOW_COPY_AND_ASSIGN(WaiterList);
51 }; 54 };
52 55
53 } // namespace system 56 } // namespace system
54 } // namespace mojo 57 } // namespace mojo
55 58
56 #endif // MOJO_SYSTEM_WAITER_LIST_H_ 59 #endif // MOJO_SYSTEM_WAITER_LIST_H_
OLDNEW
« no previous file with comments | « mojo/system/wait_flags_state.h ('k') | mojo/system/waiter_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698