diff options
Diffstat (limited to 'chrome/browser')
49 files changed, 305 insertions, 187 deletions
diff --git a/chrome/browser/sync/engine/apply_updates_command.cc b/chrome/browser/sync/engine/apply_updates_command.cc index 70ff143..f5c3cef 100644 --- a/chrome/browser/sync/engine/apply_updates_command.cc +++ b/chrome/browser/sync/engine/apply_updates_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,12 +44,13 @@ std::set<ModelSafeGroup> ApplyUpdatesCommand::GetGroupsToChange( return groups_with_unapplied_updates; } -void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncSession* session) { +SyncerError ApplyUpdatesCommand::ModelChangingExecuteImpl( + SyncSession* session) { syncable::ScopedDirLookup dir(session->context()->directory_manager(), session->context()->account_name()); if (!dir.good()) { LOG(ERROR) << "Scoped dir lookup failed!"; - return; + return DIRECTORY_LOOKUP_FAILED; } syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir); @@ -91,6 +92,8 @@ void ApplyUpdatesCommand::ModelChangingExecuteImpl(SyncSession* session) { dir->set_initial_sync_ended_for_type(it.Get(), true); } } + + return SYNCER_OK; } } // namespace browser_sync diff --git a/chrome/browser/sync/engine/apply_updates_command.h b/chrome/browser/sync/engine/apply_updates_command.h index d75754f..fc7a42c 100644 --- a/chrome/browser/sync/engine/apply_updates_command.h +++ b/chrome/browser/sync/engine/apply_updates_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,7 +20,7 @@ class ApplyUpdatesCommand : public ModelChangingSyncerCommand { // ModelChangingSyncerCommand implementation. virtual std::set<ModelSafeGroup> GetGroupsToChange( const sessions::SyncSession& session) const OVERRIDE; - virtual void ModelChangingExecuteImpl( + virtual SyncerError ModelChangingExecuteImpl( sessions::SyncSession* session) OVERRIDE; private: diff --git a/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc b/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc index 065f021..b4fc41e 100644 --- a/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc +++ b/chrome/browser/sync/engine/build_and_process_conflict_sets_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -35,10 +35,11 @@ std::set<ModelSafeGroup> BuildAndProcessConflictSetsCommand::GetGroupsToChange( return session.GetEnabledGroupsWithConflicts(); } -void BuildAndProcessConflictSetsCommand::ModelChangingExecuteImpl( +SyncerError BuildAndProcessConflictSetsCommand::ModelChangingExecuteImpl( SyncSession* session) { session->mutable_status_controller()->update_conflict_sets_built( BuildAndProcessConflictSets(session)); + return SYNCER_OK; } bool BuildAndProcessConflictSetsCommand::BuildAndProcessConflictSets( diff --git a/chrome/browser/sync/engine/build_and_process_conflict_sets_command.h b/chrome/browser/sync/engine/build_and_process_conflict_sets_command.h index 8ef7b8d..1ae090d 100644 --- a/chrome/browser/sync/engine/build_and_process_conflict_sets_command.h +++ b/chrome/browser/sync/engine/build_and_process_conflict_sets_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -39,7 +39,7 @@ class BuildAndProcessConflictSetsCommand : public ModelChangingSyncerCommand { // ModelChangingSyncerCommand implementation. virtual std::set<ModelSafeGroup> GetGroupsToChange( const sessions::SyncSession& session) const OVERRIDE; - virtual void ModelChangingExecuteImpl( + virtual SyncerError ModelChangingExecuteImpl( sessions::SyncSession* session) OVERRIDE; private: diff --git a/chrome/browser/sync/engine/build_commit_command.cc b/chrome/browser/sync/engine/build_commit_command.cc index 35ff047..4655827 100644 --- a/chrome/browser/sync/engine/build_commit_command.cc +++ b/chrome/browser/sync/engine/build_commit_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -85,7 +85,7 @@ void SetEntrySpecifics(MutableEntry* meta_entry, SyncEntity* sync_entry) { } } // namespace -void BuildCommitCommand::ExecuteImpl(SyncSession* session) { +SyncerError BuildCommitCommand::ExecuteImpl(SyncSession* session) { ClientToServerMessage message; message.set_share(session->context()->account_name()); message.set_message_contents(ClientToServerMessage::COMMIT); @@ -210,6 +210,8 @@ void BuildCommitCommand::ExecuteImpl(SyncSession* session) { } session->mutable_status_controller()-> mutable_commit_message()->CopyFrom(message); + + return SYNCER_OK; } int64 BuildCommitCommand::FindAnchorPosition(syncable::IdField direction, diff --git a/chrome/browser/sync/engine/build_commit_command.h b/chrome/browser/sync/engine/build_commit_command.h index ca7d412..fca2535 100644 --- a/chrome/browser/sync/engine/build_commit_command.h +++ b/chrome/browser/sync/engine/build_commit_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,7 +20,7 @@ class BuildCommitCommand : public SyncerCommand { virtual ~BuildCommitCommand(); // SyncerCommand implementation. - virtual void ExecuteImpl(sessions::SyncSession* session) OVERRIDE; + virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; private: FRIEND_TEST_ALL_PREFIXES(BuildCommitCommandTest, InterpolatePosition); diff --git a/chrome/browser/sync/engine/cleanup_disabled_types_command.cc b/chrome/browser/sync/engine/cleanup_disabled_types_command.cc index 49a0fda..7b73cf9 100644 --- a/chrome/browser/sync/engine/cleanup_disabled_types_command.cc +++ b/chrome/browser/sync/engine/cleanup_disabled_types_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,10 +17,10 @@ namespace browser_sync { CleanupDisabledTypesCommand::CleanupDisabledTypesCommand() {} CleanupDisabledTypesCommand::~CleanupDisabledTypesCommand() {} -void CleanupDisabledTypesCommand::ExecuteImpl(sessions::SyncSession* session) { +SyncerError CleanupDisabledTypesCommand::ExecuteImpl( + sessions::SyncSession* session) { using syncable::ModelTypeSet; using syncable::ModelTypeSetToString; - // Because a full directory purge is slow, we avoid purging // undesired types unless we have reason to believe they were // previously enabled. Because purging could theoretically fail on @@ -61,16 +61,17 @@ void CleanupDisabledTypesCommand::ExecuteImpl(sessions::SyncSession* session) { << ", to_cleanup = " << ModelTypeSetToString(to_cleanup); if (to_cleanup.Empty()) - return; + return SYNCER_OK; syncable::ScopedDirLookup dir(session->context()->directory_manager(), session->context()->account_name()); if (!dir.good()) { LOG(ERROR) << "Scoped dir lookup failed!"; - return; + return DIRECTORY_LOOKUP_FAILED; } dir->PurgeEntriesWithTypeIn(to_cleanup); + return SYNCER_OK; } } // namespace browser_sync diff --git a/chrome/browser/sync/engine/cleanup_disabled_types_command.h b/chrome/browser/sync/engine/cleanup_disabled_types_command.h index f5d2f40..70dece2 100644 --- a/chrome/browser/sync/engine/cleanup_disabled_types_command.h +++ b/chrome/browser/sync/engine/cleanup_disabled_types_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -34,7 +34,7 @@ class CleanupDisabledTypesCommand : public SyncerCommand { virtual ~CleanupDisabledTypesCommand(); // SyncerCommand implementation. - virtual void ExecuteImpl(sessions::SyncSession* session) OVERRIDE; + virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(CleanupDisabledTypesCommand); diff --git a/chrome/browser/sync/engine/clear_data_command.cc b/chrome/browser/sync/engine/clear_data_command.cc index 932c624..248fc83 100644 --- a/chrome/browser/sync/engine/clear_data_command.cc +++ b/chrome/browser/sync/engine/clear_data_command.cc @@ -26,7 +26,7 @@ using syncable::MODEL_TYPE_COUNT; ClearDataCommand::ClearDataCommand() {} ClearDataCommand::~ClearDataCommand() {} -void ClearDataCommand::ExecuteImpl(SyncSession* session) { +SyncerError ClearDataCommand::ExecuteImpl(SyncSession* session) { ClientToServerMessage client_to_server_message; ClientToServerResponse client_to_server_response; @@ -40,7 +40,7 @@ void ClearDataCommand::ExecuteImpl(SyncSession* session) { session->context()->account_name()); if (!dir.good()) { LOG(ERROR) << "Scoped dir lookup failed!"; - return; + return DIRECTORY_LOOKUP_FAILED; } SyncerProtoUtil::AddRequestBirthday(dir, &client_to_server_message); @@ -55,6 +55,11 @@ void ClearDataCommand::ExecuteImpl(SyncSession* session) { DVLOG(1) << SyncerProtoUtil::ClientToServerResponseDebugString( client_to_server_response); + // TODO(lipalani): This code is wrong. The response error codes it checks + // have been obsoleted. The only reason it hasn't caused problems is that + // this code is unreachable. We should do something to clean up this mess. + // See also: crbug.com/71616. + // // Clear pending indicates that the server has received our clear message if (!ok || !client_to_server_response.has_error_code() || client_to_server_response.error_code() != sync_pb::SyncEnums::SUCCESS) { @@ -66,7 +71,7 @@ void ClearDataCommand::ExecuteImpl(SyncSession* session) { LOG(ERROR) << "Error posting ClearData."; - return; + return SYNCER_OK; } SyncEngineEvent event(SyncEngineEvent::CLEAR_SERVER_DATA_SUCCEEDED); @@ -75,6 +80,7 @@ void ClearDataCommand::ExecuteImpl(SyncSession* session) { session->delegate()->OnShouldStopSyncingPermanently(); DVLOG(1) << "ClearData succeeded."; + return SYNCER_OK; } } // namespace browser_sync diff --git a/chrome/browser/sync/engine/clear_data_command.h b/chrome/browser/sync/engine/clear_data_command.h index 763deef..f01a78c 100644 --- a/chrome/browser/sync/engine/clear_data_command.h +++ b/chrome/browser/sync/engine/clear_data_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,7 +20,7 @@ class ClearDataCommand : public SyncerCommand { virtual ~ClearDataCommand(); // SyncerCommand implementation. - virtual void ExecuteImpl(sessions::SyncSession* session) OVERRIDE; + virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(ClearDataCommand); diff --git a/chrome/browser/sync/engine/download_updates_command.cc b/chrome/browser/sync/engine/download_updates_command.cc index 86414a6e..8cee1b5 100644 --- a/chrome/browser/sync/engine/download_updates_command.cc +++ b/chrome/browser/sync/engine/download_updates_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,7 +30,7 @@ using syncable::ModelTypeSetToString; DownloadUpdatesCommand::DownloadUpdatesCommand() {} DownloadUpdatesCommand::~DownloadUpdatesCommand() {} -void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { +SyncerError DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { ClientToServerMessage client_to_server_message; ClientToServerResponse update_response; @@ -48,7 +48,7 @@ void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { session->context()->account_name()); if (!dir.good()) { LOG(ERROR) << "Scoped dir lookup failed!"; - return; + return DIRECTORY_LOOKUP_FAILED; } // Request updates for all enabled types. @@ -105,7 +105,7 @@ void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { status->increment_num_consecutive_errors(); status->mutable_updates_response()->Clear(); LOG(ERROR) << "PostClientToServerMessage() failed during GetUpdates"; - return; + return SYNCER_OK; // TODO(rlarocque): Return an error here. } status->mutable_updates_response()->CopyFrom(update_response); @@ -115,6 +115,7 @@ void DownloadUpdatesCommand::ExecuteImpl(SyncSession* session) { << " updates and indicated " << update_response.get_updates().changes_remaining() << " updates left on server."; + return SYNCER_OK; } void DownloadUpdatesCommand::AppendClientDebugInfoIfNeeded( diff --git a/chrome/browser/sync/engine/download_updates_command.h b/chrome/browser/sync/engine/download_updates_command.h index 293c99a..3b12c71 100644 --- a/chrome/browser/sync/engine/download_updates_command.h +++ b/chrome/browser/sync/engine/download_updates_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,7 +44,7 @@ class DownloadUpdatesCommand : public SyncerCommand { virtual ~DownloadUpdatesCommand(); // SyncerCommand implementation. - virtual void ExecuteImpl(sessions::SyncSession* session) OVERRIDE; + virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; private: FRIEND_TEST_ALL_PREFIXES(DownloadUpdatesCommandTest, VerifyAppendDebugInfo); diff --git a/chrome/browser/sync/engine/get_commit_ids_command.cc b/chrome/browser/sync/engine/get_commit_ids_command.cc index 720c063..f4beb4b 100644 --- a/chrome/browser/sync/engine/get_commit_ids_command.cc +++ b/chrome/browser/sync/engine/get_commit_ids_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -29,7 +29,7 @@ GetCommitIdsCommand::GetCommitIdsCommand(int commit_batch_size) GetCommitIdsCommand::~GetCommitIdsCommand() {} -void GetCommitIdsCommand::ExecuteImpl(SyncSession* session) { +SyncerError GetCommitIdsCommand::ExecuteImpl(SyncSession* session) { // Gather the full set of unsynced items and store it in the session. They // are not in the correct order for commit. syncable::Directory::UnsyncedMetaHandles all_unsynced_handles; @@ -65,6 +65,7 @@ void GetCommitIdsCommand::ExecuteImpl(SyncSession* session) { DVLOG(1) << "Debug commit batch result:" << verified_commit_ids[i]; status->set_commit_set(*ordered_commit_set_.get()); + return SYNCER_OK; } namespace { diff --git a/chrome/browser/sync/engine/get_commit_ids_command.h b/chrome/browser/sync/engine/get_commit_ids_command.h index b728671..cff27b5 100644 --- a/chrome/browser/sync/engine/get_commit_ids_command.h +++ b/chrome/browser/sync/engine/get_commit_ids_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -28,7 +28,7 @@ class GetCommitIdsCommand : public SyncerCommand { virtual ~GetCommitIdsCommand(); // SyncerCommand implementation. - virtual void ExecuteImpl(sessions::SyncSession* session) OVERRIDE; + virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; // Builds a vector of IDs that should be committed. void BuildCommitIds(const vector<int64>& unsynced_handles, diff --git a/chrome/browser/sync/engine/model_changing_syncer_command.cc b/chrome/browser/sync/engine/model_changing_syncer_command.cc index 1c392cb..cd99da9 100644 --- a/chrome/browser/sync/engine/model_changing_syncer_command.cc +++ b/chrome/browser/sync/engine/model_changing_syncer_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,15 +9,16 @@ #include "base/bind_helpers.h" #include "chrome/browser/sync/sessions/status_controller.h" #include "chrome/browser/sync/sessions/sync_session.h" -#include "chrome/browser/sync/util/unrecoverable_error_info.h" namespace browser_sync { -void ModelChangingSyncerCommand::ExecuteImpl(sessions::SyncSession* session) { +SyncerError ModelChangingSyncerCommand::ExecuteImpl( + sessions::SyncSession* session) { work_session_ = session; - if (!ModelNeutralExecuteImpl(work_session_)) { - return; - } + SyncerError result = ModelNeutralExecuteImpl(work_session_); + + if (result != SYNCER_OK) + return result; const std::set<ModelSafeGroup>& groups_to_change = GetGroupsToChange(*work_session_); @@ -40,15 +41,19 @@ void ModelChangingSyncerCommand::ExecuteImpl(sessions::SyncSession* session) { // unretained. base::Unretained(this)); - // TODO(lipalani): Check the return value for an unrecoverable error. - ignore_result(worker->DoWorkAndWaitUntilDone(c)); - + SyncerError this_worker_result = worker->DoWorkAndWaitUntilDone(c); + // TODO(rlarocque): Figure out a better way to deal with errors from + // multiple models at once. See also: crbug.com/109422. + if (this_worker_result != SYNCER_OK) + result = this_worker_result; } + + return result; } -bool ModelChangingSyncerCommand::ModelNeutralExecuteImpl( +SyncerError ModelChangingSyncerCommand::ModelNeutralExecuteImpl( sessions::SyncSession* session) { - return true; + return SYNCER_OK; } } // namespace browser_sync diff --git a/chrome/browser/sync/engine/model_changing_syncer_command.h b/chrome/browser/sync/engine/model_changing_syncer_command.h index e6f6ca1..c11b6a3 100644 --- a/chrome/browser/sync/engine/model_changing_syncer_command.h +++ b/chrome/browser/sync/engine/model_changing_syncer_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,7 +9,6 @@ #include "base/compiler_specific.h" #include "chrome/browser/sync/engine/model_safe_worker.h" #include "chrome/browser/sync/engine/syncer_command.h" -#include "chrome/browser/sync/util/unrecoverable_error_info.h" namespace browser_sync { namespace sessions { @@ -32,14 +31,12 @@ class ModelChangingSyncerCommand : public SyncerCommand { virtual ~ModelChangingSyncerCommand() { } // SyncerCommand implementation. Sets work_session to session. - virtual void ExecuteImpl(sessions::SyncSession* session) OVERRIDE; + virtual browser_sync::SyncerError ExecuteImpl( + sessions::SyncSession* session) OVERRIDE; - // wrapper so implementations don't worry about storing work_session - UnrecoverableErrorInfo StartChangingModel() { - // TODO(lipalani): |ModelChangingExecuteImpl| should return an - // UnrecoverableErrorInfo struct. - ModelChangingExecuteImpl(work_session_); - return UnrecoverableErrorInfo(); + // Wrapper so implementations don't worry about storing work_session. + SyncerError StartChangingModel() { + return ModelChangingExecuteImpl(work_session_); } std::set<ModelSafeGroup> GetGroupsToChangeForTest( @@ -64,13 +61,14 @@ class ModelChangingSyncerCommand : public SyncerCommand { // *without* a ModelSafeGroup restriction in place on the SyncSession. // Returns true on success, false on failure. // TODO(tim): Remove this (bug 36594). - virtual bool ModelNeutralExecuteImpl(sessions::SyncSession* session); + virtual SyncerError ModelNeutralExecuteImpl(sessions::SyncSession* session); // Abstract method to be implemented by subclasses to handle logic that // operates on the model. This is invoked with a SyncSession ModelSafeGroup // restriction in place so that bits of state belonging to data types // running on an unsafe thread are siloed away. - virtual void ModelChangingExecuteImpl(sessions::SyncSession* session) = 0; + virtual SyncerError ModelChangingExecuteImpl( + sessions::SyncSession* session) = 0; private: // ExecuteImpl is expected to be run by SyncerCommand to set work_session. diff --git a/chrome/browser/sync/engine/model_changing_syncer_command_unittest.cc b/chrome/browser/sync/engine/model_changing_syncer_command_unittest.cc index 93736de..1e9d1d13 100644 --- a/chrome/browser/sync/engine/model_changing_syncer_command_unittest.cc +++ b/chrome/browser/sync/engine/model_changing_syncer_command_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -31,9 +31,10 @@ class FakeModelChangingSyncerCommand : public ModelChangingSyncerCommand { return session.GetEnabledGroups(); } - virtual void ModelChangingExecuteImpl( + virtual SyncerError ModelChangingExecuteImpl( sessions::SyncSession* session) OVERRIDE { changed_groups_.insert(session->status_controller().group_restriction()); + return SYNCER_OK; } private: diff --git a/chrome/browser/sync/engine/model_safe_worker.cc b/chrome/browser/sync/engine/model_safe_worker.cc index eb2b903..3c5bcbf 100644 --- a/chrome/browser/sync/engine/model_safe_worker.cc +++ b/chrome/browser/sync/engine/model_safe_worker.cc @@ -1,9 +1,8 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/sync/engine/model_safe_worker.h" -#include "chrome/browser/sync/util/unrecoverable_error_info.h" #include "base/json/json_writer.h" #include "base/memory/scoped_ptr.h" diff --git a/chrome/browser/sync/engine/model_safe_worker.h b/chrome/browser/sync/engine/model_safe_worker.h index a103d09..8ed3448 100644 --- a/chrome/browser/sync/engine/model_safe_worker.h +++ b/chrome/browser/sync/engine/model_safe_worker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,8 +12,8 @@ #include "base/callback.h" #include "base/memory/ref_counted.h" +#include "chrome/browser/sync/internal_api/includes/syncer_error.h" #include "chrome/browser/sync/syncable/model_type.h" -#include "chrome/browser/sync/util/unrecoverable_error_info.h" namespace base { class DictionaryValue; @@ -21,7 +21,7 @@ class DictionaryValue; namespace browser_sync { -typedef base::Callback<UnrecoverableErrorInfo(void)> WorkCallback; +typedef base::Callback<enum SyncerError(void)> WorkCallback; enum ModelSafeGroup { GROUP_PASSIVE = 0, // Models that are just "passively" being synced; e.g. @@ -52,8 +52,7 @@ class ModelSafeWorker : public base::RefCountedThreadSafe<ModelSafeWorker> { // Any time the Syncer performs model modifications (e.g employing a // WriteTransaction), it should be done by this method to ensure it is done // from a model-safe thread. - virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( - const WorkCallback& work) = 0; + virtual SyncerError DoWorkAndWaitUntilDone(const WorkCallback& work) = 0; virtual ModelSafeGroup GetModelSafeGroup() = 0; diff --git a/chrome/browser/sync/engine/passive_model_worker.cc b/chrome/browser/sync/engine/passive_model_worker.cc index d98b451..64be1b1 100644 --- a/chrome/browser/sync/engine/passive_model_worker.cc +++ b/chrome/browser/sync/engine/passive_model_worker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,7 +14,7 @@ PassiveModelWorker::PassiveModelWorker(const MessageLoop* sync_loop) PassiveModelWorker::~PassiveModelWorker() { } -UnrecoverableErrorInfo PassiveModelWorker::DoWorkAndWaitUntilDone( +SyncerError PassiveModelWorker::DoWorkAndWaitUntilDone( const WorkCallback& work) { DCHECK_EQ(MessageLoop::current(), sync_loop_); // Simply do the work on the current thread. diff --git a/chrome/browser/sync/engine/passive_model_worker.h b/chrome/browser/sync/engine/passive_model_worker.h index 7574380..5a35b0a2 100644 --- a/chrome/browser/sync/engine/passive_model_worker.h +++ b/chrome/browser/sync/engine/passive_model_worker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "chrome/browser/sync/engine/model_safe_worker.h" +#include "chrome/browser/sync/internal_api/includes/syncer_error.h" class MessageLoop; @@ -22,7 +23,7 @@ class PassiveModelWorker : public ModelSafeWorker { explicit PassiveModelWorker(const MessageLoop* sync_loop); // ModelSafeWorker implementation. Called on the sync thread. - virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( + virtual SyncerError DoWorkAndWaitUntilDone( const WorkCallback& work) OVERRIDE; virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; diff --git a/chrome/browser/sync/engine/post_commit_message_command.cc b/chrome/browser/sync/engine/post_commit_message_command.cc index c70a193..4379a80 100644 --- a/chrome/browser/sync/engine/post_commit_message_command.cc +++ b/chrome/browser/sync/engine/post_commit_message_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,14 +19,15 @@ namespace browser_sync { PostCommitMessageCommand::PostCommitMessageCommand() {} PostCommitMessageCommand::~PostCommitMessageCommand() {} -void PostCommitMessageCommand::ExecuteImpl(sessions::SyncSession* session) { +SyncerError PostCommitMessageCommand::ExecuteImpl( + sessions::SyncSession* session) { if (session->status_controller().commit_ids().empty()) - return; // Nothing to commit. + return SYNCER_OK; // Nothing to commit. ClientToServerResponse response; syncable::ScopedDirLookup dir(session->context()->directory_manager(), session->context()->account_name()); if (!dir.good()) - return; + return DIRECTORY_LOOKUP_FAILED; sessions::StatusController* status = session->mutable_status_controller(); if (!SyncerProtoUtil::PostClientToServerMessage(status->commit_message(), &response, session)) { @@ -41,11 +42,13 @@ void PostCommitMessageCommand::ExecuteImpl(sessions::SyncSession* session) { syncable::MutableEntry entry(&trans, syncable::GET_BY_ID, commit_ids[i]); entry.Put(syncable::SYNCING, false); } - return; + return SYNCER_OK; // TODO(rlarocque): Return an error here. } else { status->set_items_committed(); } + status->mutable_commit_response()->CopyFrom(response); + return SYNCER_OK; } } // namespace browser_sync diff --git a/chrome/browser/sync/engine/post_commit_message_command.h b/chrome/browser/sync/engine/post_commit_message_command.h index 6470bb6..5f2252c 100644 --- a/chrome/browser/sync/engine/post_commit_message_command.h +++ b/chrome/browser/sync/engine/post_commit_message_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,7 +17,7 @@ class PostCommitMessageCommand : public SyncerCommand { virtual ~PostCommitMessageCommand(); // SyncerCommand implementation. - virtual void ExecuteImpl(sessions::SyncSession* session) OVERRIDE; + virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(PostCommitMessageCommand); diff --git a/chrome/browser/sync/engine/process_commit_response_command.cc b/chrome/browser/sync/engine/process_commit_response_command.cc index a4c3291..43ec2ca 100644 --- a/chrome/browser/sync/engine/process_commit_response_command.cc +++ b/chrome/browser/sync/engine/process_commit_response_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -81,13 +81,13 @@ std::set<ModelSafeGroup> ProcessCommitResponseCommand::GetGroupsToChange( return groups_with_commits; } -bool ProcessCommitResponseCommand::ModelNeutralExecuteImpl( +SyncerError ProcessCommitResponseCommand::ModelNeutralExecuteImpl( sessions::SyncSession* session) { ScopedDirLookup dir(session->context()->directory_manager(), session->context()->account_name()); if (!dir.good()) { LOG(ERROR) << "Scoped dir lookup failed!"; - return false; + return DIRECTORY_LOOKUP_FAILED; } const StatusController& status = session->status_controller(); @@ -98,7 +98,7 @@ bool ProcessCommitResponseCommand::ModelNeutralExecuteImpl( // TODO(sync): What if we didn't try to commit anything? LOG(WARNING) << "Commit response has no commit body!"; IncrementErrorCounters(session->mutable_status_controller()); - return false; + return SERVER_RESPONSE_VALIDATION_FAILED; } const CommitResponse& cr = response.commit(); @@ -113,14 +113,14 @@ bool ProcessCommitResponseCommand::ModelNeutralExecuteImpl( LOG(ERROR) << " " << cr.entryresponse(i).error_message(); } IncrementErrorCounters(session->mutable_status_controller()); - return false; + return SERVER_RESPONSE_VALIDATION_FAILED; } - return true; + return SYNCER_OK; } -void ProcessCommitResponseCommand::ModelChangingExecuteImpl( +SyncerError ProcessCommitResponseCommand::ModelChangingExecuteImpl( SyncSession* session) { - ProcessCommitResponse(session); + SyncerError result = ProcessCommitResponse(session); ExtensionsActivityMonitor* monitor = session->context()->extensions_monitor(); if (session->status_controller().HasBookmarkCommitActivity() && session->status_controller().syncer_status() @@ -128,17 +128,16 @@ void ProcessCommitResponseCommand::ModelChangingExecuteImpl( monitor->PutRecords(session->extensions_activity()); session->mutable_extensions_activity()->clear(); } + return result; } -void ProcessCommitResponseCommand::ProcessCommitResponse( +SyncerError ProcessCommitResponseCommand::ProcessCommitResponse( SyncSession* session) { - // TODO(sync): This function returns if it sees problems. We probably want - // to flag the need for an update or similar. ScopedDirLookup dir(session->context()->directory_manager(), session->context()->account_name()); if (!dir.good()) { LOG(ERROR) << "Scoped dir lookup failed!"; - return; + return DIRECTORY_LOOKUP_FAILED; } StatusController* status = session->mutable_status_controller(); @@ -189,10 +188,6 @@ void ProcessCommitResponseCommand::ProcessCommitResponse( // We handle over quota like a retry, which is same as transient. case CommitResponse::RETRY: case CommitResponse::TRANSIENT_ERROR: - // TODO(tim): Now that we have SyncSession::Delegate, we - // should plumb this directly for exponential backoff purposes rather - // than trying to infer from HasMoreToSync(). See - // SyncerThread::CalculatePollingWaitTime. ++transient_error_commits; break; default: @@ -218,7 +213,20 @@ void ProcessCommitResponseCommand::ProcessCommitResponse( } SyncerUtil::MarkDeletedChildrenSynced(dir, &deleted_folders); - return; + if (commit_count == (successes + conflicting_commits)) { + // We consider conflicting commits as a success because things will work out + // on their own when we receive them. Flags will be set so that + // HasMoreToSync() will cause SyncScheduler to enter another sync cycle to + // handle this condition. + return SYNCER_OK; + } else if (error_commits > 0) { + return SERVER_RETURN_UNKNOWN_ERROR; + } else if (transient_error_commits > 0) { + return SERVER_RETURN_TRANSIENT_ERROR; + } else { + LOG(FATAL) << "Inconsistent counts when processing commit response"; + return SYNCER_OK; + } } void LogServerError(const CommitResponse_EntryResponse& res) { diff --git a/chrome/browser/sync/engine/process_commit_response_command.h b/chrome/browser/sync/engine/process_commit_response_command.h index bac2a31..e6762a2 100644 --- a/chrome/browser/sync/engine/process_commit_response_command.h +++ b/chrome/browser/sync/engine/process_commit_response_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -32,9 +32,9 @@ class ProcessCommitResponseCommand : public ModelChangingSyncerCommand { // ModelChangingSyncerCommand implementation. virtual std::set<ModelSafeGroup> GetGroupsToChange( const sessions::SyncSession& session) const OVERRIDE; - virtual bool ModelNeutralExecuteImpl( + virtual SyncerError ModelNeutralExecuteImpl( sessions::SyncSession* session) OVERRIDE; - virtual void ModelChangingExecuteImpl( + virtual SyncerError ModelChangingExecuteImpl( sessions::SyncSession* session) OVERRIDE; private: @@ -47,7 +47,7 @@ class ProcessCommitResponseCommand : public ModelChangingSyncerCommand { std::set<syncable::Id>* deleted_folders); // Actually does the work of execute. - void ProcessCommitResponse(sessions::SyncSession* session); + SyncerError ProcessCommitResponse(sessions::SyncSession* session); void ProcessSuccessfulCommitResponse( const sync_pb::SyncEntity& committed_entry, diff --git a/chrome/browser/sync/engine/process_updates_command.cc b/chrome/browser/sync/engine/process_updates_command.cc index 7ab56d5..d9d397e 100644 --- a/chrome/browser/sync/engine/process_updates_command.cc +++ b/chrome/browser/sync/engine/process_updates_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,18 +33,19 @@ std::set<ModelSafeGroup> ProcessUpdatesCommand::GetGroupsToChange( return session.GetEnabledGroupsWithVerifiedUpdates(); } -void ProcessUpdatesCommand::ModelChangingExecuteImpl(SyncSession* session) { +SyncerError ProcessUpdatesCommand::ModelChangingExecuteImpl( + SyncSession* session) { syncable::ScopedDirLookup dir(session->context()->directory_manager(), session->context()->account_name()); if (!dir.good()) { LOG(ERROR) << "Scoped dir lookup failed!"; - return; + return DIRECTORY_LOOKUP_FAILED; } const sessions::UpdateProgress* progress = session->status_controller().update_progress(); if (!progress) - return; // Nothing to do. + return SYNCER_OK; // Nothing to do. syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir); vector<sessions::VerifiedUpdate>::const_iterator it; @@ -70,6 +71,7 @@ void ProcessUpdatesCommand::ModelChangingExecuteImpl(SyncSession* session) { StatusController* status = session->mutable_status_controller(); status->set_num_consecutive_errors(0); status->mutable_update_progress()->ClearVerifiedUpdates(); + return SYNCER_OK; } namespace { diff --git a/chrome/browser/sync/engine/process_updates_command.h b/chrome/browser/sync/engine/process_updates_command.h index d5dd2be..11fb1e2 100644 --- a/chrome/browser/sync/engine/process_updates_command.h +++ b/chrome/browser/sync/engine/process_updates_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -40,7 +40,7 @@ class ProcessUpdatesCommand : public ModelChangingSyncerCommand { // ModelChangingSyncerCommand implementation. virtual std::set<ModelSafeGroup> GetGroupsToChange( const sessions::SyncSession& session) const OVERRIDE; - virtual void ModelChangingExecuteImpl( + virtual SyncerError ModelChangingExecuteImpl( sessions::SyncSession* session) OVERRIDE; private: diff --git a/chrome/browser/sync/engine/resolve_conflicts_command.cc b/chrome/browser/sync/engine/resolve_conflicts_command.cc index e76b1c7..b175d74 100644 --- a/chrome/browser/sync/engine/resolve_conflicts_command.cc +++ b/chrome/browser/sync/engine/resolve_conflicts_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,26 +19,26 @@ std::set<ModelSafeGroup> ResolveConflictsCommand::GetGroupsToChange( return session.GetEnabledGroupsWithConflicts(); } -void ResolveConflictsCommand::ModelChangingExecuteImpl( +SyncerError ResolveConflictsCommand::ModelChangingExecuteImpl( sessions::SyncSession* session) { ConflictResolver* resolver = session->context()->resolver(); DCHECK(resolver); - if (!resolver) - return; syncable::ScopedDirLookup dir(session->context()->directory_manager(), session->context()->account_name()); if (!dir.good()) - return; + return DIRECTORY_LOOKUP_FAILED; sessions::StatusController* status = session->mutable_status_controller(); const sessions::ConflictProgress* progress = status->conflict_progress(); if (!progress) - return; // Nothing to do. + return SYNCER_OK; // Nothing to do. syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir); const Cryptographer* cryptographer = session->context()->directory_manager()->GetCryptographer(&trans); status->update_conflicts_resolved( resolver->ResolveConflicts(&trans, cryptographer, *progress, status)); + + return SYNCER_OK; } } // namespace browser_sync diff --git a/chrome/browser/sync/engine/resolve_conflicts_command.h b/chrome/browser/sync/engine/resolve_conflicts_command.h index 2407593..2121a31 100644 --- a/chrome/browser/sync/engine/resolve_conflicts_command.h +++ b/chrome/browser/sync/engine/resolve_conflicts_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,7 +21,7 @@ class ResolveConflictsCommand : public ModelChangingSyncerCommand { // ModelChangingSyncerCommand implementation. virtual std::set<ModelSafeGroup> GetGroupsToChange( const sessions::SyncSession& session) const OVERRIDE; - virtual void ModelChangingExecuteImpl( + virtual SyncerError ModelChangingExecuteImpl( sessions::SyncSession* session) OVERRIDE; private: diff --git a/chrome/browser/sync/engine/store_timestamps_command.cc b/chrome/browser/sync/engine/store_timestamps_command.cc index 140191b..64bc5be 100644 --- a/chrome/browser/sync/engine/store_timestamps_command.cc +++ b/chrome/browser/sync/engine/store_timestamps_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,13 +15,14 @@ namespace browser_sync { StoreTimestampsCommand::StoreTimestampsCommand() {} StoreTimestampsCommand::~StoreTimestampsCommand() {} -void StoreTimestampsCommand::ExecuteImpl(sessions::SyncSession* session) { +SyncerError StoreTimestampsCommand::ExecuteImpl( + sessions::SyncSession* session) { syncable::ScopedDirLookup dir(session->context()->directory_manager(), session->context()->account_name()); if (!dir.good()) { LOG(ERROR) << "Scoped dir lookup failed!"; - return; + return DIRECTORY_LOOKUP_FAILED; } const GetUpdatesResponse& updates = @@ -58,6 +59,8 @@ void StoreTimestampsCommand::ExecuteImpl(sessions::SyncSession* session) { DVLOG(1) << "Changes remaining: " << changes_left; status->set_num_server_changes_remaining(changes_left); } + + return SYNCER_OK; } } // namespace browser_sync diff --git a/chrome/browser/sync/engine/store_timestamps_command.h b/chrome/browser/sync/engine/store_timestamps_command.h index c05c2e6..cbc7c83 100644 --- a/chrome/browser/sync/engine/store_timestamps_command.h +++ b/chrome/browser/sync/engine/store_timestamps_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,7 +30,7 @@ class StoreTimestampsCommand : public SyncerCommand { virtual ~StoreTimestampsCommand(); // SyncerCommand implementation. - virtual void ExecuteImpl(sessions::SyncSession* session) OVERRIDE; + virtual SyncerError ExecuteImpl(sessions::SyncSession* session) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(StoreTimestampsCommand); diff --git a/chrome/browser/sync/engine/syncer_command.cc b/chrome/browser/sync/engine/syncer_command.cc index 44e5477..ef2a558 100644 --- a/chrome/browser/sync/engine/syncer_command.cc +++ b/chrome/browser/sync/engine/syncer_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,9 +14,10 @@ using sessions::SyncSession; SyncerCommand::SyncerCommand() {} SyncerCommand::~SyncerCommand() {} -void SyncerCommand::Execute(SyncSession* session) { - ExecuteImpl(session); +SyncerError SyncerCommand::Execute(SyncSession* session) { + SyncerError result = ExecuteImpl(session); SendNotifications(session); + return result; } void SyncerCommand::SendNotifications(SyncSession* session) { diff --git a/chrome/browser/sync/engine/syncer_command.h b/chrome/browser/sync/engine/syncer_command.h index 2aad653..024bbae 100644 --- a/chrome/browser/sync/engine/syncer_command.h +++ b/chrome/browser/sync/engine/syncer_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,8 @@ #include "base/basictypes.h" +#include "chrome/browser/sync/internal_api/includes/syncer_error.h" + namespace browser_sync { namespace sessions { @@ -32,10 +34,10 @@ class SyncerCommand { virtual ~SyncerCommand(); // Execute dispatches to a derived class's ExecuteImpl. - void Execute(sessions::SyncSession* session); + SyncerError Execute(sessions::SyncSession* session); // ExecuteImpl is where derived classes actually do work. - virtual void ExecuteImpl(sessions::SyncSession* session) = 0; + virtual SyncerError ExecuteImpl(sessions::SyncSession* session) = 0; private: void SendNotifications(sessions::SyncSession* session); DISALLOW_COPY_AND_ASSIGN(SyncerCommand); diff --git a/chrome/browser/sync/engine/verify_updates_command.cc b/chrome/browser/sync/engine/verify_updates_command.cc index 96dd4e7..4b5a8ff 100644 --- a/chrome/browser/sync/engine/verify_updates_command.cc +++ b/chrome/browser/sync/engine/verify_updates_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -42,14 +42,14 @@ std::set<ModelSafeGroup> VerifyUpdatesCommand::GetGroupsToChange( return groups_with_updates; } -void VerifyUpdatesCommand::ModelChangingExecuteImpl( +SyncerError VerifyUpdatesCommand::ModelChangingExecuteImpl( sessions::SyncSession* session) { DVLOG(1) << "Beginning Update Verification"; ScopedDirLookup dir(session->context()->directory_manager(), session->context()->account_name()); if (!dir.good()) { LOG(ERROR) << "Scoped dir lookup failed!"; - return; + return DIRECTORY_LOOKUP_FAILED; } WriteTransaction trans(FROM_HERE, SYNCER, dir); sessions::StatusController* status = session->mutable_status_controller(); @@ -72,6 +72,8 @@ void VerifyUpdatesCommand::ModelChangingExecuteImpl( if (update.deleted()) status->increment_num_tombstone_updates_downloaded_by(1); } + + return SYNCER_OK; } namespace { diff --git a/chrome/browser/sync/engine/verify_updates_command.h b/chrome/browser/sync/engine/verify_updates_command.h index 26b0b37..5c6ff05 100644 --- a/chrome/browser/sync/engine/verify_updates_command.h +++ b/chrome/browser/sync/engine/verify_updates_command.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,7 +30,7 @@ class VerifyUpdatesCommand : public ModelChangingSyncerCommand { // ModelChangingSyncerCommand implementation. virtual std::set<ModelSafeGroup> GetGroupsToChange( const sessions::SyncSession& session) const OVERRIDE; - virtual void ModelChangingExecuteImpl( + virtual SyncerError ModelChangingExecuteImpl( sessions::SyncSession* session) OVERRIDE; private: diff --git a/chrome/browser/sync/glue/browser_thread_model_worker.cc b/chrome/browser/sync/glue/browser_thread_model_worker.cc index 91baabe..8fe5ebf 100644 --- a/chrome/browser/sync/glue/browser_thread_model_worker.cc +++ b/chrome/browser/sync/glue/browser_thread_model_worker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,9 +19,9 @@ BrowserThreadModelWorker::BrowserThreadModelWorker( BrowserThreadModelWorker::~BrowserThreadModelWorker() {} -UnrecoverableErrorInfo BrowserThreadModelWorker::DoWorkAndWaitUntilDone( +SyncerError BrowserThreadModelWorker::DoWorkAndWaitUntilDone( const WorkCallback& work) { - UnrecoverableErrorInfo error_info; + SyncerError error = UNSET; if (BrowserThread::CurrentlyOn(thread_)) { DLOG(WARNING) << "Already on thread " << thread_; return work.Run(); @@ -31,20 +31,20 @@ UnrecoverableErrorInfo BrowserThreadModelWorker::DoWorkAndWaitUntilDone( thread_, FROM_HERE, base::Bind(&BrowserThreadModelWorker::CallDoWorkAndSignalTask, this, - work, &done, &error_info))) { + work, &done, &error))) { NOTREACHED() << "Failed to post task to thread " << thread_; - return error_info; + return error; } done.Wait(); - return error_info; + return error; } void BrowserThreadModelWorker::CallDoWorkAndSignalTask( const WorkCallback& work, WaitableEvent* done, - UnrecoverableErrorInfo* error_info) { + SyncerError* error) { DCHECK(BrowserThread::CurrentlyOn(thread_)); - *error_info = work.Run(); + *error = work.Run(); done->Signal(); } @@ -60,8 +60,8 @@ DatabaseModelWorker::~DatabaseModelWorker() {} void DatabaseModelWorker::CallDoWorkAndSignalTask( const WorkCallback& work, WaitableEvent* done, - UnrecoverableErrorInfo* error_info) { - BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error_info); + SyncerError* error) { + BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error); } FileModelWorker::FileModelWorker() @@ -72,8 +72,8 @@ FileModelWorker::~FileModelWorker() {} void FileModelWorker::CallDoWorkAndSignalTask( const WorkCallback& work, WaitableEvent* done, - UnrecoverableErrorInfo* error_info) { - BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error_info); + SyncerError* error) { + BrowserThreadModelWorker::CallDoWorkAndSignalTask(work, done, error); } } // namespace browser_sync diff --git a/chrome/browser/sync/glue/browser_thread_model_worker.h b/chrome/browser/sync/glue/browser_thread_model_worker.h index 6447b7f..b053fa6 100644 --- a/chrome/browser/sync/glue/browser_thread_model_worker.h +++ b/chrome/browser/sync/glue/browser_thread_model_worker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,7 @@ #include "base/callback_forward.h" #include "base/compiler_specific.h" #include "chrome/browser/sync/engine/model_safe_worker.h" -#include "chrome/browser/sync/util/unrecoverable_error_info.h" +#include "chrome/browser/sync/internal_api/includes/syncer_error.h" #include "content/public/browser/browser_thread.h" namespace base { @@ -29,7 +29,7 @@ class BrowserThreadModelWorker : public ModelSafeWorker { virtual ~BrowserThreadModelWorker(); // ModelSafeWorker implementation. Called on the sync thread. - virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( + virtual SyncerError DoWorkAndWaitUntilDone( const WorkCallback& work) OVERRIDE; virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; @@ -40,7 +40,7 @@ class BrowserThreadModelWorker : public ModelSafeWorker { virtual void CallDoWorkAndSignalTask( const WorkCallback& work, base::WaitableEvent* done, - UnrecoverableErrorInfo* error_info) = 0; + SyncerError* error) = 0; private: content::BrowserThread::ID thread_; @@ -61,7 +61,7 @@ class DatabaseModelWorker : public BrowserThreadModelWorker { virtual void CallDoWorkAndSignalTask( const WorkCallback& work, base::WaitableEvent* done, - UnrecoverableErrorInfo* error_info) OVERRIDE; + SyncerError* error) OVERRIDE; }; class FileModelWorker : public BrowserThreadModelWorker { @@ -73,7 +73,7 @@ class FileModelWorker : public BrowserThreadModelWorker { virtual void CallDoWorkAndSignalTask( const WorkCallback& work, base::WaitableEvent* done, - UnrecoverableErrorInfo* error_info) OVERRIDE; + SyncerError* error) OVERRIDE; }; } // namespace browser_sync diff --git a/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc b/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc index 4c6881a..fda74e0 100644 --- a/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc +++ b/chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +11,6 @@ #include "base/threading/thread.h" #include "base/timer.h" #include "chrome/browser/sync/glue/browser_thread_model_worker.h" -#include "chrome/browser/sync/util/unrecoverable_error_info.h" #include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" @@ -54,13 +53,13 @@ class BrowserThreadModelWorkerTest : public testing::Test { } // This is the work that will be scheduled to be done on the DB thread. - UnrecoverableErrorInfo DoWork() { + SyncerError DoWork() { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); timer_.Stop(); // Stop the failure timer so the test succeeds. BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, MessageLoop::QuitClosure()); did_do_work_ = true; - return UnrecoverableErrorInfo(); + return SYNCER_OK; } // This will be called by the OneShotTimer and make the test fail unless diff --git a/chrome/browser/sync/glue/history_model_worker.cc b/chrome/browser/sync/glue/history_model_worker.cc index 88a8193..35d459d 100644 --- a/chrome/browser/sync/glue/history_model_worker.cc +++ b/chrome/browser/sync/glue/history_model_worker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,12 +18,12 @@ class WorkerTask : public HistoryDBTask { WorkerTask( const WorkCallback& work, WaitableEvent* done, - UnrecoverableErrorInfo* error_info) - : work_(work), done_(done), error_info_(error_info) {} + SyncerError* error) + : work_(work), done_(done), error_(error) {} virtual bool RunOnDBThread(history::HistoryBackend* backend, history::HistoryDatabase* db) { - *error_info_ = work_.Run(); + *error_ = work_.Run(); done_->Signal(); return true; } @@ -35,7 +35,7 @@ class WorkerTask : public HistoryDBTask { protected: WorkCallback work_; WaitableEvent* done_; - UnrecoverableErrorInfo* error_info_; + SyncerError* error_; }; @@ -47,14 +47,14 @@ HistoryModelWorker::HistoryModelWorker(HistoryService* history_service) HistoryModelWorker::~HistoryModelWorker() { } -UnrecoverableErrorInfo HistoryModelWorker::DoWorkAndWaitUntilDone( +SyncerError HistoryModelWorker::DoWorkAndWaitUntilDone( const WorkCallback& work) { WaitableEvent done(false, false); - UnrecoverableErrorInfo error_info; - scoped_refptr<WorkerTask> task(new WorkerTask(work, &done, &error_info)); + SyncerError error = UNSET; + scoped_refptr<WorkerTask> task(new WorkerTask(work, &done, &error)); history_service_->ScheduleDBTask(task.get(), &cancelable_consumer_); done.Wait(); - return error_info; + return error; } ModelSafeGroup HistoryModelWorker::GetModelSafeGroup() { diff --git a/chrome/browser/sync/glue/history_model_worker.h b/chrome/browser/sync/glue/history_model_worker.h index 108038a..9dc81b5 100644 --- a/chrome/browser/sync/glue/history_model_worker.h +++ b/chrome/browser/sync/glue/history_model_worker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,7 +7,6 @@ #pragma once #include "chrome/browser/sync/engine/model_safe_worker.h" -#include "chrome/browser/sync/util/unrecoverable_error_info.h" #include "base/basictypes.h" #include "base/callback_forward.h" @@ -27,7 +26,7 @@ class HistoryModelWorker : public browser_sync::ModelSafeWorker { virtual ~HistoryModelWorker(); // ModelSafeWorker implementation. Called on syncapi SyncerThread. - virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( + virtual SyncerError DoWorkAndWaitUntilDone( const WorkCallback& work) OVERRIDE; virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; diff --git a/chrome/browser/sync/glue/password_model_worker.cc b/chrome/browser/sync/glue/password_model_worker.cc index 826cf21..84c95e4 100644 --- a/chrome/browser/sync/glue/password_model_worker.cc +++ b/chrome/browser/sync/glue/password_model_worker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,22 +20,22 @@ PasswordModelWorker::PasswordModelWorker(PasswordStore* password_store) PasswordModelWorker::~PasswordModelWorker() {} -UnrecoverableErrorInfo PasswordModelWorker::DoWorkAndWaitUntilDone( +SyncerError PasswordModelWorker::DoWorkAndWaitUntilDone( const WorkCallback& work) { WaitableEvent done(false, false); - UnrecoverableErrorInfo error_info; + SyncerError error = UNSET; password_store_->ScheduleTask( base::Bind(&PasswordModelWorker::CallDoWorkAndSignalTask, - this, work, &done, &error_info)); + this, work, &done, &error)); done.Wait(); - return error_info; + return error; } void PasswordModelWorker::CallDoWorkAndSignalTask( const WorkCallback& work, WaitableEvent* done, - UnrecoverableErrorInfo* error_info) { - *error_info = work.Run(); + SyncerError *error) { + *error = work.Run(); done->Signal(); } diff --git a/chrome/browser/sync/glue/password_model_worker.h b/chrome/browser/sync/glue/password_model_worker.h index 6e6c76e..92740c7 100644 --- a/chrome/browser/sync/glue/password_model_worker.h +++ b/chrome/browser/sync/glue/password_model_worker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,7 +7,6 @@ #pragma once #include "chrome/browser/sync/engine/model_safe_worker.h" -#include "chrome/browser/sync/util/unrecoverable_error_info.h" #include "base/basictypes.h" #include "base/callback_forward.h" @@ -31,7 +30,7 @@ class PasswordModelWorker : public browser_sync::ModelSafeWorker { virtual ~PasswordModelWorker(); // ModelSafeWorker implementation. Called on syncapi SyncerThread. - virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( + virtual SyncerError DoWorkAndWaitUntilDone( const WorkCallback& work) OVERRIDE; virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; @@ -39,7 +38,7 @@ class PasswordModelWorker : public browser_sync::ModelSafeWorker { void CallDoWorkAndSignalTask( const WorkCallback& work, base::WaitableEvent* done, - UnrecoverableErrorInfo* error_info); + SyncerError* error); scoped_refptr<PasswordStore> password_store_; DISALLOW_COPY_AND_ASSIGN(PasswordModelWorker); diff --git a/chrome/browser/sync/glue/ui_model_worker.cc b/chrome/browser/sync/glue/ui_model_worker.cc index 754f625..096693d 100644 --- a/chrome/browser/sync/glue/ui_model_worker.cc +++ b/chrome/browser/sync/glue/ui_model_worker.cc @@ -21,7 +21,7 @@ namespace { void CallDoWorkAndSignalCallback(const WorkCallback& work, base::WaitableEvent* work_done, UIModelWorker* const scheduler, - UnrecoverableErrorInfo* error_info) { + SyncerError* error_info) { if (work.is_null()) { // This can happen during tests or cases where there are more than just the // default UIModelWorker in existence and it gets destroyed before @@ -44,7 +44,7 @@ void CallDoWorkAndSignalCallback(const WorkCallback& work, } // namespace -UnrecoverableErrorInfo UIModelWorker::DoWorkAndWaitUntilDone( +SyncerError UIModelWorker::DoWorkAndWaitUntilDone( const WorkCallback& 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 @@ -53,7 +53,7 @@ UnrecoverableErrorInfo UIModelWorker::DoWorkAndWaitUntilDone( // 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; + SyncerError error_info; if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { DLOG(WARNING) << "DoWorkAndWaitUntilDone called from " << "ui_loop_. Probably a nested invocation?"; diff --git a/chrome/browser/sync/glue/ui_model_worker.h b/chrome/browser/sync/glue/ui_model_worker.h index 6592570..5d012ba 100644 --- a/chrome/browser/sync/glue/ui_model_worker.h +++ b/chrome/browser/sync/glue/ui_model_worker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -37,7 +37,7 @@ class UIModelWorker : public browser_sync::ModelSafeWorker { void Stop(); // ModelSafeWorker implementation. Called on syncapi SyncerThread. - virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( + virtual SyncerError DoWorkAndWaitUntilDone( const WorkCallback& work) OVERRIDE; virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; diff --git a/chrome/browser/sync/glue/ui_model_worker_unittest.cc b/chrome/browser/sync/glue/ui_model_worker_unittest.cc index 577447e..2a3db64 100644 --- a/chrome/browser/sync/glue/ui_model_worker_unittest.cc +++ b/chrome/browser/sync/glue/ui_model_worker_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,12 +11,11 @@ #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" #include "chrome/browser/sync/glue/ui_model_worker.h" -#include "chrome/browser/sync/util/unrecoverable_error_info.h" #include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" using browser_sync::UIModelWorker; -using browser_sync::UnrecoverableErrorInfo; +using browser_sync::SyncerError; using content::BrowserThread; // Various boilerplate, primarily for the StopWithPendingWork test. @@ -29,12 +28,12 @@ class UIModelWorkerVisitor { was_run_(was_run) { } virtual ~UIModelWorkerVisitor() { } - virtual UnrecoverableErrorInfo DoWork() { + virtual SyncerError DoWork() { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); was_run_->Signal(); if (quit_loop_when_run_) MessageLoop::current()->Quit(); - return UnrecoverableErrorInfo(); + return browser_sync::SYNCER_OK; } private: diff --git a/chrome/browser/sync/internal_api/includes/syncer_error.cc b/chrome/browser/sync/internal_api/includes/syncer_error.cc new file mode 100644 index 0000000..5355a3b --- /dev/null +++ b/chrome/browser/sync/internal_api/includes/syncer_error.cc @@ -0,0 +1,36 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/sync/internal_api/includes/syncer_error.h" + +#include "base/logging.h" + +namespace browser_sync { + +#define ENUM_CASE(x) case x: return #x; break; +const char* GetSyncerErrorString(SyncerError value) { + switch (value) { + ENUM_CASE(UNSET); + ENUM_CASE(DIRECTORY_LOOKUP_FAILED); + ENUM_CASE(NETWORK_CONNECTION_UNAVAILABLE); + ENUM_CASE(NETWORK_IO_ERROR); + ENUM_CASE(SYNC_SERVER_ERROR); + ENUM_CASE(SYNC_AUTH_ERROR); + ENUM_CASE(SERVER_RETURN_INVALID_CREDENTIAL); + ENUM_CASE(SERVER_RETURN_UNKNOWN_ERROR); + ENUM_CASE(SERVER_RETURN_THROTTLED); + ENUM_CASE(SERVER_RETURN_TRANSIENT_ERROR); + ENUM_CASE(SERVER_RETURN_MIGRATION_DONE); + ENUM_CASE(SERVER_RETURN_CLEAR_PENDING); + ENUM_CASE(SERVER_RETURN_NOT_MY_BIRTHDAY); + ENUM_CASE(SERVER_RESPONSE_VALIDATION_FAILED); + ENUM_CASE(SYNCER_OK); + } + NOTREACHED(); + return "INVALID"; +} +#undef ENUM_CASE + +} // namespace browser_sync + diff --git a/chrome/browser/sync/internal_api/includes/syncer_error.h b/chrome/browser/sync/internal_api/includes/syncer_error.h new file mode 100644 index 0000000..1f3c03b --- /dev/null +++ b/chrome/browser/sync/internal_api/includes/syncer_error.h @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_SYNC_INTERNAL_API_INCLUDES_SYNCER_ERROR_H_ +#define CHROME_BROWSER_SYNC_INTERNAL_API_INCLUDES_SYNCER_ERROR_H_ +#pragma once + +namespace browser_sync { + +// This enum describes all the ways a SyncerCommand can fail. +// +// SyncerCommands do many different things, but they share a common function +// signature. This enum, the return value for all SyncerCommands, must be able +// to describe any possible failure for all SyncerComand. +// +// For convenience, functions which are invoked only by SyncerCommands may also +// return a SyncerError. It saves us having to write a conversion function, and +// it makes refactoring easier. +enum SyncerError { + UNSET = 0, // Default value. + DIRECTORY_LOOKUP_FAILED, // Local directory lookup failure. + + NETWORK_CONNECTION_UNAVAILABLE, // Connectivity failure. + NETWORK_IO_ERROR, // Response buffer read error. + SYNC_SERVER_ERROR, // Non auth HTTP error. + SYNC_AUTH_ERROR, // HTTP auth error. + + // Based on values returned by server. Most are defined in sync.proto. + SERVER_RETURN_INVALID_CREDENTIAL, + SERVER_RETURN_UNKNOWN_ERROR, + SERVER_RETURN_THROTTLED, + SERVER_RETURN_TRANSIENT_ERROR, + SERVER_RETURN_MIGRATION_DONE, + SERVER_RETURN_CLEAR_PENDING, + SERVER_RETURN_NOT_MY_BIRTHDAY, + SERVER_RESPONSE_VALIDATION_FAILED, + + SYNCER_OK +}; + +const char * GetSyncerErrorString(SyncerError); + +} // namespace browser_sync + +#endif // CHROME_BROWSER_SYNC_INTERNAL_API_INCLUDES_SYNCER_ERROR_H_ diff --git a/chrome/browser/sync/test/engine/fake_model_worker.cc b/chrome/browser/sync/test/engine/fake_model_worker.cc index 0599350..5b3dc60 100644 --- a/chrome/browser/sync/test/engine/fake_model_worker.cc +++ b/chrome/browser/sync/test/engine/fake_model_worker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,7 +16,7 @@ FakeModelWorker::~FakeModelWorker() { DCHECK(non_thread_safe_.CalledOnValidThread()); } -UnrecoverableErrorInfo FakeModelWorker::DoWorkAndWaitUntilDone( +SyncerError FakeModelWorker::DoWorkAndWaitUntilDone( const WorkCallback& work) { DCHECK(non_thread_safe_.CalledOnValidThread()); // Simply do the work on the current thread. diff --git a/chrome/browser/sync/test/engine/fake_model_worker.h b/chrome/browser/sync/test/engine/fake_model_worker.h index 28e340b..e80a2cd 100644 --- a/chrome/browser/sync/test/engine/fake_model_worker.h +++ b/chrome/browser/sync/test/engine/fake_model_worker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,6 +12,7 @@ #include "base/compiler_specific.h" #include "base/threading/non_thread_safe.h" #include "chrome/browser/sync/engine/model_safe_worker.h" +#include "chrome/browser/sync/internal_api/includes/syncer_error.h" namespace browser_sync { @@ -22,7 +23,7 @@ class FakeModelWorker : public ModelSafeWorker { explicit FakeModelWorker(ModelSafeGroup group); // ModelSafeWorker implementation. - virtual UnrecoverableErrorInfo DoWorkAndWaitUntilDone( + virtual SyncerError DoWorkAndWaitUntilDone( const WorkCallback& work) OVERRIDE; virtual ModelSafeGroup GetModelSafeGroup() OVERRIDE; |