Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 void SyncBackendHostImpl::StopSyncingForShutdown() { | 249 void SyncBackendHostImpl::StopSyncingForShutdown() { |
| 250 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); | 250 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); |
| 251 | 251 |
| 252 // Immediately stop sending messages to the frontend. | 252 // Immediately stop sending messages to the frontend. |
| 253 frontend_ = NULL; | 253 frontend_ = NULL; |
| 254 | 254 |
| 255 // Stop listening for and forwarding locally-triggered sync refresh requests. | 255 // Stop listening for and forwarding locally-triggered sync refresh requests. |
| 256 notification_registrar_.RemoveAll(); | 256 notification_registrar_.RemoveAll(); |
| 257 | 257 |
| 258 // Stop non-blocking sync types from sending any more requests to the syncer. | 258 // Stop non-blocking sync types from sending any more requests to the syncer. |
| 259 sync_core_proxy_.reset(); | 259 sync_context_proxy_.reset(); |
| 260 | 260 |
| 261 DCHECK(registrar_->sync_thread()->IsRunning()); | 261 DCHECK(registrar_->sync_thread()->IsRunning()); |
| 262 | 262 |
| 263 registrar_->RequestWorkerStopOnUIThread(); | 263 registrar_->RequestWorkerStopOnUIThread(); |
| 264 | 264 |
| 265 core_->ShutdownOnUIThread(); | 265 core_->ShutdownOnUIThread(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 scoped_ptr<base::Thread> SyncBackendHostImpl::Shutdown(ShutdownOption option) { | 268 scoped_ptr<base::Thread> SyncBackendHostImpl::Shutdown(ShutdownOption option) { |
| 269 // StopSyncingForShutdown() (which nulls out |frontend_|) should be | 269 // StopSyncingForShutdown() (which nulls out |frontend_|) should be |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 } | 452 } |
| 453 | 453 |
| 454 void SyncBackendHostImpl::DeactivateDataType(syncer::ModelType type) { | 454 void SyncBackendHostImpl::DeactivateDataType(syncer::ModelType type) { |
| 455 registrar_->DeactivateDataType(type); | 455 registrar_->DeactivateDataType(type); |
| 456 } | 456 } |
| 457 | 457 |
| 458 syncer::UserShare* SyncBackendHostImpl::GetUserShare() const { | 458 syncer::UserShare* SyncBackendHostImpl::GetUserShare() const { |
| 459 return core_->sync_manager()->GetUserShare(); | 459 return core_->sync_manager()->GetUserShare(); |
| 460 } | 460 } |
| 461 | 461 |
| 462 scoped_ptr<syncer::SyncCoreProxy> SyncBackendHostImpl::GetSyncCoreProxy() { | 462 scoped_ptr<syncer::SyncContextProxy> |
| 463 return sync_core_proxy_.get() ? | 463 SyncBackendHostImpl::GetSyncContextProxy() { |
| 464 scoped_ptr<syncer::SyncCoreProxy>(sync_core_proxy_->Clone()) : | 464 return sync_context_proxy_.get() ? scoped_ptr<syncer::SyncContextProxy>( |
| 465 scoped_ptr<syncer::SyncCoreProxy>(); | 465 sync_context_proxy_->Clone()) |
| 466 : scoped_ptr<syncer::SyncContextProxy>(); | |
| 466 } | 467 } |
| 467 | 468 |
| 468 SyncBackendHostImpl::Status SyncBackendHostImpl::GetDetailedStatus() { | 469 SyncBackendHostImpl::Status SyncBackendHostImpl::GetDetailedStatus() { |
| 469 DCHECK(initialized()); | 470 DCHECK(initialized()); |
| 470 return core_->sync_manager()->GetDetailedStatus(); | 471 return core_->sync_manager()->GetDetailedStatus(); |
| 471 } | 472 } |
| 472 | 473 |
| 473 syncer::sessions::SyncSessionSnapshot | 474 syncer::sessions::SyncSessionSnapshot |
| 474 SyncBackendHostImpl::GetLastSessionSnapshot() const { | 475 SyncBackendHostImpl::GetLastSessionSnapshot() const { |
| 475 return last_snapshot_; | 476 return last_snapshot_; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 638 if (!frontend_) | 639 if (!frontend_) |
| 639 return; | 640 return; |
| 640 | 641 |
| 641 frontend_->OnSyncConfigureRetry(); | 642 frontend_->OnSyncConfigureRetry(); |
| 642 } | 643 } |
| 643 | 644 |
| 644 void SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop( | 645 void SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop( |
| 645 const syncer::WeakHandle<syncer::JsBackend> js_backend, | 646 const syncer::WeakHandle<syncer::JsBackend> js_backend, |
| 646 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener> | 647 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener> |
| 647 debug_info_listener, | 648 debug_info_listener, |
| 648 syncer::SyncCoreProxy* sync_core_proxy) { | 649 syncer::SyncContextProxy* sync_context_proxy) { |
| 649 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); | 650 DCHECK_EQ(base::MessageLoop::current(), frontend_loop_); |
| 650 | 651 |
| 651 if (sync_core_proxy) | 652 if (sync_context_proxy) |
| 652 sync_core_proxy_ = sync_core_proxy->Clone(); | 653 sync_context_proxy_ = sync_context_proxy->Clone(); |
|
stanisc
2014/06/24 21:59:00
Preexisting: should sync_context_proxy be cloned i
rlarocque
2014/06/24 23:08:32
True, these lines should be moved below the fronte
| |
| 653 | 654 |
| 654 if (!frontend_) | 655 if (!frontend_) |
| 655 return; | 656 return; |
| 656 | 657 |
| 657 initialized_ = true; | 658 initialized_ = true; |
| 658 | 659 |
| 659 if (invalidator_) { | 660 if (invalidator_) { |
| 660 invalidator_->RegisterInvalidationHandler(this); | 661 invalidator_->RegisterInvalidationHandler(this); |
| 661 invalidation_handler_registered_ = true; | 662 invalidation_handler_registered_ = true; |
| 662 | 663 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 | 876 |
| 876 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { | 877 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { |
| 877 return registrar_->sync_thread()->message_loop(); | 878 return registrar_->sync_thread()->message_loop(); |
| 878 } | 879 } |
| 879 | 880 |
| 880 } // namespace browser_sync | 881 } // namespace browser_sync |
| 881 | 882 |
| 882 #undef SDVLOG | 883 #undef SDVLOG |
| 883 | 884 |
| 884 #undef SLOG | 885 #undef SLOG |
| OLD | NEW |