OLD | NEW |
1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 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 LIBRARIES_NACL_IO_EVENT_EMITTER_H_ | 5 #ifndef LIBRARIES_NACL_IO_EVENT_EMITTER_H_ |
6 #define LIBRARIES_NACL_IO_EVENT_EMITTER_H_ | 6 #define LIBRARIES_NACL_IO_EVENT_EMITTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <set> | 11 #include <set> |
12 | 12 |
13 #include "nacl_io/error.h" | 13 #include "nacl_io/error.h" |
14 | 14 |
15 #include "sdk_util/auto_lock.h" | 15 #include "sdk_util/auto_lock.h" |
16 #include "sdk_util/macros.h" | 16 #include "sdk_util/macros.h" |
17 #include "sdk_util/ref_object.h" | 17 #include "sdk_util/ref_object.h" |
18 #include "sdk_util/scoped_ref.h" | 18 #include "sdk_util/scoped_ref.h" |
19 #include "sdk_util/simple_lock.h" | 19 #include "sdk_util/simple_lock.h" |
20 | 20 |
21 namespace nacl_io { | 21 namespace nacl_io { |
22 | 22 |
23 class EventEmitter; | 23 class EventEmitter; |
24 class EventListener; | 24 class EventListener; |
25 | 25 |
26 | |
27 typedef sdk_util::ScopedRef<EventEmitter> ScopedEventEmitter; | 26 typedef sdk_util::ScopedRef<EventEmitter> ScopedEventEmitter; |
28 typedef std::map<EventListener*, uint32_t> EventListenerMap_t; | 27 typedef std::map<EventListener*, uint32_t> EventListenerMap_t; |
29 | 28 |
30 bool operator<(const ScopedEventEmitter& src_a, | 29 bool operator<(const ScopedEventEmitter& src_a, |
31 const ScopedEventEmitter& src_b); | 30 const ScopedEventEmitter& src_b); |
32 | 31 |
33 // EventEmitter | 32 // EventEmitter |
34 // | 33 // |
35 // The EventEmitter class provides notification of events to EventListeners | 34 // The EventEmitter class provides notification of events to EventListeners |
36 // by registering EventInfo objects and signaling the EventListener | 35 // by registering EventInfo objects and signaling the EventListener |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 70 |
72 private: | 71 private: |
73 uint32_t event_status_; | 72 uint32_t event_status_; |
74 sdk_util::SimpleLock emitter_lock_; | 73 sdk_util::SimpleLock emitter_lock_; |
75 EventListenerMap_t listeners_; | 74 EventListenerMap_t listeners_; |
76 DISALLOW_COPY_AND_ASSIGN(EventEmitter); | 75 DISALLOW_COPY_AND_ASSIGN(EventEmitter); |
77 }; | 76 }; |
78 | 77 |
79 } // namespace nacl_io | 78 } // namespace nacl_io |
80 | 79 |
81 | |
82 #endif // LIBRARIES_NACL_IO_EVENT_EMITTER_H_ | 80 #endif // LIBRARIES_NACL_IO_EVENT_EMITTER_H_ |
OLD | NEW |