OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 BASE_OBSERVER_LIST_THREADSAFE_H_ | 5 #ifndef BASE_OBSERVER_LIST_THREADSAFE_H_ |
6 #define BASE_OBSERVER_LIST_THREADSAFE_H_ | 6 #define BASE_OBSERVER_LIST_THREADSAFE_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
20 #include "base/thread_task_runner_handle.h" | |
21 #include "base/threading/platform_thread.h" | 20 #include "base/threading/platform_thread.h" |
| 21 #include "base/threading/thread_task_runner_handle.h" |
22 | 22 |
23 /////////////////////////////////////////////////////////////////////////////// | 23 /////////////////////////////////////////////////////////////////////////////// |
24 // | 24 // |
25 // OVERVIEW: | 25 // OVERVIEW: |
26 // | 26 // |
27 // A thread-safe container for a list of observers. | 27 // A thread-safe container for a list of observers. |
28 // This is similar to the observer_list (see observer_list.h), but it | 28 // This is similar to the observer_list (see observer_list.h), but it |
29 // is more robust for multi-threaded situations. | 29 // is more robust for multi-threaded situations. |
30 // | 30 // |
31 // The following use cases are supported: | 31 // The following use cases are supported: |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 mutable Lock list_lock_; // Protects the observer_lists_. | 263 mutable Lock list_lock_; // Protects the observer_lists_. |
264 ObserversListMap observer_lists_; | 264 ObserversListMap observer_lists_; |
265 const NotificationType type_; | 265 const NotificationType type_; |
266 | 266 |
267 DISALLOW_COPY_AND_ASSIGN(ObserverListThreadSafe); | 267 DISALLOW_COPY_AND_ASSIGN(ObserverListThreadSafe); |
268 }; | 268 }; |
269 | 269 |
270 } // namespace base | 270 } // namespace base |
271 | 271 |
272 #endif // BASE_OBSERVER_LIST_THREADSAFE_H_ | 272 #endif // BASE_OBSERVER_LIST_THREADSAFE_H_ |
OLD | NEW |