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

Side by Side Diff: components/sync/tools/sync_client.cc

Issue 2644373003: Revert of [Sync] Make directory types registration explicit in ModelTypeRegistry (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « components/sync/engine_impl/syncer_unittest.cc ('k') | no next file » | 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <cstdio> 8 #include <cstdio>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 model_types.Put(HISTORY_DELETE_DIRECTIVES); 371 model_types.Put(HISTORY_DELETE_DIRECTIVES);
372 model_types.Put(SYNCED_NOTIFICATIONS); 372 model_types.Put(SYNCED_NOTIFICATIONS);
373 model_types.Put(SYNCED_NOTIFICATION_APP_INFO); 373 model_types.Put(SYNCED_NOTIFICATION_APP_INFO);
374 model_types.Put(DEVICE_INFO); 374 model_types.Put(DEVICE_INFO);
375 model_types.Put(EXPERIMENTS); 375 model_types.Put(EXPERIMENTS);
376 model_types.Put(PRIORITY_PREFERENCES); 376 model_types.Put(PRIORITY_PREFERENCES);
377 model_types.Put(DICTIONARY); 377 model_types.Put(DICTIONARY);
378 model_types.Put(FAVICON_IMAGES); 378 model_types.Put(FAVICON_IMAGES);
379 model_types.Put(FAVICON_TRACKING); 379 model_types.Put(FAVICON_TRACKING);
380 380
381 ModelSafeRoutingInfo routing_info;
382 for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) {
383 routing_info[it.Get()] = GROUP_PASSIVE;
384 }
381 scoped_refptr<PassiveModelWorker> passive_model_safe_worker = 385 scoped_refptr<PassiveModelWorker> passive_model_safe_worker =
382 new PassiveModelWorker(); 386 new PassiveModelWorker();
383 std::vector<scoped_refptr<ModelSafeWorker>> workers; 387 std::vector<scoped_refptr<ModelSafeWorker>> workers;
384 workers.push_back(passive_model_safe_worker); 388 workers.push_back(passive_model_safe_worker);
385 389
386 // Set up sync manager. 390 // Set up sync manager.
387 SyncManagerFactory sync_manager_factory; 391 SyncManagerFactory sync_manager_factory;
388 std::unique_ptr<SyncManager> sync_manager = 392 std::unique_ptr<SyncManager> sync_manager =
389 sync_manager_factory.CreateSyncManager("sync_client manager"); 393 sync_manager_factory.CreateSyncManager("sync_client manager");
390 LoggingJsEventHandler js_event_handler; 394 LoggingJsEventHandler js_event_handler;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 args.cancelation_signal = &scm_cancelation_signal; 435 args.cancelation_signal = &scm_cancelation_signal;
432 sync_manager->Init(&args); 436 sync_manager->Init(&args);
433 // TODO(akalin): Avoid passing in model parameters multiple times by 437 // TODO(akalin): Avoid passing in model parameters multiple times by
434 // organizing handling of model types. 438 // organizing handling of model types.
435 invalidator->UpdateCredentials(credentials.email, credentials.sync_token); 439 invalidator->UpdateCredentials(credentials.email, credentials.sync_token);
436 std::unique_ptr<InvalidatorShim> shim( 440 std::unique_ptr<InvalidatorShim> shim(
437 new InvalidatorShim(sync_manager.get())); 441 new InvalidatorShim(sync_manager.get()));
438 invalidator->RegisterHandler(shim.get()); 442 invalidator->RegisterHandler(shim.get());
439 CHECK(invalidator->UpdateRegisteredIds( 443 CHECK(invalidator->UpdateRegisteredIds(
440 shim.get(), ModelTypeSetToObjectIdSet(model_types))); 444 shim.get(), ModelTypeSetToObjectIdSet(model_types)));
441 ModelTypeConnector* model_type_connector = 445 sync_manager->StartSyncingNormally(routing_info, base::Time());
442 sync_manager->GetModelTypeConnector();
443 for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) {
444 model_type_connector->RegisterDirectoryType(it.Get(), GROUP_PASSIVE);
445 }
446
447 sync_manager->StartSyncingNormally(base::Time());
448 446
449 base::RunLoop().Run(); 447 base::RunLoop().Run();
450 448
451 io_thread.Stop(); 449 io_thread.Stop();
452 return 0; 450 return 0;
453 } 451 }
454 452
455 } // namespace 453 } // namespace
456 } // namespace syncer 454 } // namespace syncer
457 455
458 int main(int argc, char* argv[]) { 456 int main(int argc, char* argv[]) {
459 return syncer::SyncClientMain(argc, argv); 457 return syncer::SyncClientMain(argc, argv);
460 } 458 }
OLDNEW
« no previous file with comments | « components/sync/engine_impl/syncer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698