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

Side by Side Diff: mojo/edk/system/awakable_list.h

Issue 779503003: Extract Awakable from Waiter (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Review Update Created 6 years 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
OLDNEW
(Empty)
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.
4
5 #ifndef MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_
6 #define MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_
7
8 #include <stdint.h>
9
10 #include <list>
11
12 #include "base/macros.h"
13 #include "mojo/edk/system/system_impl_export.h"
14 #include "mojo/public/c/system/types.h"
15
16 namespace mojo {
17 namespace system {
18
19 class Awakable;
20 struct HandleSignalsState;
21
22 // |AwakableList| tracks all the |Waiter|s that are waiting on a given
23 // handle/|Dispatcher|. There should be a |AwakableList| for each handle that
24 // can be waited on (in any way). In the simple case, the |AwakableList| is
25 // owned by the |Dispatcher|, whereas in more complex cases it is owned by the
26 // secondary object (see simple_dispatcher.* and the explanatory comment in
27 // core.cc). This class is thread-unsafe (all concurrent access must be
28 // protected by some lock).
29 class MOJO_SYSTEM_IMPL_EXPORT AwakableList {
30 public:
31 AwakableList();
32 ~AwakableList();
33
34 void AwakeForStateChange(const HandleSignalsState& state);
35 void CancelAll();
36 void AddWaiter(Awakable* awakable,
viettrungluu 2014/12/03 22:31:26 Could you just rename this to "Add"? (And "RemoveW
Hajime Morrita 2014/12/03 22:47:11 Done.
37 MojoHandleSignals signals,
38 uint32_t context);
39 void RemoveWaiter(Awakable* awakable);
40
41 private:
42 struct AwakeInfo {
43 AwakeInfo(Awakable* awakable, MojoHandleSignals signals, uint32_t context)
44 : awakable(awakable), signals(signals), context(context) {}
45
46 Awakable* awakable;
47 MojoHandleSignals signals;
48 uint32_t context;
49 };
50 typedef std::list<AwakeInfo> AwakeInfoList;
51
52 AwakeInfoList awakables_;
53
54 DISALLOW_COPY_AND_ASSIGN(AwakableList);
55 };
56
57 } // namespace system
58 } // namespace mojo
59
60 #endif // MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698