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

Unified Diff: chrome/browser/sync/glue/ui_model_worker.cc

Issue 8366030: Introduce the plumbing necessary to report Unrecoverable error from model safe workers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/ui_model_worker.cc
diff --git a/chrome/browser/sync/glue/ui_model_worker.cc b/chrome/browser/sync/glue/ui_model_worker.cc
index 020e3c9645be909901af84cff868fe927595f1b5..5bb3eeebd866759e33e6a647fa56b324e72001a9 100644
--- a/chrome/browser/sync/glue/ui_model_worker.cc
+++ b/chrome/browser/sync/glue/ui_model_worker.cc
@@ -10,8 +10,10 @@
#include "content/browser/browser_thread.h"
namespace browser_sync {
+using sessions::UnrecoverableErrorInfo;
-void UIModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) {
+UnrecoverableErrorInfo UIModelWorker::DoWorkAndWaitUntilDone(
+ Callback1<sessions::UnrecoverableErrorInfo*>::Type* work) {
// In most cases, this method is called in WORKING state. It is possible this
// gets called when we are in the RUNNING_MANUAL_SHUTDOWN_PUMP state, because
// the UI loop has initiated shutdown but the syncer hasn't got the memo yet.
@@ -19,12 +21,12 @@ void UIModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) {
// code handling this case in Stop(). Note there _no_ way we can be in here
// with state_ = STOPPED, so it is safe to read / compare in this case.
CHECK_NE(ANNOTATE_UNPROTECTED_READ(state_), STOPPED);
-
+ UnrecoverableErrorInfo error_info;
if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
DLOG(WARNING) << "DoWorkAndWaitUntilDone called from "
<< "ui_loop_. Probably a nested invocation?";
- work->Run();
- return;
+ work->Run(&error_info);
+ return error_info;
}
// Create an unsignaled event to wait on.
@@ -35,16 +37,19 @@ void UIModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) {
// The task is owned by the message loop as per usual.
base::AutoLock lock(lock_);
DCHECK(!pending_work_);
- pending_work_ = new CallDoWorkAndSignalTask(work, &work_done, this);
+ UnrecoverableErrorInfo error_info;
+ pending_work_ = new CallDoWorkAndSignalTask(work, &work_done, this,
+ &error_info);
if (!BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, pending_work_)) {
LOG(WARNING) << "Could not post work to UI loop.";
pending_work_ = NULL;
syncapi_event_.Signal();
- return;
+ return error_info;
}
}
syncapi_event_.Signal(); // Notify that the syncapi produced work for us.
work_done.Wait();
+ return error_info;
}
UIModelWorker::UIModelWorker()
@@ -110,7 +115,7 @@ void UIModelWorker::CallDoWorkAndSignalTask::Run() {
// actually gets destroyed.
return;
}
- work_->Run();
+ work_->Run(error_info_);
// Sever ties with work_ to allow the sanity-checking above that we don't
// get run twice.

Powered by Google App Engine
This is Rietveld 408576698