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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
18 #include "base/message_loop_proxy.h" | 18 #include "base/message_loop_proxy.h" |
19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
20 #include "base/task.h" | |
21 #include "base/threading/platform_thread.h" | 20 #include "base/threading/platform_thread.h" |
22 | 21 |
23 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
24 // | 23 // |
25 // OVERVIEW: | 24 // OVERVIEW: |
26 // | 25 // |
27 // A thread-safe container for a list of observers. | 26 // A thread-safe container for a list of observers. |
28 // This is similar to the observer_list (see observer_list.h), but it | 27 // This is similar to the observer_list (see observer_list.h), but it |
29 // is more robust for multi-threaded situations. | 28 // is more robust for multi-threaded situations. |
30 // | 29 // |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ObserversListMap; | 283 ObserversListMap; |
285 | 284 |
286 base::Lock list_lock_; // Protects the observer_lists_. | 285 base::Lock list_lock_; // Protects the observer_lists_. |
287 ObserversListMap observer_lists_; | 286 ObserversListMap observer_lists_; |
288 const NotificationType type_; | 287 const NotificationType type_; |
289 | 288 |
290 DISALLOW_COPY_AND_ASSIGN(ObserverListThreadSafe); | 289 DISALLOW_COPY_AND_ASSIGN(ObserverListThreadSafe); |
291 }; | 290 }; |
292 | 291 |
293 #endif // BASE_OBSERVER_LIST_THREADSAFE_H_ | 292 #endif // BASE_OBSERVER_LIST_THREADSAFE_H_ |
OLD | NEW |