OLD | NEW |
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/browser_thread_model_worker.h" | 5 #include "chrome/browser/sync/glue/browser_thread_model_worker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 syncer::ModelSafeGroup BrowserThreadModelWorker::GetModelSafeGroup() { | 45 syncer::ModelSafeGroup BrowserThreadModelWorker::GetModelSafeGroup() { |
46 return group_; | 46 return group_; |
47 } | 47 } |
48 | 48 |
49 BrowserThreadModelWorker::~BrowserThreadModelWorker() {} | 49 BrowserThreadModelWorker::~BrowserThreadModelWorker() {} |
50 | 50 |
51 void BrowserThreadModelWorker::RegisterForLoopDestruction() { | 51 void BrowserThreadModelWorker::RegisterForLoopDestruction() { |
52 if (BrowserThread::CurrentlyOn(thread_)) { | 52 if (BrowserThread::CurrentlyOn(thread_)) { |
53 base::MessageLoop::current()->AddDestructionObserver(this); | |
54 SetWorkingLoopToCurrent(); | 53 SetWorkingLoopToCurrent(); |
55 } else { | 54 } else { |
56 BrowserThread::PostTask( | 55 BrowserThread::PostTask( |
57 thread_, FROM_HERE, | 56 thread_, FROM_HERE, |
58 Bind(&BrowserThreadModelWorker::RegisterForLoopDestruction, this)); | 57 Bind(&BrowserThreadModelWorker::RegisterForLoopDestruction, this)); |
59 } | 58 } |
60 } | 59 } |
61 | 60 |
62 void BrowserThreadModelWorker::CallDoWorkAndSignalTask( | 61 void BrowserThreadModelWorker::CallDoWorkAndSignalTask( |
63 const syncer::WorkCallback& work, | 62 const syncer::WorkCallback& work, |
(...skipping 28 matching lines...) Expand all Loading... |
92 void FileModelWorker::CallDoWorkAndSignalTask( | 91 void FileModelWorker::CallDoWorkAndSignalTask( |
93 const syncer::WorkCallback& work, | 92 const syncer::WorkCallback& work, |
94 WaitableEvent* done, | 93 WaitableEvent* done, |
95 syncer::SyncerError* error) { | 94 syncer::SyncerError* error) { |
96 BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error); | 95 BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error); |
97 } | 96 } |
98 | 97 |
99 FileModelWorker::~FileModelWorker() {} | 98 FileModelWorker::~FileModelWorker() {} |
100 | 99 |
101 } // namespace browser_sync | 100 } // namespace browser_sync |
OLD | NEW |