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

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

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 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
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter { 91 class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter {
92 public: 92 public:
93 explicit MyTestURLRequestContextGetter( 93 explicit MyTestURLRequestContextGetter(
94 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) 94 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner)
95 : TestURLRequestContextGetter(io_task_runner) {} 95 : TestURLRequestContextGetter(io_task_runner) {}
96 96
97 net::TestURLRequestContext* GetURLRequestContext() override { 97 net::TestURLRequestContext* GetURLRequestContext() override {
98 // Construct |context_| lazily so it gets constructed on the right 98 // Construct |context_| lazily so it gets constructed on the right
99 // thread (the IO thread). 99 // thread (the IO thread).
100 if (!context_) 100 if (!context_)
101 context_.reset(new MyTestURLRequestContext()); 101 context_ = base::MakeUnique<MyTestURLRequestContext>();
102 return context_.get(); 102 return context_.get();
103 } 103 }
104 104
105 private: 105 private:
106 ~MyTestURLRequestContextGetter() override {} 106 ~MyTestURLRequestContextGetter() override {}
107 107
108 std::unique_ptr<MyTestURLRequestContext> context_; 108 std::unique_ptr<MyTestURLRequestContext> context_;
109 }; 109 };
110 110
111 // TODO(akalin): Use system encryptor once it's moved to sync/. 111 // TODO(akalin): Use system encryptor once it's moved to sync/.
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 args.service_url = GURL(kSyncServiceURL); 420 args.service_url = GURL(kSyncServiceURL);
421 args.post_factory = std::move(post_factory); 421 args.post_factory = std::move(post_factory);
422 args.workers = workers; 422 args.workers = workers;
423 args.extensions_activity = extensions_activity; 423 args.extensions_activity = extensions_activity;
424 args.change_delegate = &change_delegate; 424 args.change_delegate = &change_delegate;
425 args.credentials = credentials; 425 args.credentials = credentials;
426 args.invalidator_client_id = invalidator_id; 426 args.invalidator_client_id = invalidator_id;
427 args.restored_key_for_bootstrapping = kRestoredKeyForBootstrapping; 427 args.restored_key_for_bootstrapping = kRestoredKeyForBootstrapping;
428 args.restored_keystore_key_for_bootstrapping = 428 args.restored_keystore_key_for_bootstrapping =
429 kRestoredKeystoreKeyForBootstrapping; 429 kRestoredKeystoreKeyForBootstrapping;
430 args.engine_components_factory.reset( 430 args.engine_components_factory =
431 new EngineComponentsFactoryImpl(factory_switches)); 431 base::MakeUnique<EngineComponentsFactoryImpl>(factory_switches);
432 args.encryptor = &null_encryptor; 432 args.encryptor = &null_encryptor;
433 args.unrecoverable_error_handler = WeakHandle<UnrecoverableErrorHandler>(); 433 args.unrecoverable_error_handler = WeakHandle<UnrecoverableErrorHandler>();
434 args.report_unrecoverable_error_function = 434 args.report_unrecoverable_error_function =
435 base::Bind(LogUnrecoverableErrorContext); 435 base::Bind(LogUnrecoverableErrorContext);
436 args.cancelation_signal = &scm_cancelation_signal; 436 args.cancelation_signal = &scm_cancelation_signal;
437 sync_manager->Init(&args); 437 sync_manager->Init(&args);
438 // TODO(akalin): Avoid passing in model parameters multiple times by 438 // TODO(akalin): Avoid passing in model parameters multiple times by
439 // organizing handling of model types. 439 // organizing handling of model types.
440 invalidator->UpdateCredentials(credentials.email, credentials.sync_token); 440 invalidator->UpdateCredentials(credentials.email, credentials.sync_token);
441 std::unique_ptr<InvalidatorShim> shim( 441 std::unique_ptr<InvalidatorShim> shim(
442 new InvalidatorShim(sync_manager.get())); 442 new InvalidatorShim(sync_manager.get()));
443 invalidator->RegisterHandler(shim.get()); 443 invalidator->RegisterHandler(shim.get());
444 CHECK(invalidator->UpdateRegisteredIds( 444 CHECK(invalidator->UpdateRegisteredIds(
445 shim.get(), ModelTypeSetToObjectIdSet(model_types))); 445 shim.get(), ModelTypeSetToObjectIdSet(model_types)));
446 sync_manager->StartSyncingNormally(routing_info, base::Time()); 446 sync_manager->StartSyncingNormally(routing_info, base::Time());
447 447
448 base::RunLoop().Run(); 448 base::RunLoop().Run();
449 449
450 io_thread.Stop(); 450 io_thread.Stop();
451 return 0; 451 return 0;
452 } 452 }
453 453
454 } // namespace 454 } // namespace
455 } // namespace syncer 455 } // namespace syncer
456 456
457 int main(int argc, char* argv[]) { 457 int main(int argc, char* argv[]) {
458 return syncer::SyncClientMain(argc, argv); 458 return syncer::SyncClientMain(argc, argv);
459 } 459 }
OLDNEW
« no previous file with comments | « components/sync/test/engine/test_directory_setter_upper.cc ('k') | components/sync/tools/sync_listen_notifications.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698