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

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

Issue 2072353002: Give AwakableList's wake-up method the old state in addition to the new state. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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
« no previous file with comments | « mojo/edk/system/mock_simple_dispatcher.cc ('k') | mojo/edk/system/simple_dispatcher.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_EDK_SYSTEM_SIMPLE_DISPATCHER_H_ 5 #ifndef MOJO_EDK_SYSTEM_SIMPLE_DISPATCHER_H_
6 #define MOJO_EDK_SYSTEM_SIMPLE_DISPATCHER_H_ 6 #define MOJO_EDK_SYSTEM_SIMPLE_DISPATCHER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "mojo/edk/system/awakable_list.h" 10 #include "mojo/edk/system/awakable_list.h"
11 #include "mojo/edk/system/dispatcher.h" 11 #include "mojo/edk/system/dispatcher.h"
12 #include "mojo/edk/system/handle_signals_state.h"
12 #include "mojo/edk/util/thread_annotations.h" 13 #include "mojo/edk/util/thread_annotations.h"
13 #include "mojo/public/cpp/system/macros.h" 14 #include "mojo/public/cpp/system/macros.h"
14 15
15 namespace mojo { 16 namespace mojo {
16 namespace system { 17 namespace system {
17 18
18 // A base class for simple dispatchers. "Simple" means that there's a one-to-one 19 // A base class for simple dispatchers. "Simple" means that there's a one-to-one
19 // correspondence between handles and dispatchers (see the explanatory comment 20 // correspondence between handles and dispatchers (see the explanatory comment
20 // in core.cc). This class implements the standard waiter-signaling mechanism in 21 // in core.cc). This class implements the standard waiter-signaling mechanism in
21 // that case. 22 // that case.
22 class SimpleDispatcher : public Dispatcher { 23 class SimpleDispatcher : public Dispatcher {
23 protected: 24 protected:
24 SimpleDispatcher(); 25 SimpleDispatcher();
25 ~SimpleDispatcher() override; 26 ~SimpleDispatcher() override;
26 27
27 // To be called by subclasses when the state changes (so 28 // To be called by subclasses when the state changes.
28 // |GetHandleSignalsStateImplNoLock()| should be checked again). 29 void OnHandleSignalsStateChangeNoLock(const HandleSignalsState& old_state,
29 void HandleSignalsStateChangedNoLock() MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex()); 30 const HandleSignalsState& new_state)
31 MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex());
30 32
31 // |Dispatcher| protected methods: 33 // |Dispatcher| protected methods:
32 void CancelAllStateNoLock() override; 34 void CancelAllStateNoLock() override;
33 MojoResult AddAwakableImplNoLock(Awakable* awakable, 35 MojoResult AddAwakableImplNoLock(Awakable* awakable,
34 MojoHandleSignals signals, 36 MojoHandleSignals signals,
35 bool force, 37 bool force,
36 uint64_t context, 38 uint64_t context,
37 HandleSignalsState* signals_state) override; 39 HandleSignalsState* signals_state) override;
38 void RemoveAwakableImplNoLock(Awakable* awakable, 40 void RemoveAwakableImplNoLock(Awakable* awakable,
39 HandleSignalsState* signals_state) override; 41 HandleSignalsState* signals_state) override;
40 void RemoveAwakableWithContextImplNoLock( 42 void RemoveAwakableWithContextImplNoLock(
41 Awakable* awakable, 43 Awakable* awakable,
42 uint64_t context, 44 uint64_t context,
43 HandleSignalsState* signals_state) override; 45 HandleSignalsState* signals_state) override;
44 46
45 private: 47 private:
46 AwakableList awakable_list_ MOJO_GUARDED_BY(mutex()); 48 AwakableList awakable_list_ MOJO_GUARDED_BY(mutex());
47 49
48 MOJO_DISALLOW_COPY_AND_ASSIGN(SimpleDispatcher); 50 MOJO_DISALLOW_COPY_AND_ASSIGN(SimpleDispatcher);
49 }; 51 };
50 52
51 } // namespace system 53 } // namespace system
52 } // namespace mojo 54 } // namespace mojo
53 55
54 #endif // MOJO_EDK_SYSTEM_SIMPLE_DISPATCHER_H_ 56 #endif // MOJO_EDK_SYSTEM_SIMPLE_DISPATCHER_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/mock_simple_dispatcher.cc ('k') | mojo/edk/system/simple_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698