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

Unified Diff: chrome/browser/sync/syncable/syncable.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 a high level 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/syncable/syncable.cc
diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc
index 9038240974bbb63648be871679cb2e464fed778a..2511610578f795362125171e18b4f13442aa62a4 100644
--- a/chrome/browser/sync/syncable/syncable.cc
+++ b/chrome/browser/sync/syncable/syncable.cc
@@ -41,6 +41,7 @@
#include "net/base/escape.h"
namespace {
+
enum InvariantCheckLevel {
OFF = 0,
VERIFY_IN_MEMORY = 1,
@@ -51,7 +52,8 @@ static const InvariantCheckLevel kInvariantCheckLevel = VERIFY_IN_MEMORY;
// Max number of milliseconds to spend checking syncable entry invariants
static const int kInvariantCheckMaxMs = 50;
-} // namespace
+
+} // namespace.
using std::string;
@@ -425,7 +427,8 @@ Directory::Kernel::~Kernel() {
delete metahandles_index;
}
-Directory::Directory() : kernel_(NULL), store_(NULL) {
+Directory::Directory() : kernel_(NULL), store_(NULL),
+ unrecoverable_error_(false) {
}
Directory::~Directory() {
@@ -696,6 +699,8 @@ void Directory::TakeSnapshotForSaveChanges(SaveChangesSnapshot* snapshot) {
}
bool Directory::SaveChanges() {
+ if (unrecoverable_error_)
+ return true;
bool success = false;
DCHECK(store_);
@@ -1117,6 +1122,14 @@ void Directory::RemoveTransactionObserver(TransactionObserver* observer) {
kernel_->observers->RemoveObserver(observer);
}
+void Directory::set_unrecoverable_error() {
+ unrecoverable_error_ = true;
+}
+
+bool Directory::unrecoverable_error() const {
+ return unrecoverable_error_;
+}
+
///////////////////////////////////////////////////////////////////////////////
// ScopedKernelLock
@@ -1157,6 +1170,10 @@ BaseTransaction::BaseTransaction(const tracked_objects::Location& from_here,
&TransactionObserver::OnTransactionStart, from_here_, writer_);
}
+void BaseTransaction::set_unrecoverable_error() {
+ directory_->set_unrecoverable_error();
+}
+
BaseTransaction::~BaseTransaction() {
dirkernel_->observers->Notify(
&TransactionObserver::OnTransactionEnd, from_here_, writer_);
@@ -1282,6 +1299,8 @@ void WriteTransaction::NotifyTransactionComplete(
WriteTransaction::~WriteTransaction() {
const ImmutableEntryKernelMutationMap& mutations = RecordMutations();
+ if (directory_->unrecoverable_error())
+ return;
if (OFF != kInvariantCheckLevel) {
const bool full_scan = (FULL_DB_VERIFICATION == kInvariantCheckLevel);
if (full_scan)
@@ -1485,8 +1504,7 @@ bool MutableEntry::PutIsDel(bool is_del) {
if (!is_del)
// Restores position to the 0th index.
if (!PutPredecessor(Id())) {
- // TODO(lipalani) : Propagate the error to caller. crbug.com/100444.
- NOTREACHED();
+ return false;
}
return true;

Powered by Google App Engine
This is Rietveld 408576698