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

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

Issue 2641523004: [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
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 }
385 scoped_refptr<PassiveModelWorker> passive_model_safe_worker = 381 scoped_refptr<PassiveModelWorker> passive_model_safe_worker =
386 new PassiveModelWorker(); 382 new PassiveModelWorker();
387 std::vector<scoped_refptr<ModelSafeWorker>> workers; 383 std::vector<scoped_refptr<ModelSafeWorker>> workers;
388 workers.push_back(passive_model_safe_worker); 384 workers.push_back(passive_model_safe_worker);
389 385
390 // Set up sync manager. 386 // Set up sync manager.
391 SyncManagerFactory sync_manager_factory; 387 SyncManagerFactory sync_manager_factory;
392 std::unique_ptr<SyncManager> sync_manager = 388 std::unique_ptr<SyncManager> sync_manager =
393 sync_manager_factory.CreateSyncManager("sync_client manager"); 389 sync_manager_factory.CreateSyncManager("sync_client manager");
394 LoggingJsEventHandler js_event_handler; 390 LoggingJsEventHandler js_event_handler;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 args.cancelation_signal = &scm_cancelation_signal; 431 args.cancelation_signal = &scm_cancelation_signal;
436 sync_manager->Init(&args); 432 sync_manager->Init(&args);
437 // TODO(akalin): Avoid passing in model parameters multiple times by 433 // TODO(akalin): Avoid passing in model parameters multiple times by
438 // organizing handling of model types. 434 // organizing handling of model types.
439 invalidator->UpdateCredentials(credentials.email, credentials.sync_token); 435 invalidator->UpdateCredentials(credentials.email, credentials.sync_token);
440 std::unique_ptr<InvalidatorShim> shim( 436 std::unique_ptr<InvalidatorShim> shim(
441 new InvalidatorShim(sync_manager.get())); 437 new InvalidatorShim(sync_manager.get()));
442 invalidator->RegisterHandler(shim.get()); 438 invalidator->RegisterHandler(shim.get());
443 CHECK(invalidator->UpdateRegisteredIds( 439 CHECK(invalidator->UpdateRegisteredIds(
444 shim.get(), ModelTypeSetToObjectIdSet(model_types))); 440 shim.get(), ModelTypeSetToObjectIdSet(model_types)));
445 sync_manager->StartSyncingNormally(routing_info, base::Time()); 441 std::unique_ptr<ModelTypeConnector> model_type_connector =
442 sync_manager->GetModelTypeConnectorProxy();
443 for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) {
444 model_type_connector->RegisterDirectoryType(it.Get(), GROUP_PASSIVE);
maxbogue 2017/01/18 01:24:11 Same comment here as SBHC.
pavely 2017/01/18 20:18:07 Done.
445 }
446
447 sync_manager->StartSyncingNormally(base::Time());
446 448
447 base::RunLoop().Run(); 449 base::RunLoop().Run();
448 450
449 io_thread.Stop(); 451 io_thread.Stop();
450 return 0; 452 return 0;
451 } 453 }
452 454
453 } // namespace 455 } // namespace
454 } // namespace syncer 456 } // namespace syncer
455 457
456 int main(int argc, char* argv[]) { 458 int main(int argc, char* argv[]) {
457 return syncer::SyncClientMain(argc, argv); 459 return syncer::SyncClientMain(argc, argv);
458 } 460 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698