| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_SYNC_UTIL_EVENT_SYS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_UTIL_EVENT_SYS_H_ |
| 6 #define CHROME_BROWSER_SYNC_UTIL_EVENT_SYS_H_ | 6 #define CHROME_BROWSER_SYNC_UTIL_EVENT_SYS_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/sync/util/pthread_helpers_fwd.h" | 8 class AutoLock; |
| 9 class Lock; |
| 9 | 10 |
| 10 // An abstract base class for listening to events. | 11 // An abstract base class for listening to events. |
| 11 // | 12 // |
| 12 // Don't inherit from this class yourself. Using NewEventListenerHookup() is | 13 // Don't inherit from this class yourself. Using NewEventListenerHookup() is |
| 13 // much easier. | 14 // much easier. |
| 14 template <typename EventType> | 15 template <typename EventType> |
| 15 class EventListener { | 16 class EventListener { |
| 16 public: | 17 public: |
| 17 virtual void HandleEvent(const EventType& event) = 0; | 18 virtual void HandleEvent(const EventType& event) = 0; |
| 18 }; | 19 }; |
| 19 | 20 |
| 20 // See the -inl.h for details about the following. | 21 // See the -inl.h for details about the following. |
| 21 | 22 |
| 22 template <typename EventTraits, typename NotifyLock = PThreadNoLock, | 23 template <typename EventTraits, typename NotifyLock = Lock, |
| 23 typename ScopedNotifyLocker = PThreadScopedLock<NotifyLock> > | 24 typename ScopedNotifyLocker = AutoLock> |
| 24 class EventChannel; | 25 class EventChannel; |
| 25 | 26 |
| 26 class EventListenerHookup; | 27 class EventListenerHookup; |
| 27 | 28 |
| 28 template <typename EventChannel, typename CallbackObject, | 29 template <typename EventChannel, typename CallbackObject, |
| 29 typename CallbackMethod> | 30 typename CallbackMethod> |
| 30 EventListenerHookup* NewEventListenerHookup(EventChannel* channel, | 31 EventListenerHookup* NewEventListenerHookup(EventChannel* channel, |
| 31 CallbackObject* cbobject, | 32 CallbackObject* cbobject, |
| 32 CallbackMethod cbmethod); | 33 CallbackMethod cbmethod); |
| 33 | 34 |
| 34 template <typename EventChannel, typename CallbackObject, | 35 template <typename EventChannel, typename CallbackObject, |
| 35 typename CallbackMethod, typename CallbackArg0> | 36 typename CallbackMethod, typename CallbackArg0> |
| 36 EventListenerHookup* NewEventListenerHookup(EventChannel* channel, | 37 EventListenerHookup* NewEventListenerHookup(EventChannel* channel, |
| 37 CallbackObject* cbobject, | 38 CallbackObject* cbobject, |
| 38 CallbackMethod cbmethod, | 39 CallbackMethod cbmethod, |
| 39 CallbackArg0 arg0); | 40 CallbackArg0 arg0); |
| 40 | 41 |
| 41 #endif // CHROME_BROWSER_SYNC_UTIL_EVENT_SYS_H_ | 42 #endif // CHROME_BROWSER_SYNC_UTIL_EVENT_SYS_H_ |
| OLD | NEW |