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

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

Issue 637413003: Sync: Avoid deadlock in SyncBackendRegistrar / ModelSafeWorker on sync backend shutdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor tweaks Created 6 years, 2 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
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/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 } // namespace 42 } // namespace
43 43
44 UIModelWorker::UIModelWorker(syncer::WorkerLoopDestructionObserver* observer) 44 UIModelWorker::UIModelWorker(syncer::WorkerLoopDestructionObserver* observer)
45 : syncer::ModelSafeWorker(observer) { 45 : syncer::ModelSafeWorker(observer) {
46 } 46 }
47 47
48 void UIModelWorker::RegisterForLoopDestruction() { 48 void UIModelWorker::RegisterForLoopDestruction() {
49 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 49 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
50 base::MessageLoop::current()->AddDestructionObserver(this);
51 SetWorkingLoopToCurrent(); 50 SetWorkingLoopToCurrent();
52 } 51 }
53 52
54 syncer::SyncerError UIModelWorker::DoWorkAndWaitUntilDoneImpl( 53 syncer::SyncerError UIModelWorker::DoWorkAndWaitUntilDoneImpl(
55 const syncer::WorkCallback& work) { 54 const syncer::WorkCallback& work) {
56 syncer::SyncerError error_info; 55 syncer::SyncerError error_info;
57 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { 56 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
58 DLOG(WARNING) << "DoWorkAndWaitUntilDone called from " 57 DLOG(WARNING) << "DoWorkAndWaitUntilDone called from "
59 << "ui_loop_. Probably a nested invocation?"; 58 << "ui_loop_. Probably a nested invocation?";
60 return work.Run(); 59 return work.Run();
(...skipping 13 matching lines...) Expand all
74 } 73 }
75 74
76 syncer::ModelSafeGroup UIModelWorker::GetModelSafeGroup() { 75 syncer::ModelSafeGroup UIModelWorker::GetModelSafeGroup() {
77 return syncer::GROUP_UI; 76 return syncer::GROUP_UI;
78 } 77 }
79 78
80 UIModelWorker::~UIModelWorker() { 79 UIModelWorker::~UIModelWorker() {
81 } 80 }
82 81
83 } // namespace browser_sync 82 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_registrar_unittest.cc ('k') | sync/internal_api/public/engine/model_safe_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698