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

Unified Diff: sync/engine/syncer.cc

Issue 25638003: sync: Implement per-type commit interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Attempt to fix win compile Created 7 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
« no previous file with comments | « sync/engine/syncer.h ('k') | sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/syncer.cc
diff --git a/sync/engine/syncer.cc b/sync/engine/syncer.cc
index cc379d9d82baaabe5d29787713d191bd9d347f4d..9f2c378b5cc42391d14b3c7f7a5f8be09758f227 100644
--- a/sync/engine/syncer.cc
+++ b/sync/engine/syncer.cc
@@ -12,17 +12,16 @@
#include "build/build_config.h"
#include "sync/engine/apply_control_data_updates.h"
#include "sync/engine/apply_updates_and_resolve_conflicts_command.h"
-#include "sync/engine/build_commit_command.h"
#include "sync/engine/commit.h"
#include "sync/engine/conflict_resolver.h"
#include "sync/engine/download.h"
#include "sync/engine/net/server_connection_manager.h"
-#include "sync/engine/process_commit_response_command.h"
#include "sync/engine/syncer_types.h"
#include "sync/internal_api/public/base/cancelation_signal.h"
#include "sync/internal_api/public/base/unique_position.h"
#include "sync/internal_api/public/util/syncer_error.h"
#include "sync/sessions/nudge_tracker.h"
+#include "sync/syncable/directory.h"
#include "sync/syncable/mutable_entry.h"
#include "sync/syncable/syncable-inl.h"
@@ -73,7 +72,7 @@ bool Syncer::NormalSyncShare(ModelTypeSet request_types,
}
VLOG(1) << "Committing from types " << ModelTypeSetToString(request_types);
- SyncerError commit_result = BuildAndPostCommits(request_types, this, session);
+ SyncerError commit_result = BuildAndPostCommits(request_types, session);
session->mutable_status_controller()->set_commit_result(commit_result);
return HandleCycleEnd(session, nudge_tracker.updates_source());
@@ -144,6 +143,37 @@ bool Syncer::DownloadAndApplyUpdates(
return true;
}
+SyncerError Syncer::BuildAndPostCommits(ModelTypeSet requested_types,
+ sessions::SyncSession* session) {
+ // The ExitRequested() check is unnecessary, since we should start getting
+ // errors from the ServerConnectionManager if an exist has been requested.
+ // However, it doesn't hurt to check it anyway.
+ while (!ExitRequested()) {
+ scoped_ptr<Commit> commit(
+ Commit::Init(
+ requested_types,
+ session->context()->max_commit_batch_size(),
+ session->context()->account_name(),
+ session->context()->directory()->cache_guid(),
+ session->context()->commit_contributor_map(),
+ session->context()->extensions_activity()));
+ if (!commit) {
+ break;
+ }
+
+ SyncerError error = commit->PostAndProcessResponse(
+ session,
+ session->mutable_status_controller(),
+ session->context()->extensions_activity());
+ commit->CleanUp();
+ if (error != SYNCER_OK) {
+ return error;
+ }
+ }
+
+ return SYNCER_OK;
+}
+
void Syncer::HandleCycleBegin(SyncSession* session) {
session->mutable_status_controller()->UpdateStartTime();
session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_BEGIN);
« no previous file with comments | « sync/engine/syncer.h ('k') | sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698