summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.h4
-rw-r--r--chrome/browser/sync/glue/sync_backend_host_core.cc10
-rw-r--r--chrome/browser/sync/glue/sync_backend_host_core.h4
-rw-r--r--chrome/browser/sync/glue/sync_backend_host_impl.cc11
-rw-r--r--chrome/browser/sync/glue/sync_backend_host_impl.h8
-rw-r--r--chrome/browser/sync/glue/sync_backend_host_mock.cc4
-rw-r--r--chrome/browser/sync/glue/sync_backend_host_mock.h2
-rw-r--r--chrome/browser/sync/profile_sync_service.cc2
8 files changed, 20 insertions, 25 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h
index 3f7ea4d..e9fb105 100644
--- a/chrome/browser/sync/glue/sync_backend_host.h
+++ b/chrome/browser/sync/glue/sync_backend_host.h
@@ -161,7 +161,9 @@ class SyncBackendHost : public BackendDataTypeConfigurer {
// Called on |frontend_loop_| to obtain a handle to the SyncCore needed by
// the non-blocking sync types to communicate with the server.
- virtual syncer::SyncCoreProxy GetSyncCoreProxy() = 0;
+ //
+ // Should be called only when the backend is initialized.
+ virtual scoped_ptr<syncer::SyncCoreProxy> GetSyncCoreProxy() = 0;
// Called from any thread to obtain current status information in detailed or
// summarized form.
diff --git a/chrome/browser/sync/glue/sync_backend_host_core.cc b/chrome/browser/sync/glue/sync_backend_host_core.cc
index 54c1c51..b5e2eb3 100644
--- a/chrome/browser/sync/glue/sync_backend_host_core.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_core.cc
@@ -16,6 +16,7 @@
#include "sync/internal_api/public/http_post_provider_factory.h"
#include "sync/internal_api/public/internal_components_factory.h"
#include "sync/internal_api/public/sessions/sync_session_snapshot.h"
+#include "sync/internal_api/public/sync_core_proxy.h"
#include "sync/internal_api/public/sync_manager.h"
#include "sync/internal_api/public/sync_manager_factory.h"
@@ -481,19 +482,12 @@ void SyncBackendHostCore::DoFinishInitialProcessControlTypes() {
synced_device_tracker_.get(),
sync_manager_->GetUserShare());
- base::WeakPtr<syncer::SyncCore> sync_core = sync_manager_->GetSyncCore();
-
- // De-reference the WeakPtr while we're here to signal to the debugging
- // mechanisms that it belongs to the sync thread. This helps us DCHECK
- // earlier if the pointer is misused.
- sync_core.get();
-
host_.Call(
FROM_HERE,
&SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop,
js_backend_,
debug_info_listener_,
- syncer::SyncCoreProxy(base::MessageLoopProxy::current(), sync_core));
+ sync_manager_->GetSyncCoreProxy());
js_backend_.Reset();
debug_info_listener_.Reset();
diff --git a/chrome/browser/sync/glue/sync_backend_host_core.h b/chrome/browser/sync/glue/sync_backend_host_core.h
index d458d40..eb267a6 100644
--- a/chrome/browser/sync/glue/sync_backend_host_core.h
+++ b/chrome/browser/sync/glue/sync_backend_host_core.h
@@ -212,10 +212,6 @@ class SyncBackendHostCore
void SendBufferedProtocolEventsAndEnableForwarding();
void DisableProtocolEventForwarding();
- // Returns handle to sync functionality used by non-blocking sync types.
- // Should only be called when the backend is initialized.
- syncer::SyncCoreProxy GetSyncCoreProxy();
-
// Delete the sync data folder to cleanup backend data. Happens the first
// time sync is enabled for a user (to prevent accidentally reusing old
// sync databases), as well as shutdown when you're no longer syncing.
diff --git a/chrome/browser/sync/glue/sync_backend_host_impl.cc b/chrome/browser/sync/glue/sync_backend_host_impl.cc
index 5049879..1d7e482 100644
--- a/chrome/browser/sync/glue/sync_backend_host_impl.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_impl.cc
@@ -432,8 +432,8 @@ syncer::UserShare* SyncBackendHostImpl::GetUserShare() const {
return core_->sync_manager()->GetUserShare();
}
-syncer::SyncCoreProxy SyncBackendHostImpl::GetSyncCoreProxy() {
- return *sync_core_proxy_.get();
+scoped_ptr<syncer::SyncCoreProxy> SyncBackendHostImpl::GetSyncCoreProxy() {
+ return scoped_ptr<syncer::SyncCoreProxy>(sync_core_proxy_->Clone());
}
SyncBackendHostImpl::Status SyncBackendHostImpl::GetDetailedStatus() {
@@ -597,15 +597,16 @@ void SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop(
const syncer::WeakHandle<syncer::JsBackend> js_backend,
const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>
debug_info_listener,
- syncer::SyncCoreProxy sync_core_proxy) {
+ syncer::SyncCoreProxy* sync_core_proxy) {
DCHECK_EQ(base::MessageLoop::current(), frontend_loop_);
+
+ sync_core_proxy_ = sync_core_proxy->Clone();
+
if (!frontend_)
return;
initialized_ = true;
- sync_core_proxy_.reset(new syncer::SyncCoreProxy(sync_core_proxy));
-
invalidator_->RegisterInvalidationHandler(this);
invalidation_handler_registered_ = true;
diff --git a/chrome/browser/sync/glue/sync_backend_host_impl.h b/chrome/browser/sync/glue/sync_backend_host_impl.h
index 84f9491..9ba56b3 100644
--- a/chrome/browser/sync/glue/sync_backend_host_impl.h
+++ b/chrome/browser/sync/glue/sync_backend_host_impl.h
@@ -112,7 +112,7 @@ class SyncBackendHostImpl
ChangeProcessor* change_processor) OVERRIDE;
virtual void DeactivateDataType(syncer::ModelType type) OVERRIDE;
virtual syncer::UserShare* GetUserShare() const OVERRIDE;
- virtual syncer::SyncCoreProxy GetSyncCoreProxy() OVERRIDE;
+ virtual scoped_ptr<syncer::SyncCoreProxy> GetSyncCoreProxy() OVERRIDE;
virtual Status GetDetailedStatus() OVERRIDE;
virtual syncer::sessions::SyncSessionSnapshot
GetLastSessionSnapshot() const OVERRIDE;
@@ -164,11 +164,15 @@ class SyncBackendHostImpl
// Reports backend initialization success. Includes some objects from sync
// manager initialization to be passed back to the UI thread.
+ //
+ // |sync_core_proxy| points to an object owned by the SyncManager. Ownership
+ // is not transferred, but we can obtain our own copy of the object using its
+ // Clone() method.
virtual void HandleInitializationSuccessOnFrontendLoop(
const syncer::WeakHandle<syncer::JsBackend> js_backend,
const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>
debug_info_listener,
- syncer::SyncCoreProxy sync_core_proxy);
+ syncer::SyncCoreProxy* sync_core_proxy);
// Downloading of control types failed and will be retried. Invokes the
// frontend's sync configure retry method.
diff --git a/chrome/browser/sync/glue/sync_backend_host_mock.cc b/chrome/browser/sync/glue/sync_backend_host_mock.cc
index 21eeedb8..aee76c6 100644
--- a/chrome/browser/sync/glue/sync_backend_host_mock.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_mock.cc
@@ -69,8 +69,8 @@ syncer::UserShare* SyncBackendHostMock::GetUserShare() const {
return NULL;
}
-syncer::SyncCoreProxy SyncBackendHostMock::GetSyncCoreProxy() {
- return syncer::SyncCoreProxy::GetInvalidSyncCoreProxyForTest();
+scoped_ptr<syncer::SyncCoreProxy> SyncBackendHostMock::GetSyncCoreProxy() {
+ return scoped_ptr<syncer::SyncCoreProxy>();
}
SyncBackendHost::Status SyncBackendHostMock::GetDetailedStatus() {
diff --git a/chrome/browser/sync/glue/sync_backend_host_mock.h b/chrome/browser/sync/glue/sync_backend_host_mock.h
index 60af243..0b0782d 100644
--- a/chrome/browser/sync/glue/sync_backend_host_mock.h
+++ b/chrome/browser/sync/glue/sync_backend_host_mock.h
@@ -72,7 +72,7 @@ class SyncBackendHostMock : public SyncBackendHost {
virtual syncer::UserShare* GetUserShare() const OVERRIDE;
- virtual syncer::SyncCoreProxy GetSyncCoreProxy() OVERRIDE;
+ virtual scoped_ptr<syncer::SyncCoreProxy> GetSyncCoreProxy() OVERRIDE;
virtual Status GetDetailedStatus() OVERRIDE;
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index fce9958..6c368da 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -947,8 +947,6 @@ void ProfileSyncService::OnBackendInitialized(
backend_->RequestBufferedProtocolEventsAndEnableForwarding();
}
- syncer::SyncCoreProxy sync_core_proxy_ = backend_->GetSyncCoreProxy();
-
// If we have a cached passphrase use it to decrypt/encrypt data now that the
// backend is initialized. We want to call this before notifying observers in
// case this operation affects the "passphrase required" status.