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_TEST_THREAD_OBSERVER_HELPER_H__ | 5 #ifndef CHROME_TEST_THREAD_OBSERVER_HELPER_H__ |
6 #define CHROME_TEST_THREAD_OBSERVER_HELPER_H__ | 6 #define CHROME_TEST_THREAD_OBSERVER_HELPER_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "base/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
11 #include "chrome/browser/browser_thread.h" | 11 #include "chrome/browser/browser_thread.h" |
12 #include "chrome/common/notification_observer_mock.h" | 12 #include "chrome/common/notification_observer_mock.h" |
13 #include "chrome/common/notification_registrar.h" | 13 #include "chrome/common/notification_registrar.h" |
14 | 14 |
15 // Helper class to add and remove observers on a non-UI thread from | 15 // Helper class to add and remove observers on a non-UI thread from |
16 // the UI thread. | 16 // the UI thread. |
17 template <class T, typename Traits> | 17 template <class T, typename Traits> |
18 class ThreadObserverHelper : public base::RefCountedThreadSafe<T, Traits> { | 18 class ThreadObserverHelper : public base::RefCountedThreadSafe<T, Traits> { |
19 public: | 19 public: |
20 explicit ThreadObserverHelper(BrowserThread::ID id) | 20 explicit ThreadObserverHelper(BrowserThread::ID id) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 typedef ThreadObserverHelper< | 61 typedef ThreadObserverHelper< |
62 DBThreadObserverHelper, | 62 DBThreadObserverHelper, |
63 BrowserThread::DeleteOnDBThread> DBThreadObserverHelperBase; | 63 BrowserThread::DeleteOnDBThread> DBThreadObserverHelperBase; |
64 | 64 |
65 class DBThreadObserverHelper : public DBThreadObserverHelperBase { | 65 class DBThreadObserverHelper : public DBThreadObserverHelperBase { |
66 public: | 66 public: |
67 DBThreadObserverHelper() : DBThreadObserverHelperBase(BrowserThread::DB) {} | 67 DBThreadObserverHelper() : DBThreadObserverHelperBase(BrowserThread::DB) {} |
68 }; | 68 }; |
69 | 69 |
70 #endif // CHROME_TEST_THREAD_OBSERVER_HELPER_H__ | 70 #endif // CHROME_TEST_THREAD_OBSERVER_HELPER_H__ |
OLD | NEW |