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

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

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/sync/glue/sync_backend_host_impl.h" 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/single_thread_task_runner.h"
9 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/signin/chrome_signin_client_factory.h" 14 #include "chrome/browser/signin/chrome_signin_client_factory.h"
13 #include "chrome/browser/sync/glue/invalidation_helper.h" 15 #include "chrome/browser/sync/glue/invalidation_helper.h"
14 #include "chrome/browser/sync/glue/sync_backend_host_core.h" 16 #include "chrome/browser/sync/glue/sync_backend_host_core.h"
15 #include "chrome/browser/sync/glue/sync_backend_registrar.h" 17 #include "chrome/browser/sync/glue/sync_backend_registrar.h"
16 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
17 #include "components/invalidation/invalidation_service.h" 19 #include "components/invalidation/invalidation_service.h"
18 #include "components/invalidation/object_id_invalidation_map.h" 20 #include "components/invalidation/object_id_invalidation_map.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 scoped_ptr<InternalComponentsFactory>( 157 scoped_ptr<InternalComponentsFactory>(
156 new syncer::InternalComponentsFactoryImpl(factory_switches)).Pass(), 158 new syncer::InternalComponentsFactoryImpl(factory_switches)).Pass(),
157 unrecoverable_error_handler.Pass(), 159 unrecoverable_error_handler.Pass(),
158 report_unrecoverable_error_function)); 160 report_unrecoverable_error_function));
159 InitCore(init_opts.Pass()); 161 InitCore(init_opts.Pass());
160 } 162 }
161 163
162 void SyncBackendHostImpl::UpdateCredentials( 164 void SyncBackendHostImpl::UpdateCredentials(
163 const syncer::SyncCredentials& credentials) { 165 const syncer::SyncCredentials& credentials) {
164 DCHECK(registrar_->sync_thread()->IsRunning()); 166 DCHECK(registrar_->sync_thread()->IsRunning());
165 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 167 registrar_->sync_thread()->task_runner()->PostTask(
166 base::Bind(&SyncBackendHostCore::DoUpdateCredentials, 168 FROM_HERE, base::Bind(&SyncBackendHostCore::DoUpdateCredentials,
167 core_.get(), 169 core_.get(), credentials));
168 credentials));
169 } 170 }
170 171
171 void SyncBackendHostImpl::StartSyncingWithServer() { 172 void SyncBackendHostImpl::StartSyncingWithServer() {
172 SDVLOG(1) << "SyncBackendHostImpl::StartSyncingWithServer called."; 173 SDVLOG(1) << "SyncBackendHostImpl::StartSyncingWithServer called.";
173 174
174 syncer::ModelSafeRoutingInfo routing_info; 175 syncer::ModelSafeRoutingInfo routing_info;
175 registrar_->GetModelSafeRoutingInfo(&routing_info); 176 registrar_->GetModelSafeRoutingInfo(&routing_info);
176 177
177 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 178 registrar_->sync_thread()->task_runner()->PostTask(
178 base::Bind(&SyncBackendHostCore::DoStartSyncing, 179 FROM_HERE, base::Bind(&SyncBackendHostCore::DoStartSyncing, core_.get(),
179 core_.get(), routing_info, sync_prefs_->GetLastPollTime())); 180 routing_info, sync_prefs_->GetLastPollTime()));
180 } 181 }
181 182
182 void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase, 183 void SyncBackendHostImpl::SetEncryptionPassphrase(const std::string& passphrase,
183 bool is_explicit) { 184 bool is_explicit) {
184 DCHECK(registrar_->sync_thread()->IsRunning()); 185 DCHECK(registrar_->sync_thread()->IsRunning());
185 if (!IsNigoriEnabled()) { 186 if (!IsNigoriEnabled()) {
186 NOTREACHED() << "SetEncryptionPassphrase must never be called when nigori" 187 NOTREACHED() << "SetEncryptionPassphrase must never be called when nigori"
187 " is disabled."; 188 " is disabled.";
188 return; 189 return;
189 } 190 }
190 191
191 // We should never be called with an empty passphrase. 192 // We should never be called with an empty passphrase.
192 DCHECK(!passphrase.empty()); 193 DCHECK(!passphrase.empty());
193 194
194 // This should only be called by the frontend. 195 // This should only be called by the frontend.
195 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); 196 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
196 197
197 // SetEncryptionPassphrase should never be called if we are currently 198 // SetEncryptionPassphrase should never be called if we are currently
198 // encrypted with an explicit passphrase. 199 // encrypted with an explicit passphrase.
199 DCHECK(cached_passphrase_type_ == syncer::KEYSTORE_PASSPHRASE || 200 DCHECK(cached_passphrase_type_ == syncer::KEYSTORE_PASSPHRASE ||
200 cached_passphrase_type_ == syncer::IMPLICIT_PASSPHRASE); 201 cached_passphrase_type_ == syncer::IMPLICIT_PASSPHRASE);
201 202
202 // Post an encryption task on the syncer thread. 203 // Post an encryption task on the syncer thread.
203 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 204 registrar_->sync_thread()->task_runner()->PostTask(
204 base::Bind(&SyncBackendHostCore::DoSetEncryptionPassphrase, 205 FROM_HERE, base::Bind(&SyncBackendHostCore::DoSetEncryptionPassphrase,
205 core_.get(), 206 core_.get(), passphrase, is_explicit));
206 passphrase, is_explicit));
207 } 207 }
208 208
209 bool SyncBackendHostImpl::SetDecryptionPassphrase( 209 bool SyncBackendHostImpl::SetDecryptionPassphrase(
210 const std::string& passphrase) { 210 const std::string& passphrase) {
211 if (!IsNigoriEnabled()) { 211 if (!IsNigoriEnabled()) {
212 NOTREACHED() << "SetDecryptionPassphrase must never be called when nigori" 212 NOTREACHED() << "SetDecryptionPassphrase must never be called when nigori"
213 " is disabled."; 213 " is disabled.";
214 return false; 214 return false;
215 } 215 }
216 216
217 // We should never be called with an empty passphrase. 217 // We should never be called with an empty passphrase.
218 DCHECK(!passphrase.empty()); 218 DCHECK(!passphrase.empty());
219 219
220 // This should only be called by the frontend. 220 // This should only be called by the frontend.
221 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); 221 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
222 222
223 // This should only be called when we have cached pending keys. 223 // This should only be called when we have cached pending keys.
224 DCHECK(cached_pending_keys_.has_blob()); 224 DCHECK(cached_pending_keys_.has_blob());
225 225
226 // Check the passphrase that was provided against our local cache of the 226 // Check the passphrase that was provided against our local cache of the
227 // cryptographer's pending keys. If this was unsuccessful, the UI layer can 227 // cryptographer's pending keys. If this was unsuccessful, the UI layer can
228 // immediately call OnPassphraseRequired without showing the user a spinner. 228 // immediately call OnPassphraseRequired without showing the user a spinner.
229 if (!CheckPassphraseAgainstCachedPendingKeys(passphrase)) 229 if (!CheckPassphraseAgainstCachedPendingKeys(passphrase))
230 return false; 230 return false;
231 231
232 // Post a decryption task on the syncer thread. 232 // Post a decryption task on the syncer thread.
233 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 233 registrar_->sync_thread()->task_runner()->PostTask(
234 base::Bind(&SyncBackendHostCore::DoSetDecryptionPassphrase, 234 FROM_HERE, base::Bind(&SyncBackendHostCore::DoSetDecryptionPassphrase,
235 core_.get(), 235 core_.get(), passphrase));
236 passphrase));
237 236
238 // Since we were able to decrypt the cached pending keys with the passphrase 237 // Since we were able to decrypt the cached pending keys with the passphrase
239 // provided, we immediately alert the UI layer that the passphrase was 238 // provided, we immediately alert the UI layer that the passphrase was
240 // accepted. This will avoid the situation where a user enters a passphrase, 239 // accepted. This will avoid the situation where a user enters a passphrase,
241 // clicks OK, immediately reopens the advanced settings dialog, and gets an 240 // clicks OK, immediately reopens the advanced settings dialog, and gets an
242 // unnecessary prompt for a passphrase. 241 // unnecessary prompt for a passphrase.
243 // Note: It is not guaranteed that the passphrase will be accepted by the 242 // Note: It is not guaranteed that the passphrase will be accepted by the
244 // syncer thread, since we could receive a new nigori node while the task is 243 // syncer thread, since we could receive a new nigori node while the task is
245 // pending. This scenario is a valid race, and SetDecryptionPassphrase can 244 // pending. This scenario is a valid race, and SetDecryptionPassphrase can
246 // trigger a new OnPassphraseRequired if it needs to. 245 // trigger a new OnPassphraseRequired if it needs to.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (invalidation_handler_registered_) { 278 if (invalidation_handler_registered_) {
280 if (reason == syncer::DISABLE_SYNC) { 279 if (reason == syncer::DISABLE_SYNC) {
281 UnregisterInvalidationIds(); 280 UnregisterInvalidationIds();
282 } 281 }
283 invalidator_->UnregisterInvalidationHandler(this); 282 invalidator_->UnregisterInvalidationHandler(this);
284 invalidator_ = NULL; 283 invalidator_ = NULL;
285 } 284 }
286 invalidation_handler_registered_ = false; 285 invalidation_handler_registered_ = false;
287 286
288 // Shut down and destroy sync manager. 287 // Shut down and destroy sync manager.
289 registrar_->sync_thread()->message_loop()->PostTask( 288 registrar_->sync_thread()->task_runner()->PostTask(
290 FROM_HERE, 289 FROM_HERE,
291 base::Bind(&SyncBackendHostCore::DoShutdown, 290 base::Bind(&SyncBackendHostCore::DoShutdown, core_.get(), reason));
292 core_.get(), reason));
293 core_ = NULL; 291 core_ = NULL;
294 292
295 // Worker cleanup. 293 // Worker cleanup.
296 SyncBackendRegistrar* detached_registrar = registrar_.release(); 294 SyncBackendRegistrar* detached_registrar = registrar_.release();
297 detached_registrar->sync_thread()->message_loop()->PostTask( 295 detached_registrar->sync_thread()->task_runner()->PostTask(
298 FROM_HERE, 296 FROM_HERE, base::Bind(&SyncBackendRegistrar::Shutdown,
299 base::Bind(&SyncBackendRegistrar::Shutdown, 297 base::Unretained(detached_registrar)));
300 base::Unretained(detached_registrar)));
301 298
302 if (sync_thread_claimed) 299 if (sync_thread_claimed)
303 return detached_registrar->ReleaseSyncThread(); 300 return detached_registrar->ReleaseSyncThread();
304 else 301 else
305 return scoped_ptr<base::Thread>(); 302 return scoped_ptr<base::Thread>();
306 } 303 }
307 304
308 void SyncBackendHostImpl::UnregisterInvalidationIds() { 305 void SyncBackendHostImpl::UnregisterInvalidationIds() {
309 if (invalidation_handler_registered_) { 306 if (invalidation_handler_registered_) {
310 CHECK(invalidator_->UpdateRegisteredInvalidationIds(this, 307 CHECK(invalidator_->UpdateRegisteredInvalidationIds(this,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 retry_callback); 432 retry_callback);
436 433
437 DCHECK(syncer::Intersection(active_types, types_to_purge).Empty()); 434 DCHECK(syncer::Intersection(active_types, types_to_purge).Empty());
438 DCHECK(syncer::Intersection(active_types, fatal_types).Empty()); 435 DCHECK(syncer::Intersection(active_types, fatal_types).Empty());
439 DCHECK(syncer::Intersection(active_types, unapply_types).Empty()); 436 DCHECK(syncer::Intersection(active_types, unapply_types).Empty());
440 DCHECK(syncer::Intersection(active_types, inactive_types).Empty()); 437 DCHECK(syncer::Intersection(active_types, inactive_types).Empty());
441 return syncer::Difference(active_types, types_to_download); 438 return syncer::Difference(active_types, types_to_download);
442 } 439 }
443 440
444 void SyncBackendHostImpl::EnableEncryptEverything() { 441 void SyncBackendHostImpl::EnableEncryptEverything() {
445 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 442 registrar_->sync_thread()->task_runner()->PostTask(
446 base::Bind(&SyncBackendHostCore::DoEnableEncryptEverything, 443 FROM_HERE,
447 core_.get())); 444 base::Bind(&SyncBackendHostCore::DoEnableEncryptEverything, core_.get()));
448 } 445 }
449 446
450 void SyncBackendHostImpl::ActivateDataType( 447 void SyncBackendHostImpl::ActivateDataType(
451 syncer::ModelType type, syncer::ModelSafeGroup group, 448 syncer::ModelType type, syncer::ModelSafeGroup group,
452 sync_driver::ChangeProcessor* change_processor) { 449 sync_driver::ChangeProcessor* change_processor) {
453 registrar_->ActivateDataType(type, group, change_processor, GetUserShare()); 450 registrar_->ActivateDataType(type, group, change_processor, GetUserShare());
454 } 451 }
455 452
456 void SyncBackendHostImpl::DeactivateDataType(syncer::ModelType type) { 453 void SyncBackendHostImpl::DeactivateDataType(syncer::ModelType type) {
457 registrar_->DeactivateDataType(type); 454 registrar_->DeactivateDataType(type);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 508 }
512 } 509 }
513 510
514 void SyncBackendHostImpl::FlushDirectory() const { 511 void SyncBackendHostImpl::FlushDirectory() const {
515 DCHECK(initialized()); 512 DCHECK(initialized());
516 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 513 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
517 base::Bind(&SyncBackendHostCore::SaveChanges, core_)); 514 base::Bind(&SyncBackendHostCore::SaveChanges, core_));
518 } 515 }
519 516
520 void SyncBackendHostImpl::RequestBufferedProtocolEventsAndEnableForwarding() { 517 void SyncBackendHostImpl::RequestBufferedProtocolEventsAndEnableForwarding() {
521 registrar_->sync_thread()->message_loop()->PostTask( 518 registrar_->sync_thread()->task_runner()->PostTask(
522 FROM_HERE, 519 FROM_HERE,
523 base::Bind( 520 base::Bind(
524 &SyncBackendHostCore::SendBufferedProtocolEventsAndEnableForwarding, 521 &SyncBackendHostCore::SendBufferedProtocolEventsAndEnableForwarding,
525 core_)); 522 core_));
526 } 523 }
527 524
528 void SyncBackendHostImpl::DisableProtocolEventForwarding() { 525 void SyncBackendHostImpl::DisableProtocolEventForwarding() {
529 registrar_->sync_thread()->message_loop()->PostTask( 526 registrar_->sync_thread()->task_runner()->PostTask(
530 FROM_HERE, 527 FROM_HERE,
531 base::Bind( 528 base::Bind(&SyncBackendHostCore::DisableProtocolEventForwarding, core_));
532 &SyncBackendHostCore::DisableProtocolEventForwarding,
533 core_));
534 } 529 }
535 530
536 void SyncBackendHostImpl::EnableDirectoryTypeDebugInfoForwarding() { 531 void SyncBackendHostImpl::EnableDirectoryTypeDebugInfoForwarding() {
537 DCHECK(initialized()); 532 DCHECK(initialized());
538 registrar_->sync_thread()->message_loop()->PostTask( 533 registrar_->sync_thread()->task_runner()->PostTask(
539 FROM_HERE, 534 FROM_HERE,
540 base::Bind( 535 base::Bind(&SyncBackendHostCore::EnableDirectoryTypeDebugInfoForwarding,
541 &SyncBackendHostCore::EnableDirectoryTypeDebugInfoForwarding, 536 core_));
542 core_));
543 } 537 }
544 538
545 void SyncBackendHostImpl::DisableDirectoryTypeDebugInfoForwarding() { 539 void SyncBackendHostImpl::DisableDirectoryTypeDebugInfoForwarding() {
546 DCHECK(initialized()); 540 DCHECK(initialized());
547 registrar_->sync_thread()->message_loop()->PostTask( 541 registrar_->sync_thread()->task_runner()->PostTask(
548 FROM_HERE, 542 FROM_HERE,
549 base::Bind( 543 base::Bind(&SyncBackendHostCore::DisableDirectoryTypeDebugInfoForwarding,
550 &SyncBackendHostCore::DisableDirectoryTypeDebugInfoForwarding, 544 core_));
551 core_));
552 } 545 }
553 546
554 void SyncBackendHostImpl::GetAllNodesForTypes( 547 void SyncBackendHostImpl::GetAllNodesForTypes(
555 syncer::ModelTypeSet types, 548 syncer::ModelTypeSet types,
556 base::Callback<void(const std::vector<syncer::ModelType>&, 549 base::Callback<void(const std::vector<syncer::ModelType>&,
557 ScopedVector<base::ListValue>)> callback) { 550 ScopedVector<base::ListValue>)> callback) {
558 DCHECK(initialized()); 551 DCHECK(initialized());
559 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 552 registrar_->sync_thread()->task_runner()->PostTask(
560 base::Bind( 553 FROM_HERE, base::Bind(&SyncBackendHostCore::GetAllNodesForTypes, core_,
561 &SyncBackendHostCore::GetAllNodesForTypes, 554 types, frontend_loop_->task_runner(), callback));
562 core_,
563 types,
564 frontend_loop_->message_loop_proxy(),
565 callback));
566 } 555 }
567 556
568 void SyncBackendHostImpl::InitCore(scoped_ptr<DoInitializeOptions> options) { 557 void SyncBackendHostImpl::InitCore(scoped_ptr<DoInitializeOptions> options) {
569 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 558 registrar_->sync_thread()->task_runner()->PostTask(
570 base::Bind(&SyncBackendHostCore::DoInitialize, 559 FROM_HERE, base::Bind(&SyncBackendHostCore::DoInitialize, core_.get(),
571 core_.get(), base::Passed(&options))); 560 base::Passed(&options)));
572 } 561 }
573 562
574 void SyncBackendHostImpl::RequestConfigureSyncer( 563 void SyncBackendHostImpl::RequestConfigureSyncer(
575 syncer::ConfigureReason reason, 564 syncer::ConfigureReason reason,
576 syncer::ModelTypeSet to_download, 565 syncer::ModelTypeSet to_download,
577 syncer::ModelTypeSet to_purge, 566 syncer::ModelTypeSet to_purge,
578 syncer::ModelTypeSet to_journal, 567 syncer::ModelTypeSet to_journal,
579 syncer::ModelTypeSet to_unapply, 568 syncer::ModelTypeSet to_unapply,
580 syncer::ModelTypeSet to_ignore, 569 syncer::ModelTypeSet to_ignore,
581 const syncer::ModelSafeRoutingInfo& routing_info, 570 const syncer::ModelSafeRoutingInfo& routing_info,
582 const base::Callback<void(syncer::ModelTypeSet, 571 const base::Callback<void(syncer::ModelTypeSet,
583 syncer::ModelTypeSet)>& ready_task, 572 syncer::ModelTypeSet)>& ready_task,
584 const base::Closure& retry_callback) { 573 const base::Closure& retry_callback) {
585 DoConfigureSyncerTypes config_types; 574 DoConfigureSyncerTypes config_types;
586 config_types.to_download = to_download; 575 config_types.to_download = to_download;
587 config_types.to_purge = to_purge; 576 config_types.to_purge = to_purge;
588 config_types.to_journal = to_journal; 577 config_types.to_journal = to_journal;
589 config_types.to_unapply = to_unapply; 578 config_types.to_unapply = to_unapply;
590 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 579 registrar_->sync_thread()->task_runner()->PostTask(
591 base::Bind(&SyncBackendHostCore::DoConfigureSyncer, 580 FROM_HERE,
592 core_.get(), 581 base::Bind(&SyncBackendHostCore::DoConfigureSyncer, core_.get(), reason,
593 reason, 582 config_types, routing_info, ready_task, retry_callback));
594 config_types,
595 routing_info,
596 ready_task,
597 retry_callback));
598 } 583 }
599 584
600 void SyncBackendHostImpl::FinishConfigureDataTypesOnFrontendLoop( 585 void SyncBackendHostImpl::FinishConfigureDataTypesOnFrontendLoop(
601 const syncer::ModelTypeSet enabled_types, 586 const syncer::ModelTypeSet enabled_types,
602 const syncer::ModelTypeSet succeeded_configuration_types, 587 const syncer::ModelTypeSet succeeded_configuration_types,
603 const syncer::ModelTypeSet failed_configuration_types, 588 const syncer::ModelTypeSet failed_configuration_types,
604 const base::Callback<void(syncer::ModelTypeSet, 589 const base::Callback<void(syncer::ModelTypeSet,
605 syncer::ModelTypeSet)>& ready_task) { 590 syncer::ModelTypeSet)>& ready_task) {
606 if (!frontend_) 591 if (!frontend_)
607 return; 592 return;
608 593
609 if (invalidator_) { 594 if (invalidator_) {
610 CHECK(invalidator_->UpdateRegisteredInvalidationIds( 595 CHECK(invalidator_->UpdateRegisteredInvalidationIds(
611 this, ModelTypeSetToObjectIdSet(enabled_types))); 596 this, ModelTypeSetToObjectIdSet(enabled_types)));
612 } 597 }
613 598
614 if (!ready_task.is_null()) 599 if (!ready_task.is_null())
615 ready_task.Run(succeeded_configuration_types, failed_configuration_types); 600 ready_task.Run(succeeded_configuration_types, failed_configuration_types);
616 } 601 }
617 602
618 void SyncBackendHostImpl::Observe( 603 void SyncBackendHostImpl::Observe(
619 int type, 604 int type,
620 const content::NotificationSource& source, 605 const content::NotificationSource& source,
621 const content::NotificationDetails& details) { 606 const content::NotificationDetails& details) {
622 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 607 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
623 DCHECK_EQ(type, chrome::NOTIFICATION_SYNC_REFRESH_LOCAL); 608 DCHECK_EQ(type, chrome::NOTIFICATION_SYNC_REFRESH_LOCAL);
624 609
625 content::Details<const syncer::ModelTypeSet> state_details(details); 610 content::Details<const syncer::ModelTypeSet> state_details(details);
626 const syncer::ModelTypeSet& types = *(state_details.ptr()); 611 const syncer::ModelTypeSet& types = *(state_details.ptr());
627 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 612 registrar_->sync_thread()->task_runner()->PostTask(
613 FROM_HERE,
628 base::Bind(&SyncBackendHostCore::DoRefreshTypes, core_.get(), types)); 614 base::Bind(&SyncBackendHostCore::DoRefreshTypes, core_.get(), types));
629 } 615 }
630 616
631 void SyncBackendHostImpl::AddExperimentalTypes() { 617 void SyncBackendHostImpl::AddExperimentalTypes() {
632 CHECK(initialized()); 618 CHECK(initialized());
633 syncer::Experiments experiments; 619 syncer::Experiments experiments;
634 if (core_->sync_manager()->ReceivedExperiment(&experiments)) 620 if (core_->sync_manager()->ReceivedExperiment(&experiments))
635 frontend_->OnExperimentsChanged(experiments); 621 frontend_->OnExperimentsChanged(experiments);
636 } 622 }
637 623
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 void SyncBackendHostImpl::HandleMigrationRequestedOnFrontendLoop( 722 void SyncBackendHostImpl::HandleMigrationRequestedOnFrontendLoop(
737 syncer::ModelTypeSet types) { 723 syncer::ModelTypeSet types) {
738 if (!frontend_) 724 if (!frontend_)
739 return; 725 return;
740 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); 726 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
741 frontend_->OnMigrationNeededForTypes(types); 727 frontend_->OnMigrationNeededForTypes(types);
742 } 728 }
743 729
744 void SyncBackendHostImpl::OnInvalidatorStateChange( 730 void SyncBackendHostImpl::OnInvalidatorStateChange(
745 syncer::InvalidatorState state) { 731 syncer::InvalidatorState state) {
746 registrar_->sync_thread()->message_loop()->PostTask( 732 registrar_->sync_thread()->task_runner()->PostTask(
747 FROM_HERE, 733 FROM_HERE, base::Bind(&SyncBackendHostCore::DoOnInvalidatorStateChange,
748 base::Bind(&SyncBackendHostCore::DoOnInvalidatorStateChange, 734 core_.get(), state));
749 core_.get(),
750 state));
751 } 735 }
752 736
753 void SyncBackendHostImpl::OnIncomingInvalidation( 737 void SyncBackendHostImpl::OnIncomingInvalidation(
754 const syncer::ObjectIdInvalidationMap& invalidation_map) { 738 const syncer::ObjectIdInvalidationMap& invalidation_map) {
755 registrar_->sync_thread()->message_loop()->PostTask( 739 registrar_->sync_thread()->task_runner()->PostTask(
756 FROM_HERE, 740 FROM_HERE, base::Bind(&SyncBackendHostCore::DoOnIncomingInvalidation,
757 base::Bind(&SyncBackendHostCore::DoOnIncomingInvalidation, 741 core_.get(), invalidation_map));
758 core_.get(),
759 invalidation_map));
760 } 742 }
761 743
762 std::string SyncBackendHostImpl::GetOwnerName() const { 744 std::string SyncBackendHostImpl::GetOwnerName() const {
763 return "SyncBackendHostImpl"; 745 return "SyncBackendHostImpl";
764 } 746 }
765 747
766 bool SyncBackendHostImpl::CheckPassphraseAgainstCachedPendingKeys( 748 bool SyncBackendHostImpl::CheckPassphraseAgainstCachedPendingKeys(
767 const std::string& passphrase) const { 749 const std::string& passphrase) const {
768 DCHECK(cached_pending_keys_.has_blob()); 750 DCHECK(cached_pending_keys_.has_blob());
769 DCHECK(!passphrase.empty()); 751 DCHECK(!passphrase.empty());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 857
876 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { 858 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() {
877 return registrar_->sync_thread()->message_loop(); 859 return registrar_->sync_thread()->message_loop();
878 } 860 }
879 861
880 } // namespace browser_sync 862 } // namespace browser_sync
881 863
882 #undef SDVLOG 864 #undef SDVLOG
883 865
884 #undef SLOG 866 #undef SLOG
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_core.cc ('k') | chrome/browser/sync/glue/sync_backend_registrar_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698