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

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

Issue 1090413003: [chrome/browser/sync && sync_file_system] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed build breaks Created 5 years, 8 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/history_model_worker.h" 5 #include "chrome/browser/sync/glue/history_model_worker.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 namespace { 63 namespace {
64 64
65 // Post the work task on |history_service|'s DB thread from the UI 65 // Post the work task on |history_service|'s DB thread from the UI
66 // thread. 66 // thread.
67 void PostWorkerTask( 67 void PostWorkerTask(
68 const base::WeakPtr<history::HistoryService>& history_service, 68 const base::WeakPtr<history::HistoryService>& history_service,
69 const syncer::WorkCallback& work, 69 const syncer::WorkCallback& work,
70 base::CancelableTaskTracker* cancelable_tracker, 70 base::CancelableTaskTracker* cancelable_tracker,
71 WaitableEvent* done, 71 WaitableEvent* done,
72 syncer::SyncerError* error) { 72 syncer::SyncerError* error) {
73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 73 DCHECK_CURRENTLY_ON(BrowserThread::UI);
74 if (history_service.get()) { 74 if (history_service.get()) {
75 scoped_ptr<history::HistoryDBTask> task(new WorkerTask(work, done, error)); 75 scoped_ptr<history::HistoryDBTask> task(new WorkerTask(work, done, error));
76 history_service->ScheduleDBTask(task.Pass(), cancelable_tracker); 76 history_service->ScheduleDBTask(task.Pass(), cancelable_tracker);
77 } else { 77 } else {
78 *error = syncer::CANNOT_DO_WORK; 78 *error = syncer::CANNOT_DO_WORK;
79 done->Signal(); 79 done->Signal();
80 } 80 }
81 } 81 }
82 82
83 } // namespace 83 } // namespace
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 126 }
127 127
128 HistoryModelWorker::~HistoryModelWorker() { 128 HistoryModelWorker::~HistoryModelWorker() {
129 // The base::CancelableTaskTracker class is not thread-safe and must only be 129 // The base::CancelableTaskTracker class is not thread-safe and must only be
130 // used from a single thread but the current object may not be destroyed from 130 // used from a single thread but the current object may not be destroyed from
131 // the UI thread, so delete it from the UI thread. 131 // the UI thread, so delete it from the UI thread.
132 BrowserThread::DeleteOnUIThread::Destruct(cancelable_tracker_.release()); 132 BrowserThread::DeleteOnUIThread::Destruct(cancelable_tracker_.release());
133 } 133 }
134 134
135 } // namespace browser_sync 135 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698