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

Side by Side Diff: components/browser_sync/profile_sync_service.cc

Issue 2489433002: [Sync] Move thread checking into the ModelSafeWorker interface. (Closed)
Patch Set: Improve/add comments. Created 4 years, 1 month 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 "components/browser_sync/profile_sync_service.h" 5 #include "components/browser_sync/profile_sync_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 signin_wrapper(std::move(other.signin_wrapper)), 177 signin_wrapper(std::move(other.signin_wrapper)),
178 oauth2_token_service(other.oauth2_token_service), 178 oauth2_token_service(other.oauth2_token_service),
179 gaia_cookie_manager_service(other.gaia_cookie_manager_service), 179 gaia_cookie_manager_service(other.gaia_cookie_manager_service),
180 start_behavior(other.start_behavior), 180 start_behavior(other.start_behavior),
181 network_time_update_callback( 181 network_time_update_callback(
182 std::move(other.network_time_update_callback)), 182 std::move(other.network_time_update_callback)),
183 base_directory(std::move(other.base_directory)), 183 base_directory(std::move(other.base_directory)),
184 url_request_context(std::move(other.url_request_context)), 184 url_request_context(std::move(other.url_request_context)),
185 debug_identifier(std::move(other.debug_identifier)), 185 debug_identifier(std::move(other.debug_identifier)),
186 channel(other.channel), 186 channel(other.channel),
187 db_thread(std::move(other.db_thread)),
188 file_thread(std::move(other.file_thread)),
189 blocking_pool(other.blocking_pool) {} 187 blocking_pool(other.blocking_pool) {}
190 188
191 ProfileSyncService::ProfileSyncService(InitParams init_params) 189 ProfileSyncService::ProfileSyncService(InitParams init_params)
192 : OAuth2TokenService::Consumer("sync"), 190 : OAuth2TokenService::Consumer("sync"),
193 last_auth_error_(AuthError::AuthErrorNone()), 191 last_auth_error_(AuthError::AuthErrorNone()),
194 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED), 192 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED),
195 sync_client_(std::move(init_params.sync_client)), 193 sync_client_(std::move(init_params.sync_client)),
196 sync_prefs_(sync_client_->GetPrefService()), 194 sync_prefs_(sync_client_->GetPrefService()),
197 sync_service_url_( 195 sync_service_url_(
198 syncer::GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), 196 syncer::GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(),
199 init_params.channel)), 197 init_params.channel)),
200 network_time_update_callback_( 198 network_time_update_callback_(
201 std::move(init_params.network_time_update_callback)), 199 std::move(init_params.network_time_update_callback)),
202 base_directory_(init_params.base_directory), 200 base_directory_(init_params.base_directory),
203 url_request_context_(init_params.url_request_context), 201 url_request_context_(init_params.url_request_context),
204 debug_identifier_(std::move(init_params.debug_identifier)), 202 debug_identifier_(std::move(init_params.debug_identifier)),
205 channel_(init_params.channel), 203 channel_(init_params.channel),
206 db_thread_(init_params.db_thread),
207 file_thread_(init_params.file_thread),
208 blocking_pool_(init_params.blocking_pool), 204 blocking_pool_(init_params.blocking_pool),
209 is_first_time_sync_configure_(false), 205 is_first_time_sync_configure_(false),
210 backend_initialized_(false), 206 backend_initialized_(false),
211 sync_disabled_by_admin_(false), 207 sync_disabled_by_admin_(false),
212 is_auth_in_progress_(false), 208 is_auth_in_progress_(false),
213 signin_(std::move(init_params.signin_wrapper)), 209 signin_(std::move(init_params.signin_wrapper)),
214 unrecoverable_error_reason_(ERROR_REASON_UNSET), 210 unrecoverable_error_reason_(ERROR_REASON_UNSET),
215 expect_sync_configuration_aborted_(false), 211 expect_sync_configuration_aborted_(false),
216 encrypted_types_(syncer::SyncEncryptionHandler::SensitiveTypes()), 212 encrypted_types_(syncer::SyncEncryptionHandler::SensitiveTypes()),
217 encrypt_everything_allowed_(true), 213 encrypt_everything_allowed_(true),
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 local_sync_backend_folder.Append(kLoopbackServerBackendFilename); 534 local_sync_backend_folder.Append(kLoopbackServerBackendFilename);
539 #endif // defined(OS_WIN) 535 #endif // defined(OS_WIN)
540 536
541 SyncBackendHost::HttpPostProviderFactoryGetter 537 SyncBackendHost::HttpPostProviderFactoryGetter
542 http_post_provider_factory_getter = 538 http_post_provider_factory_getter =
543 base::Bind(&syncer::NetworkResources::GetHttpPostProviderFactory, 539 base::Bind(&syncer::NetworkResources::GetHttpPostProviderFactory,
544 base::Unretained(network_resources_.get()), 540 base::Unretained(network_resources_.get()),
545 url_request_context_, network_time_update_callback_); 541 url_request_context_, network_time_update_callback_);
546 542
547 backend_->Initialize( 543 backend_->Initialize(
548 this, sync_thread_.get(), db_thread_, file_thread_, GetJsEventHandler(), 544 this, sync_thread_.get(), GetJsEventHandler(), sync_service_url_,
549 sync_service_url_, local_device_->GetSyncUserAgent(), credentials, 545 local_device_->GetSyncUserAgent(), credentials, delete_stale_data,
550 delete_stale_data, enable_local_sync_backend, local_sync_backend_folder, 546 enable_local_sync_backend, local_sync_backend_folder,
551 base::MakeUnique<syncer::SyncManagerFactory>(), 547 base::MakeUnique<syncer::SyncManagerFactory>(),
552 MakeWeakHandle(sync_enabled_weak_factory_.GetWeakPtr()), 548 MakeWeakHandle(sync_enabled_weak_factory_.GetWeakPtr()),
553 base::Bind(syncer::ReportUnrecoverableError, channel_), 549 base::Bind(syncer::ReportUnrecoverableError, channel_),
554 http_post_provider_factory_getter, std::move(saved_nigori_state_)); 550 http_post_provider_factory_getter, std::move(saved_nigori_state_));
555 } 551 }
556 552
557 bool ProfileSyncService::IsEncryptedDatatypeEnabled() const { 553 bool ProfileSyncService::IsEncryptedDatatypeEnabled() const {
558 if (encryption_pending()) 554 if (encryption_pending())
559 return true; 555 return true;
560 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes(); 556 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes();
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2529 2525
2530 DCHECK(startup_controller_->IsSetupInProgress()); 2526 DCHECK(startup_controller_->IsSetupInProgress());
2531 startup_controller_->SetSetupInProgress(false); 2527 startup_controller_->SetSetupInProgress(false);
2532 2528
2533 if (IsBackendInitialized()) 2529 if (IsBackendInitialized())
2534 ReconfigureDatatypeManager(); 2530 ReconfigureDatatypeManager();
2535 NotifyObservers(); 2531 NotifyObservers();
2536 } 2532 }
2537 2533
2538 } // namespace browser_sync 2534 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698