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

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

Issue 10823061: Revert 148792 - [Sync] Remove CleanupDisabledTypes command and move purge logic into SyncManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/internal_api/sync_manager_impl.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_updates_command.h" 13 #include "sync/engine/apply_updates_command.h"
14 #include "sync/engine/build_commit_command.h" 14 #include "sync/engine/build_commit_command.h"
15 #include "sync/engine/cleanup_disabled_types_command.h"
15 #include "sync/engine/commit.h" 16 #include "sync/engine/commit.h"
16 #include "sync/engine/conflict_resolver.h" 17 #include "sync/engine/conflict_resolver.h"
17 #include "sync/engine/download_updates_command.h" 18 #include "sync/engine/download_updates_command.h"
18 #include "sync/engine/net/server_connection_manager.h" 19 #include "sync/engine/net/server_connection_manager.h"
19 #include "sync/engine/process_commit_response_command.h" 20 #include "sync/engine/process_commit_response_command.h"
20 #include "sync/engine/process_updates_command.h" 21 #include "sync/engine/process_updates_command.h"
21 #include "sync/engine/resolve_conflicts_command.h" 22 #include "sync/engine/resolve_conflicts_command.h"
22 #include "sync/engine/store_timestamps_command.h" 23 #include "sync/engine/store_timestamps_command.h"
23 #include "sync/engine/syncer_types.h" 24 #include "sync/engine/syncer_types.h"
24 #include "sync/engine/throttled_data_type_tracker.h" 25 #include "sync/engine/throttled_data_type_tracker.h"
(...skipping 20 matching lines...) Expand all
45 using syncable::SERVER_PARENT_ID; 46 using syncable::SERVER_PARENT_ID;
46 using syncable::SERVER_POSITION_IN_PARENT; 47 using syncable::SERVER_POSITION_IN_PARENT;
47 using syncable::SERVER_SPECIFICS; 48 using syncable::SERVER_SPECIFICS;
48 using syncable::SERVER_VERSION; 49 using syncable::SERVER_VERSION;
49 50
50 #define ENUM_CASE(x) case x: return #x 51 #define ENUM_CASE(x) case x: return #x
51 const char* SyncerStepToString(const SyncerStep step) 52 const char* SyncerStepToString(const SyncerStep step)
52 { 53 {
53 switch (step) { 54 switch (step) {
54 ENUM_CASE(SYNCER_BEGIN); 55 ENUM_CASE(SYNCER_BEGIN);
56 ENUM_CASE(CLEANUP_DISABLED_TYPES);
55 ENUM_CASE(DOWNLOAD_UPDATES); 57 ENUM_CASE(DOWNLOAD_UPDATES);
56 ENUM_CASE(PROCESS_CLIENT_COMMAND); 58 ENUM_CASE(PROCESS_CLIENT_COMMAND);
57 ENUM_CASE(VERIFY_UPDATES); 59 ENUM_CASE(VERIFY_UPDATES);
58 ENUM_CASE(PROCESS_UPDATES); 60 ENUM_CASE(PROCESS_UPDATES);
59 ENUM_CASE(STORE_TIMESTAMPS); 61 ENUM_CASE(STORE_TIMESTAMPS);
60 ENUM_CASE(APPLY_UPDATES); 62 ENUM_CASE(APPLY_UPDATES);
61 ENUM_CASE(COMMIT); 63 ENUM_CASE(COMMIT);
62 ENUM_CASE(RESOLVE_CONFLICTS); 64 ENUM_CASE(RESOLVE_CONFLICTS);
63 ENUM_CASE(APPLY_UPDATES_TO_RESOLVE_CONFLICTS); 65 ENUM_CASE(APPLY_UPDATES_TO_RESOLVE_CONFLICTS);
64 ENUM_CASE(SYNCER_END); 66 ENUM_CASE(SYNCER_END);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 TRACE_EVENT1("sync", "SyncerStateMachine", 99 TRACE_EVENT1("sync", "SyncerStateMachine",
98 "state", SyncerStepToString(current_step)); 100 "state", SyncerStepToString(current_step));
99 DVLOG(1) << "Syncer step:" << SyncerStepToString(current_step); 101 DVLOG(1) << "Syncer step:" << SyncerStepToString(current_step);
100 102
101 switch (current_step) { 103 switch (current_step) {
102 case SYNCER_BEGIN: 104 case SYNCER_BEGIN:
103 session->context()->throttled_data_type_tracker()-> 105 session->context()->throttled_data_type_tracker()->
104 PruneUnthrottledTypes(base::TimeTicks::Now()); 106 PruneUnthrottledTypes(base::TimeTicks::Now());
105 session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_BEGIN); 107 session->SendEventNotification(SyncEngineEvent::SYNC_CYCLE_BEGIN);
106 108
109 next_step = CLEANUP_DISABLED_TYPES;
110 break;
111 case CLEANUP_DISABLED_TYPES: {
112 CleanupDisabledTypesCommand cleanup;
113 cleanup.Execute(session);
107 next_step = DOWNLOAD_UPDATES; 114 next_step = DOWNLOAD_UPDATES;
108 break; 115 break;
116 }
109 case DOWNLOAD_UPDATES: { 117 case DOWNLOAD_UPDATES: {
110 // TODO(akalin): We may want to propagate this switch up 118 // TODO(akalin): We may want to propagate this switch up
111 // eventually. 119 // eventually.
112 #if defined(OS_ANDROID) 120 #if defined(OS_ANDROID)
113 const bool kCreateMobileBookmarksFolder = true; 121 const bool kCreateMobileBookmarksFolder = true;
114 #else 122 #else
115 const bool kCreateMobileBookmarksFolder = false; 123 const bool kCreateMobileBookmarksFolder = false;
116 #endif 124 #endif
117 DownloadUpdatesCommand download_updates(kCreateMobileBookmarksFolder); 125 DownloadUpdatesCommand download_updates(kCreateMobileBookmarksFolder);
118 session->mutable_status_controller()->set_last_download_updates_result( 126 session->mutable_status_controller()->set_last_download_updates_result(
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 entry->Put(SERVER_CTIME, Time()); 289 entry->Put(SERVER_CTIME, Time());
282 entry->Put(SERVER_VERSION, 0); 290 entry->Put(SERVER_VERSION, 0);
283 entry->Put(SERVER_IS_DIR, false); 291 entry->Put(SERVER_IS_DIR, false);
284 entry->Put(SERVER_IS_DEL, false); 292 entry->Put(SERVER_IS_DEL, false);
285 entry->Put(IS_UNAPPLIED_UPDATE, false); 293 entry->Put(IS_UNAPPLIED_UPDATE, false);
286 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); 294 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance());
287 entry->Put(SERVER_POSITION_IN_PARENT, 0); 295 entry->Put(SERVER_POSITION_IN_PARENT, 0);
288 } 296 }
289 297
290 } // namespace syncer 298 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer.h ('k') | sync/internal_api/sync_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698