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

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

Issue 11091009: sync: Merge {Verify,Process}UpdatesCommand (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Amend comment Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/engine/syncer.h ('k') | sync/engine/verify_updates_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.h" 10 #include "base/message_loop.h"
11 #include "base/time.h" 11 #include "base/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_command.h" 14 #include "sync/engine/apply_updates_command.h"
15 #include "sync/engine/build_commit_command.h" 15 #include "sync/engine/build_commit_command.h"
16 #include "sync/engine/commit.h" 16 #include "sync/engine/commit.h"
17 #include "sync/engine/conflict_resolver.h" 17 #include "sync/engine/conflict_resolver.h"
18 #include "sync/engine/download_updates_command.h" 18 #include "sync/engine/download_updates_command.h"
19 #include "sync/engine/net/server_connection_manager.h" 19 #include "sync/engine/net/server_connection_manager.h"
20 #include "sync/engine/process_commit_response_command.h" 20 #include "sync/engine/process_commit_response_command.h"
21 #include "sync/engine/process_updates_command.h" 21 #include "sync/engine/process_updates_command.h"
22 #include "sync/engine/resolve_conflicts_command.h" 22 #include "sync/engine/resolve_conflicts_command.h"
23 #include "sync/engine/store_timestamps_command.h" 23 #include "sync/engine/store_timestamps_command.h"
24 #include "sync/engine/syncer_types.h" 24 #include "sync/engine/syncer_types.h"
25 #include "sync/engine/throttled_data_type_tracker.h" 25 #include "sync/engine/throttled_data_type_tracker.h"
26 #include "sync/engine/verify_updates_command.h"
27 #include "sync/syncable/mutable_entry.h" 26 #include "sync/syncable/mutable_entry.h"
28 #include "sync/syncable/syncable-inl.h" 27 #include "sync/syncable/syncable-inl.h"
29 28
30 // TODO(vishwath): Remove this include after node positions have 29 // TODO(vishwath): Remove this include after node positions have
31 // shifted to completely using Ordinals. 30 // shifted to completely using Ordinals.
32 // See http://crbug.com/145412 . 31 // See http://crbug.com/145412 .
33 #include "sync/internal_api/public/base/node_ordinal.h" 32 #include "sync/internal_api/public/base/node_ordinal.h"
34 33
35 using base::Time; 34 using base::Time;
36 using base::TimeDelta; 35 using base::TimeDelta;
(...skipping 14 matching lines...) Expand all
51 using syncable::SERVER_ORDINAL_IN_PARENT; 50 using syncable::SERVER_ORDINAL_IN_PARENT;
52 using syncable::SERVER_SPECIFICS; 51 using syncable::SERVER_SPECIFICS;
53 using syncable::SERVER_VERSION; 52 using syncable::SERVER_VERSION;
54 53
55 #define ENUM_CASE(x) case x: return #x 54 #define ENUM_CASE(x) case x: return #x
56 const char* SyncerStepToString(const SyncerStep step) 55 const char* SyncerStepToString(const SyncerStep step)
57 { 56 {
58 switch (step) { 57 switch (step) {
59 ENUM_CASE(SYNCER_BEGIN); 58 ENUM_CASE(SYNCER_BEGIN);
60 ENUM_CASE(DOWNLOAD_UPDATES); 59 ENUM_CASE(DOWNLOAD_UPDATES);
61 ENUM_CASE(VERIFY_UPDATES);
62 ENUM_CASE(PROCESS_UPDATES); 60 ENUM_CASE(PROCESS_UPDATES);
63 ENUM_CASE(STORE_TIMESTAMPS); 61 ENUM_CASE(STORE_TIMESTAMPS);
64 ENUM_CASE(APPLY_UPDATES); 62 ENUM_CASE(APPLY_UPDATES);
65 ENUM_CASE(COMMIT); 63 ENUM_CASE(COMMIT);
66 ENUM_CASE(RESOLVE_CONFLICTS); 64 ENUM_CASE(RESOLVE_CONFLICTS);
67 ENUM_CASE(APPLY_UPDATES_TO_RESOLVE_CONFLICTS); 65 ENUM_CASE(APPLY_UPDATES_TO_RESOLVE_CONFLICTS);
68 ENUM_CASE(SYNCER_END); 66 ENUM_CASE(SYNCER_END);
69 } 67 }
70 NOTREACHED(); 68 NOTREACHED();
71 return ""; 69 return "";
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // TODO(akalin): We may want to propagate this switch up 112 // TODO(akalin): We may want to propagate this switch up
115 // eventually. 113 // eventually.
116 #if defined(OS_ANDROID) || defined(OS_IOS) 114 #if defined(OS_ANDROID) || defined(OS_IOS)
117 const bool kCreateMobileBookmarksFolder = true; 115 const bool kCreateMobileBookmarksFolder = true;
118 #else 116 #else
119 const bool kCreateMobileBookmarksFolder = false; 117 const bool kCreateMobileBookmarksFolder = false;
120 #endif 118 #endif
121 DownloadUpdatesCommand download_updates(kCreateMobileBookmarksFolder); 119 DownloadUpdatesCommand download_updates(kCreateMobileBookmarksFolder);
122 session->mutable_status_controller()->set_last_download_updates_result( 120 session->mutable_status_controller()->set_last_download_updates_result(
123 download_updates.Execute(session)); 121 download_updates.Execute(session));
124 next_step = VERIFY_UPDATES;
125 break;
126 }
127 case VERIFY_UPDATES: {
128 VerifyUpdatesCommand verify_updates;
129 verify_updates.Execute(session);
130 next_step = PROCESS_UPDATES; 122 next_step = PROCESS_UPDATES;
131 break; 123 break;
132 } 124 }
133 case PROCESS_UPDATES: { 125 case PROCESS_UPDATES: {
134 ProcessUpdatesCommand process_updates; 126 ProcessUpdatesCommand process_updates;
135 process_updates.Execute(session); 127 process_updates.Execute(session);
136 next_step = STORE_TIMESTAMPS; 128 next_step = STORE_TIMESTAMPS;
137 break; 129 break;
138 } 130 }
139 case STORE_TIMESTAMPS: { 131 case STORE_TIMESTAMPS: {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 entry->Put(SERVER_CTIME, Time()); 248 entry->Put(SERVER_CTIME, Time());
257 entry->Put(SERVER_VERSION, 0); 249 entry->Put(SERVER_VERSION, 0);
258 entry->Put(SERVER_IS_DIR, false); 250 entry->Put(SERVER_IS_DIR, false);
259 entry->Put(SERVER_IS_DEL, false); 251 entry->Put(SERVER_IS_DEL, false);
260 entry->Put(IS_UNAPPLIED_UPDATE, false); 252 entry->Put(IS_UNAPPLIED_UPDATE, false);
261 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); 253 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance());
262 entry->Put(SERVER_ORDINAL_IN_PARENT, Int64ToNodeOrdinal(0)); 254 entry->Put(SERVER_ORDINAL_IN_PARENT, Int64ToNodeOrdinal(0));
263 } 255 }
264 256
265 } // namespace syncer 257 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer.h ('k') | sync/engine/verify_updates_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698