Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: chrome/browser/sync/profile_sync_test_util.cc

Issue 8341117: Converted top-level NewRunnable* to Bind for Sync module (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indenting. Removed trailing whitespace. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h"
7 #include "base/task.h" 8 #include "base/task.h"
8 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
9 10
10 ProfileSyncServiceObserverMock::ProfileSyncServiceObserverMock() {} 11 ProfileSyncServiceObserverMock::ProfileSyncServiceObserverMock() {}
11 12
12 ProfileSyncServiceObserverMock::~ProfileSyncServiceObserverMock() {} 13 ProfileSyncServiceObserverMock::~ProfileSyncServiceObserverMock() {}
13 14
14 ThreadNotificationService::ThreadNotificationService( 15 ThreadNotificationService::ThreadNotificationService(
15 base::Thread* notification_thread) 16 base::Thread* notification_thread)
16 : done_event_(false, false), 17 : done_event_(false, false),
17 notification_thread_(notification_thread) {} 18 notification_thread_(notification_thread) {}
18 19
19 void ThreadNotificationService::Init() { 20 void ThreadNotificationService::Init() {
20 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 21 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
21 notification_thread_->message_loop()->PostTask( 22 notification_thread_->message_loop()->PostTask(
22 FROM_HERE, 23 FROM_HERE,
23 NewRunnableMethod(this, &ThreadNotificationService::InitTask)); 24 base::Bind(&ThreadNotificationService::InitTask, this));
24 done_event_.Wait(); 25 done_event_.Wait();
25 } 26 }
26 27
27 void ThreadNotificationService::TearDown() { 28 void ThreadNotificationService::TearDown() {
28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
29 notification_thread_->message_loop()->PostTask( 30 notification_thread_->message_loop()->PostTask(
30 FROM_HERE, 31 FROM_HERE,
31 NewRunnableMethod(this, 32 base::Bind(&ThreadNotificationService::TearDownTask, this));
32 &ThreadNotificationService::TearDownTask));
33 done_event_.Wait(); 33 done_event_.Wait();
34 } 34 }
35 35
36 ThreadNotificationService::~ThreadNotificationService() {} 36 ThreadNotificationService::~ThreadNotificationService() {}
37 37
38 void ThreadNotificationService::InitTask() { 38 void ThreadNotificationService::InitTask() {
39 service_.reset(new NotificationServiceImpl()); 39 service_.reset(new NotificationServiceImpl());
40 done_event_.Signal(); 40 done_event_.Signal();
41 } 41 }
42 42
(...skipping 10 matching lines...) Expand all
53 const content::NotificationDetails& details) { 53 const content::NotificationDetails& details) {
54 Notify(type, content::NotificationService::AllSources(), details); 54 Notify(type, content::NotificationService::AllSources(), details);
55 } 55 }
56 56
57 void ThreadNotifier::Notify(int type, 57 void ThreadNotifier::Notify(int type,
58 const content::NotificationSource& source, 58 const content::NotificationSource& source,
59 const content::NotificationDetails& details) { 59 const content::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 base::Bind(&ThreadNotifier::NotifyTask, this, type, source, details));
64 &ThreadNotifier::NotifyTask,
65 type,
66 source,
67 details));
68 done_event_.Wait(); 64 done_event_.Wait();
69 } 65 }
70 66
71 ThreadNotifier::~ThreadNotifier() {} 67 ThreadNotifier::~ThreadNotifier() {}
72 68
73 void ThreadNotifier::NotifyTask(int type, 69 void ThreadNotifier::NotifyTask(int type,
74 const content::NotificationSource& source, 70 const content::NotificationSource& source,
75 const content::NotificationDetails& details) { 71 const content::NotificationDetails& details) {
76 content::NotificationService::current()->Notify(type, source, details); 72 content::NotificationService::current()->Notify(type, source, details);
77 done_event_.Signal(); 73 done_event_.Signal();
78 } 74 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_harness.cc ('k') | chrome/browser/sync/test/integration/autofill_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698