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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 10826193: Remove SyncManager::Init() return value (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 | « no previous file | sync/internal_api/public/sync_manager.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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/sync/glue/sync_backend_host.h" 7 #include "chrome/browser/sync/glue/sync_backend_host.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 DCHECK(sync_loop_); 1039 DCHECK(sync_loop_);
1040 1040
1041 // Blow away the partial or corrupt sync data folder before doing any more 1041 // Blow away the partial or corrupt sync data folder before doing any more
1042 // initialization, if necessary. 1042 // initialization, if necessary.
1043 if (options.delete_sync_data_folder) { 1043 if (options.delete_sync_data_folder) {
1044 DeleteSyncDataFolder(); 1044 DeleteSyncDataFolder();
1045 } 1045 }
1046 1046
1047 // Make sure that the directory exists before initializing the backend. 1047 // Make sure that the directory exists before initializing the backend.
1048 // If it already exists, this will do no harm. 1048 // If it already exists, this will do no harm.
1049 bool success = file_util::CreateDirectory(sync_data_folder_path_); 1049 DCHECK(file_util::CreateDirectory(sync_data_folder_path_));
akalin 2012/08/08 23:01:46 this is dangerous! DCHECKs get compiled out in re
rlarocque 2012/08/09 00:01:38 That's a very good point. I should not put code w
1050 DCHECK(success);
1051 1050
1052 DCHECK(!registrar_); 1051 DCHECK(!registrar_);
1053 registrar_ = options.registrar; 1052 registrar_ = options.registrar;
1054 DCHECK(registrar_); 1053 DCHECK(registrar_);
1055 1054
1056 DCHECK(!chrome_sync_notification_bridge_); 1055 DCHECK(!chrome_sync_notification_bridge_);
1057 chrome_sync_notification_bridge_ = options.chrome_sync_notification_bridge; 1056 chrome_sync_notification_bridge_ = options.chrome_sync_notification_bridge;
1058 DCHECK(chrome_sync_notification_bridge_); 1057 DCHECK(chrome_sync_notification_bridge_);
1059 1058
1060 sync_manager_ = options.sync_manager_factory->CreateSyncManager(name_); 1059 sync_manager_ = options.sync_manager_factory->CreateSyncManager(name_);
1061 sync_manager_->AddObserver(this); 1060 sync_manager_->AddObserver(this);
1062 success = sync_manager_->Init( 1061 sync_manager_->Init(
1063 sync_data_folder_path_, 1062 sync_data_folder_path_,
1064 options.event_handler, 1063 options.event_handler,
1065 options.service_url.host() + options.service_url.path(), 1064 options.service_url.host() + options.service_url.path(),
1066 options.service_url.EffectiveIntPort(), 1065 options.service_url.EffectiveIntPort(),
1067 options.service_url.SchemeIsSecure(), 1066 options.service_url.SchemeIsSecure(),
1068 BrowserThread::GetBlockingPool(), 1067 BrowserThread::GetBlockingPool(),
1069 options.make_http_bridge_factory_fn.Run().Pass(), 1068 options.make_http_bridge_factory_fn.Run().Pass(),
1070 options.workers, 1069 options.workers,
1071 options.extensions_activity_monitor, 1070 options.extensions_activity_monitor,
1072 options.registrar /* as SyncManager::ChangeDelegate */, 1071 options.registrar /* as SyncManager::ChangeDelegate */,
1073 options.credentials, 1072 options.credentials,
1074 scoped_ptr<syncer::SyncNotifier>(new BridgedSyncNotifier( 1073 scoped_ptr<syncer::SyncNotifier>(new BridgedSyncNotifier(
1075 options.chrome_sync_notification_bridge, 1074 options.chrome_sync_notification_bridge,
1076 options.sync_notifier_factory->CreateSyncNotifier())), 1075 options.sync_notifier_factory->CreateSyncNotifier())),
1077 options.restored_key_for_bootstrapping, 1076 options.restored_key_for_bootstrapping,
1078 options.restored_keystore_key_for_bootstrapping, 1077 options.restored_keystore_key_for_bootstrapping,
1079 CommandLine::ForCurrentProcess()->HasSwitch( 1078 CommandLine::ForCurrentProcess()->HasSwitch(
1080 switches::kSyncKeystoreEncryption), 1079 switches::kSyncKeystoreEncryption),
1081 scoped_ptr<InternalComponentsFactory>( 1080 scoped_ptr<InternalComponentsFactory>(
1082 options.internal_components_factory), 1081 options.internal_components_factory),
1083 &encryptor_, 1082 &encryptor_,
1084 options.unrecoverable_error_handler, 1083 options.unrecoverable_error_handler,
1085 options.report_unrecoverable_error_function); 1084 options.report_unrecoverable_error_function);
1086 LOG_IF(ERROR, !success) << "Sync manager initialization failed!";
1087 1085
1088 // Now check the command line to see if we need to simulate an 1086 // Now check the command line to see if we need to simulate an
1089 // unrecoverable error for testing purpose. Note the error is thrown 1087 // unrecoverable error for testing purpose. Note the error is thrown
1090 // only if the initialization succeeded. Also it makes sense to use this 1088 // only if the initialization succeeded. Also it makes sense to use this
1091 // flag only when restarting the browser with an account already setup. If 1089 // flag only when restarting the browser with an account already setup. If
1092 // you use this before setting up the setup would not succeed as an error 1090 // you use this before setting up the setup would not succeed as an error
1093 // would be encountered. 1091 // would be encountered.
1094 if (CommandLine::ForCurrentProcess()->HasSwitch( 1092 if (CommandLine::ForCurrentProcess()->HasSwitch(
1095 switches::kSyncThrowUnrecoverableError)) { 1093 switches::kSyncThrowUnrecoverableError)) {
1096 sync_manager_->ThrowUnrecoverableError(); 1094 sync_manager_->ThrowUnrecoverableError();
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 FROM_HERE, 1510 FROM_HERE,
1513 base::Bind(&SyncBackendHost::Core::DoRefreshNigori, 1511 base::Bind(&SyncBackendHost::Core::DoRefreshNigori,
1514 core_.get(), sync_thread_done_callback)); 1512 core_.get(), sync_thread_done_callback));
1515 } 1513 }
1516 1514
1517 #undef SDVLOG 1515 #undef SDVLOG
1518 1516
1519 #undef SLOG 1517 #undef SLOG
1520 1518
1521 } // namespace browser_sync 1519 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | sync/internal_api/public/sync_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698