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

Side by Side Diff: sync/engine/syncer.cc

Issue 72403003: sync: Per-type update application (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + fix typo Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/engine/syncer.h ('k') | sync/engine/syncer_command.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/engine/syncer.h" 5 #include "sync/engine/syncer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "sync/engine/apply_control_data_updates.h" 13 #include "sync/engine/apply_control_data_updates.h"
14 #include "sync/engine/apply_updates_and_resolve_conflicts_command.h"
15 #include "sync/engine/commit.h" 14 #include "sync/engine/commit.h"
16 #include "sync/engine/conflict_resolver.h" 15 #include "sync/engine/conflict_resolver.h"
17 #include "sync/engine/download.h" 16 #include "sync/engine/download.h"
18 #include "sync/engine/net/server_connection_manager.h" 17 #include "sync/engine/net/server_connection_manager.h"
19 #include "sync/engine/syncer_types.h" 18 #include "sync/engine/syncer_types.h"
20 #include "sync/internal_api/public/base/cancelation_signal.h" 19 #include "sync/internal_api/public/base/cancelation_signal.h"
21 #include "sync/internal_api/public/base/unique_position.h" 20 #include "sync/internal_api/public/base/unique_position.h"
22 #include "sync/internal_api/public/util/syncer_error.h" 21 #include "sync/internal_api/public/util/syncer_error.h"
23 #include "sync/sessions/nudge_tracker.h" 22 #include "sync/sessions/nudge_tracker.h"
24 #include "sync/syncable/directory.h" 23 #include "sync/syncable/directory.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 kCreateMobileBookmarksFolder, 107 kCreateMobileBookmarksFolder,
109 request_types)); 108 request_types));
110 return HandleCycleEnd(session, sync_pb::GetUpdatesCallerInfo::PERIODIC); 109 return HandleCycleEnd(session, sync_pb::GetUpdatesCallerInfo::PERIODIC);
111 } 110 }
112 111
113 void Syncer::ApplyUpdates(SyncSession* session) { 112 void Syncer::ApplyUpdates(SyncSession* session) {
114 TRACE_EVENT0("sync", "ApplyUpdates"); 113 TRACE_EVENT0("sync", "ApplyUpdates");
115 114
116 ApplyControlDataUpdates(session->context()->directory()); 115 ApplyControlDataUpdates(session->context()->directory());
117 116
118 ApplyUpdatesAndResolveConflictsCommand apply_updates; 117 UpdateHandlerMap* handler_map = session->context()->update_handler_map();
119 apply_updates.Execute(session); 118 for (UpdateHandlerMap::iterator it = handler_map->begin();
119 it != handler_map->end(); ++it) {
120 it->second->ApplyUpdates(session->mutable_status_controller());
121 }
120 122
121 session->context()->set_hierarchy_conflict_detected( 123 session->context()->set_hierarchy_conflict_detected(
122 session->status_controller().num_hierarchy_conflicts() > 0); 124 session->status_controller().num_hierarchy_conflicts() > 0);
123 125
124 session->SendEventNotification(SyncEngineEvent::STATUS_CHANGED); 126 session->SendEventNotification(SyncEngineEvent::STATUS_CHANGED);
125 } 127 }
126 128
127 bool Syncer::DownloadAndApplyUpdates( 129 bool Syncer::DownloadAndApplyUpdates(
128 ModelTypeSet request_types, 130 ModelTypeSet request_types,
129 SyncSession* session, 131 SyncSession* session,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { 191 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) {
190 if (!ExitRequested()) { 192 if (!ExitRequested()) {
191 session->SendSyncCycleEndEventNotification(source); 193 session->SendSyncCycleEndEventNotification(source);
192 return true; 194 return true;
193 } else { 195 } else {
194 return false; 196 return false;
195 } 197 }
196 } 198 }
197 199
198 } // namespace syncer 200 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer.h ('k') | sync/engine/syncer_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698