summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/sync_manager_impl.h
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-12 01:46:05 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-12 01:46:05 +0000
commit9508f239f64b85fa913df6f7518c231b6bf7e78c (patch)
treeefcce01fd3f4db7d015cd126fbe8e98dd68a6e36 /sync/internal_api/sync_manager_impl.h
parentd9615f5d7d3bb74864ff8d7750221fdbb1ee48b2 (diff)
downloadchromium_src-9508f239f64b85fa913df6f7518c231b6bf7e78c.zip
chromium_src-9508f239f64b85fa913df6f7518c231b6bf7e78c.tar.gz
chromium_src-9508f239f64b85fa913df6f7518c231b6bf7e78c.tar.bz2
sync: Add interface for SyncCoreProxy
Defines an interface for SyncCoreProxy. This will be used for testing. The SyncCoreProxy is a natural boundary for tests. To its clients, it represents the sync thread and all of its functionality. By allowing it to be overloaded in tests, we can stub out all of the sync thread functionality so we can better test the parts that communicate with it. This required some fairly large changes. In order to allow it to be used as an interface, the SyncCoreProxy could no longer be stored on the stack and copied around everywhere. The objects that call its virtual functions must manage it as a pointer or reference, rather than a concrete object. For now, ownership is settled by having one or two elements on each thread hold a scoped_ptr to their own copy of it. The SyncCoreProxy is passed around as a pointer, and ownership is not transferred in these calls. Objects that want to keep their own private copy can make use of the Clone() method and store the resulting copy in a scoped_ptr. BUG=351005 Review URL: https://codereview.chromium.org/225863006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263448 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/sync_manager_impl.h')
-rw-r--r--sync/internal_api/sync_manager_impl.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/sync/internal_api/sync_manager_impl.h b/sync/internal_api/sync_manager_impl.h
index 003471c..653e48a 100644
--- a/sync/internal_api/sync_manager_impl.h
+++ b/sync/internal_api/sync_manager_impl.h
@@ -19,6 +19,7 @@
#include "sync/internal_api/js_sync_encryption_handler_observer.h"
#include "sync/internal_api/js_sync_manager_observer.h"
#include "sync/internal_api/protocol_event_buffer.h"
+#include "sync/internal_api/public/sync_core_proxy.h"
#include "sync/internal_api/public/sync_manager.h"
#include "sync/internal_api/public/user_share.h"
#include "sync/internal_api/sync_encryption_handler_impl.h"
@@ -33,6 +34,7 @@ namespace syncer {
class ModelTypeRegistry;
class SyncAPIServerConnectionManager;
+class SyncCore;
class WriteNode;
class WriteTransaction;
@@ -110,7 +112,7 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl :
virtual void SaveChanges() OVERRIDE;
virtual void ShutdownOnSyncThread() OVERRIDE;
virtual UserShare* GetUserShare() OVERRIDE;
- virtual base::WeakPtr<syncer::SyncCore> GetSyncCore() OVERRIDE;
+ virtual syncer::SyncCoreProxy* GetSyncCoreProxy() OVERRIDE;
virtual const std::string cache_guid() OVERRIDE;
virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE;
virtual bool HasUnsyncedItems() OVERRIDE;
@@ -298,8 +300,9 @@ class SYNC_EXPORT_PRIVATE SyncManagerImpl :
// This state changes when entering or exiting a configuration cycle.
scoped_ptr<ModelTypeRegistry> model_type_registry_;
- // The main interface for non-blocking sync types.
+ // The main interface for non-blocking sync types and a thread-safe wrapper.
scoped_ptr<SyncCore> sync_core_;
+ scoped_ptr<SyncCoreProxy> sync_core_proxy_;
// A container of various bits of information used by the SyncScheduler to
// create SyncSessions. Must outlive the SyncScheduler.