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

Side by Side Diff: trunk/src/sync/tools/sync_client.cc

Issue 23658030: Revert 222154 "sync: Gracefully handle very early shutdown" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | « trunk/src/sync/test/engine/mock_connection_manager.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 <cstddef> 5 #include <cstddef>
6 #include <cstdio> 6 #include <cstdio>
7 #include <string> 7 #include <string>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/debug/stack_trace.h" 12 #include "base/debug/stack_trace.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/json/json_writer.h" 14 #include "base/json/json_writer.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/message_loop/message_loop.h" 19 #include "base/message_loop/message_loop.h"
20 #include "base/rand_util.h" 20 #include "base/rand_util.h"
21 #include "base/task_runner.h" 21 #include "base/task_runner.h"
22 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
23 #include "jingle/notifier/base/notification_method.h" 23 #include "jingle/notifier/base/notification_method.h"
24 #include "jingle/notifier/base/notifier_options.h" 24 #include "jingle/notifier/base/notifier_options.h"
25 #include "net/base/host_port_pair.h" 25 #include "net/base/host_port_pair.h"
26 #include "net/base/network_change_notifier.h" 26 #include "net/base/network_change_notifier.h"
27 #include "net/dns/host_resolver.h" 27 #include "net/dns/host_resolver.h"
28 #include "net/http/transport_security_state.h" 28 #include "net/http/transport_security_state.h"
29 #include "net/url_request/url_request_test_util.h" 29 #include "net/url_request/url_request_test_util.h"
30 #include "sync/internal_api/public/base/cancelation_signal.h"
31 #include "sync/internal_api/public/base/model_type.h" 30 #include "sync/internal_api/public/base/model_type.h"
32 #include "sync/internal_api/public/base_node.h" 31 #include "sync/internal_api/public/base_node.h"
33 #include "sync/internal_api/public/engine/passive_model_worker.h" 32 #include "sync/internal_api/public/engine/passive_model_worker.h"
34 #include "sync/internal_api/public/http_bridge.h" 33 #include "sync/internal_api/public/http_bridge.h"
35 #include "sync/internal_api/public/internal_components_factory_impl.h" 34 #include "sync/internal_api/public/internal_components_factory_impl.h"
36 #include "sync/internal_api/public/read_node.h" 35 #include "sync/internal_api/public/read_node.h"
37 #include "sync/internal_api/public/sync_manager.h" 36 #include "sync/internal_api/public/sync_manager.h"
38 #include "sync/internal_api/public/sync_manager_factory.h" 37 #include "sync/internal_api/public/sync_manager_factory.h"
39 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" 38 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h"
40 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" 39 #include "sync/internal_api/public/util/unrecoverable_error_handler.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 // as NULL. 342 // as NULL.
344 ExtensionsActivity* extensions_activity = NULL; 343 ExtensionsActivity* extensions_activity = NULL;
345 LoggingChangeDelegate change_delegate; 344 LoggingChangeDelegate change_delegate;
346 const char kRestoredKeyForBootstrapping[] = ""; 345 const char kRestoredKeyForBootstrapping[] = "";
347 const char kRestoredKeystoreKeyForBootstrapping[] = ""; 346 const char kRestoredKeystoreKeyForBootstrapping[] = "";
348 NullEncryptor null_encryptor; 347 NullEncryptor null_encryptor;
349 InternalComponentsFactoryImpl::Switches factory_switches = { 348 InternalComponentsFactoryImpl::Switches factory_switches = {
350 InternalComponentsFactory::ENCRYPTION_KEYSTORE, 349 InternalComponentsFactory::ENCRYPTION_KEYSTORE,
351 InternalComponentsFactory::BACKOFF_NORMAL 350 InternalComponentsFactory::BACKOFF_NORMAL
352 }; 351 };
353 CancelationSignal cancelation_signal;
354 352
355 sync_manager->Init(database_dir.path(), 353 sync_manager->Init(database_dir.path(),
356 WeakHandle<JsEventHandler>( 354 WeakHandle<JsEventHandler>(
357 js_event_handler.AsWeakPtr()), 355 js_event_handler.AsWeakPtr()),
358 kSyncServerAndPath, 356 kSyncServerAndPath,
359 kSyncServerPort, 357 kSyncServerPort,
360 kUseSsl, 358 kUseSsl,
361 post_factory.Pass(), 359 post_factory.Pass(),
362 workers, 360 workers,
363 extensions_activity, 361 extensions_activity,
364 &change_delegate, 362 &change_delegate,
365 credentials, 363 credentials,
366 invalidator_id, 364 invalidator_id,
367 kRestoredKeyForBootstrapping, 365 kRestoredKeyForBootstrapping,
368 kRestoredKeystoreKeyForBootstrapping, 366 kRestoredKeystoreKeyForBootstrapping,
369 new InternalComponentsFactoryImpl(factory_switches), 367 new InternalComponentsFactoryImpl(factory_switches),
370 &null_encryptor, 368 &null_encryptor,
371 scoped_ptr<UnrecoverableErrorHandler>( 369 scoped_ptr<UnrecoverableErrorHandler>(
372 new LoggingUnrecoverableErrorHandler).Pass(), 370 new LoggingUnrecoverableErrorHandler).Pass(),
373 &LogUnrecoverableErrorContext, false, 371 &LogUnrecoverableErrorContext, false);
374 &cancelation_signal);
375 // TODO(akalin): Avoid passing in model parameters multiple times by 372 // TODO(akalin): Avoid passing in model parameters multiple times by
376 // organizing handling of model types. 373 // organizing handling of model types.
377 invalidator->UpdateCredentials(credentials.email, credentials.sync_token); 374 invalidator->UpdateCredentials(credentials.email, credentials.sync_token);
378 invalidator->RegisterHandler(sync_manager.get()); 375 invalidator->RegisterHandler(sync_manager.get());
379 invalidator->UpdateRegisteredIds( 376 invalidator->UpdateRegisteredIds(
380 sync_manager.get(), ModelTypeSetToObjectIdSet(model_types)); 377 sync_manager.get(), ModelTypeSetToObjectIdSet(model_types));
381 sync_manager->StartSyncingNormally(routing_info); 378 sync_manager->StartSyncingNormally(routing_info);
382 379
383 sync_loop.Run(); 380 sync_loop.Run();
384 381
385 io_thread.Stop(); 382 io_thread.Stop();
386 return 0; 383 return 0;
387 } 384 }
388 385
389 } // namespace 386 } // namespace
390 } // namespace syncer 387 } // namespace syncer
391 388
392 int main(int argc, char* argv[]) { 389 int main(int argc, char* argv[]) {
393 return syncer::SyncClientMain(argc, argv); 390 return syncer::SyncClientMain(argc, argv);
394 } 391 }
OLDNEW
« no previous file with comments | « trunk/src/sync/test/engine/mock_connection_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698