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

Unified Diff: chrome/browser/sync/engine/process_updates_command.cc

Issue 386030: Relieve SyncerSession,SyncCycleState, SyncProcessState, SyncerSession, Syncer... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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/engine/process_updates_command.cc
===================================================================
--- chrome/browser/sync/engine/process_updates_command.cc (revision 32731)
+++ chrome/browser/sync/engine/process_updates_command.cc (working copy)
@@ -9,9 +9,9 @@
#include "base/basictypes.h"
#include "chrome/browser/sync/engine/syncer.h"
#include "chrome/browser/sync/engine/syncer_proto_util.h"
-#include "chrome/browser/sync/engine/syncer_session.h"
#include "chrome/browser/sync/engine/syncer_util.h"
#include "chrome/browser/sync/engine/syncproto.h"
+#include "chrome/browser/sync/sessions/sync_session.h"
#include "chrome/browser/sync/syncable/directory_manager.h"
#include "chrome/browser/sync/syncable/syncable.h"
@@ -19,27 +19,32 @@
namespace browser_sync {
+using sessions::SyncSession;
+using sessions::StatusController;
+
ProcessUpdatesCommand::ProcessUpdatesCommand() {}
ProcessUpdatesCommand::~ProcessUpdatesCommand() {}
-void ProcessUpdatesCommand::ModelChangingExecuteImpl(SyncerSession* session) {
- syncable::ScopedDirLookup dir(session->dirman(), session->account_name());
+void 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;
}
- SyncerStatus status(session);
- const GetUpdatesResponse updates = session->update_response().get_updates();
+ const GetUpdatesResponse& updates =
+ session->status_controller()->updates_response().get_updates();
const int update_count = updates.entries_size();
LOG(INFO) << "Get updates from ts " << dir->last_sync_timestamp() <<
" returned " << update_count << " updates.";
+ StatusController* status = session->status_controller();
if (updates.has_changes_remaining()) {
int64 changes_left = updates.changes_remaining();
LOG(INFO) << "Changes remaining:" << changes_left;
- status.set_num_server_changes_remaining(changes_left);
+ status->set_num_server_changes_remaining(changes_left);
}
int64 new_timestamp = 0;
@@ -49,7 +54,7 @@
if (0 == update_count) {
if (new_timestamp > dir->last_sync_timestamp()) {
dir->set_last_sync_timestamp(new_timestamp);
- session->set_timestamp_dirty();
+ status->set_timestamp_dirty(true);
}
return;
}
@@ -60,11 +65,12 @@
// be skipped and we DON'T step past them, we will sync forever.
int64 latest_skip_timestamp = 0;
bool any_non_skip_results = false;
- vector<VerifiedUpdate>::iterator it;
- for (it = session->VerifiedUpdatesBegin();
- it < session->VerifiedUpdatesEnd();
+ const sessions::UpdateProgress& progress(status->update_progress());
+ vector<sessions::VerifiedUpdate>::const_iterator it;
+ for (it = progress.VerifiedUpdatesBegin();
+ it != progress.VerifiedUpdatesEnd();
++it) {
- const sync_pb::SyncEntity update = it->second;
+ const sync_pb::SyncEntity& update = it->second;
any_non_skip_results = (it->first != VERIFY_SKIP);
if (!any_non_skip_results) {
@@ -98,13 +104,13 @@
if (new_timestamp > dir->last_sync_timestamp()) {
dir->set_last_sync_timestamp(new_timestamp);
- session->set_timestamp_dirty();
+ status->set_timestamp_dirty(true);
}
- status.zero_consecutive_problem_get_updates();
- status.zero_consecutive_errors();
- status.set_current_sync_timestamp(dir->last_sync_timestamp());
- status.set_syncing(true);
+ status->set_num_consecutive_problem_get_updates(0);
+ status->set_num_consecutive_errors(0);
+ status->set_current_sync_timestamp(dir->last_sync_timestamp());
+ status->set_syncing(true);
return;
}
« no previous file with comments | « chrome/browser/sync/engine/process_updates_command.h ('k') | chrome/browser/sync/engine/resolve_conflicts_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698