| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/sync/profile_sync_test_util.h" | 5 #include "chrome/browser/sync/profile_sync_test_util.h" |
| 6 | 6 |
| 7 #include "base/task.h" | 7 #include "base/task.h" |
| 8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
| 9 | 9 |
| 10 ProfileSyncServiceObserverMock::ProfileSyncServiceObserverMock() {} | 10 ProfileSyncServiceObserverMock::ProfileSyncServiceObserverMock() {} |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 void ThreadNotificationService::TearDownTask() { | 43 void ThreadNotificationService::TearDownTask() { |
| 44 service_.reset(NULL); | 44 service_.reset(NULL); |
| 45 done_event_.Signal(); | 45 done_event_.Signal(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 ThreadNotifier::ThreadNotifier(base::Thread* notify_thread) | 48 ThreadNotifier::ThreadNotifier(base::Thread* notify_thread) |
| 49 : done_event_(false, false), | 49 : done_event_(false, false), |
| 50 notify_thread_(notify_thread) {} | 50 notify_thread_(notify_thread) {} |
| 51 | 51 |
| 52 void ThreadNotifier::Notify(NotificationType type, | 52 void ThreadNotifier::Notify(int type, |
| 53 const NotificationDetails& details) { | 53 const NotificationDetails& details) { |
| 54 Notify(type, NotificationService::AllSources(), details); | 54 Notify(type, NotificationService::AllSources(), details); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void ThreadNotifier::Notify(NotificationType type, | 57 void ThreadNotifier::Notify(int type, |
| 58 const NotificationSource& source, | 58 const NotificationSource& source, |
| 59 const NotificationDetails& details) { | 59 const NotificationDetails& details) { |
| 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 61 notify_thread_->message_loop()->PostTask( | 61 notify_thread_->message_loop()->PostTask( |
| 62 FROM_HERE, | 62 FROM_HERE, |
| 63 NewRunnableMethod(this, | 63 NewRunnableMethod(this, |
| 64 &ThreadNotifier::NotifyTask, | 64 &ThreadNotifier::NotifyTask, |
| 65 type, | 65 type, |
| 66 source, | 66 source, |
| 67 details)); | 67 details)); |
| 68 done_event_.Wait(); | 68 done_event_.Wait(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 ThreadNotifier::~ThreadNotifier() {} | 71 ThreadNotifier::~ThreadNotifier() {} |
| 72 | 72 |
| 73 void ThreadNotifier::NotifyTask(NotificationType type, | 73 void ThreadNotifier::NotifyTask(int type, |
| 74 const NotificationSource& source, | 74 const NotificationSource& source, |
| 75 const NotificationDetails& details) { | 75 const NotificationDetails& details) { |
| 76 NotificationService::current()->Notify(type, source, details); | 76 NotificationService::current()->Notify(type, source, details); |
| 77 done_event_.Signal(); | 77 done_event_.Signal(); |
| 78 } | 78 } |
| OLD | NEW |