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

Unified Diff: sync/engine/syncer.cc

Issue 10210009: sync: Loop committing items without downloading updates (v2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor loop again, add comments + more Created 8 years, 7 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: sync/engine/syncer.cc
diff --git a/sync/engine/syncer.cc b/sync/engine/syncer.cc
index 5de4ae576f6871e4ad94ed92d9d53a8a258ad4e3..ac6b5eb787e354f94b2d5daab3f6ae9c1b631088 100644
--- a/sync/engine/syncer.cc
+++ b/sync/engine/syncer.cc
@@ -14,11 +14,10 @@
#include "sync/engine/build_commit_command.h"
#include "sync/engine/cleanup_disabled_types_command.h"
#include "sync/engine/clear_data_command.h"
+#include "sync/engine/commit.h"
#include "sync/engine/conflict_resolver.h"
#include "sync/engine/download_updates_command.h"
-#include "sync/engine/get_commit_ids_command.h"
#include "sync/engine/net/server_connection_manager.h"
-#include "sync/engine/post_commit_message_command.h"
#include "sync/engine/process_commit_response_command.h"
#include "sync/engine/process_updates_command.h"
#include "sync/engine/resolve_conflicts_command.h"
@@ -65,9 +64,7 @@ const char* SyncerStepToString(const SyncerStep step)
ENUM_CASE(PROCESS_UPDATES);
ENUM_CASE(STORE_TIMESTAMPS);
ENUM_CASE(APPLY_UPDATES);
- ENUM_CASE(BUILD_COMMIT_REQUEST);
- ENUM_CASE(POST_COMMIT_MESSAGE);
- ENUM_CASE(PROCESS_COMMIT_RESPONSE);
+ ENUM_CASE(COMMIT);
ENUM_CASE(RESOLVE_CONFLICTS);
ENUM_CASE(APPLY_UPDATES_TO_RESOLVE_CONFLICTS);
ENUM_CASE(CLEAR_PRIVATE_DATA);
@@ -180,59 +177,12 @@ void Syncer::SyncShare(sessions::SyncSession* session,
last_step = SYNCER_END;
next_step = SYNCER_END;
} else {
- next_step = BUILD_COMMIT_REQUEST;
+ next_step = COMMIT;
}
break;
}
- // These two steps are combined since they are executed within the same
- // write transaction.
- case BUILD_COMMIT_REQUEST: {
- syncable::Directory* dir = session->context()->directory();
- WriteTransaction trans(FROM_HERE, SYNCER, dir);
- sessions::ScopedSetSessionWriteTransaction set_trans(session, &trans);
-
- DVLOG(1) << "Getting the Commit IDs";
- GetCommitIdsCommand get_commit_ids_command(
- session->context()->max_commit_batch_size());
- get_commit_ids_command.Execute(session);
-
- if (!session->status_controller().commit_ids().empty()) {
- DVLOG(1) << "Building a commit message";
-
- // This isn't perfect, since the set of extensions activity may not
- // correlate exactly with the items being committed. That's OK as
- // long as we're looking for a rough estimate of extensions activity,
- // not an precise mapping of which commits were triggered by which
- // extension.
- //
- // We will push this list of extensions activity back into the
- // ExtensionsActivityMonitor if this commit turns out to not contain
- // any bookmarks, or if the commit fails.
- session->context()->extensions_monitor()->GetAndClearRecords(
- session->mutable_extensions_activity());
-
- BuildCommitCommand build_commit_command;
- build_commit_command.Execute(session);
-
- next_step = POST_COMMIT_MESSAGE;
- } else {
- next_step = RESOLVE_CONFLICTS;
- }
-
- break;
- }
- case POST_COMMIT_MESSAGE: {
- PostCommitMessageCommand post_commit_command;
- session->mutable_status_controller()->set_last_post_commit_result(
- post_commit_command.Execute(session));
- next_step = PROCESS_COMMIT_RESPONSE;
- break;
- }
- case PROCESS_COMMIT_RESPONSE: {
- ProcessCommitResponseCommand process_response_command;
- session->mutable_status_controller()->
- set_last_process_commit_response_result(
- process_response_command.Execute(session));
+ case COMMIT: {
+ BuildAndPostCommits(this, session);
next_step = RESOLVE_CONFLICTS;
break;
}

Powered by Google App Engine
This is Rietveld 408576698