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

Side by Side Diff: chrome/browser/sync/glue/ui_model_worker.cc

Issue 16092013: Use base::MessageLoop in more files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again, sigh Created 7 years, 6 months 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) 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 #include "chrome/browser/sync/glue/ui_model_worker.h" 5 #include "chrome/browser/sync/glue/ui_model_worker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 base::ThreadRestrictions::ScopedAllowWait allow_wait; 72 base::ThreadRestrictions::ScopedAllowWait allow_wait;
73 // Wait for either a new task or SyncerThread termination. 73 // Wait for either a new task or SyncerThread termination.
74 syncapi_event_.Wait(); 74 syncapi_event_.Wait();
75 } 75 }
76 76
77 state_ = STOPPED; 77 state_ = STOPPED;
78 } 78 }
79 79
80 void UIModelWorker::RegisterForLoopDestruction() { 80 void UIModelWorker::RegisterForLoopDestruction() {
81 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 81 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
82 MessageLoop::current()->AddDestructionObserver(this); 82 base::MessageLoop::current()->AddDestructionObserver(this);
83 } 83 }
84 84
85 syncer::SyncerError UIModelWorker::DoWorkAndWaitUntilDoneImpl( 85 syncer::SyncerError UIModelWorker::DoWorkAndWaitUntilDoneImpl(
86 const syncer::WorkCallback& work) { 86 const syncer::WorkCallback& work) {
87 // In most cases, this method is called in WORKING state. It is possible this 87 // In most cases, this method is called in WORKING state. It is possible this
88 // gets called when we are in the RUNNING_MANUAL_SHUTDOWN_PUMP state, because 88 // gets called when we are in the RUNNING_MANUAL_SHUTDOWN_PUMP state, because
89 // the UI loop has initiated shutdown but the syncer hasn't got the memo yet. 89 // the UI loop has initiated shutdown but the syncer hasn't got the memo yet.
90 // This is fine, the work will get scheduled and run normally or run by our 90 // This is fine, the work will get scheduled and run normally or run by our
91 // code handling this case in Stop(). Note there _no_ way we can be in here 91 // code handling this case in Stop(). Note there _no_ way we can be in here
92 // with state_ = STOPPED, so it is safe to read / compare in this case. 92 // with state_ = STOPPED, so it is safe to read / compare in this case.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 syncapi_has_shutdown_ = true; 136 syncapi_has_shutdown_ = true;
137 syncapi_event_.Signal(); 137 syncapi_event_.Signal();
138 } 138 }
139 139
140 UIModelWorker::~UIModelWorker() { 140 UIModelWorker::~UIModelWorker() {
141 DCHECK_EQ(state_, STOPPED); 141 DCHECK_EQ(state_, STOPPED);
142 } 142 }
143 143
144 } // namespace browser_sync 144 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/password_model_worker.cc ('k') | chrome/browser/ui/app_list/search/history_data_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698