summaryrefslogtreecommitdiffstats
path: root/sync/engine
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-27 17:13:43 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-27 17:13:43 +0000
commitbd7c4fda2b543725ec3ab29952d64674d86d6b27 (patch)
tree2707e3dfc1c1e04fbf6b07e87053a2bac48cafec /sync/engine
parent6c8715d3e19279d7b28be72c703d1af8fbfef80c (diff)
downloadchromium_src-bd7c4fda2b543725ec3ab29952d64674d86d6b27.zip
chromium_src-bd7c4fda2b543725ec3ab29952d64674d86d6b27.tar.gz
chromium_src-bd7c4fda2b543725ec3ab29952d64674d86d6b27.tar.bz2
sync: Add NonBlockingTypeProcesssor and SyncCore
Introduces the model-thread sibling of the NonBlockingTypeProcessorCore that was added in r258390. Also adds SyncCore and SyncCoreProxy, the classes that will be used to connect the two. The SyncCore lives on the sync thread and carries out requests sent to it by the SyncCoreProxy. The SyncCoreProxy is a thread-safe wrapper around the SyncCore that can be easily copied and whose methods can be called from any thread. The NonBlockingTypeProcessor is instantiated on the same thread as the data to be synced. It connects to a NonBlockingTypeProcessorCore on the sync thread by sending a request through a SyncCoreProxy. Keeping data in sync will be a collaborative effort involving both the NonBlockingTypeProcessor and NonBlockingTypeProcesssorCore, though none of this functionality has been implemented yet. As of this CL, none these classes are instantiated outside of tests. This CL should have no effect on current sync behavior. BUG=351005 Review URL: https://codereview.chromium.org/208893004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259921 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine')
-rw-r--r--sync/engine/non_blocking_type_processor_core.cc8
-rw-r--r--sync/engine/non_blocking_type_processor_core.h16
2 files changed, 21 insertions, 3 deletions
diff --git a/sync/engine/non_blocking_type_processor_core.cc b/sync/engine/non_blocking_type_processor_core.cc
index 6d6abc4..fdb9e10 100644
--- a/sync/engine/non_blocking_type_processor_core.cc
+++ b/sync/engine/non_blocking_type_processor_core.cc
@@ -10,7 +10,13 @@
namespace syncer {
NonBlockingTypeProcessorCore::NonBlockingTypeProcessorCore(
- ModelType type) : type_(type), weak_ptr_factory_(this) {
+ ModelType type,
+ scoped_refptr<base::SequencedTaskRunner> processor_task_runner,
+ base::WeakPtr<NonBlockingTypeProcessor> processor)
+ : type_(type),
+ processor_task_runner_(processor_task_runner),
+ processor_(processor),
+ weak_ptr_factory_(this) {
progress_marker_.set_data_type_id(GetSpecificsFieldNumberFromModelType(type));
}
diff --git a/sync/engine/non_blocking_type_processor_core.h b/sync/engine/non_blocking_type_processor_core.h
index 028bb3a..412d2dd 100644
--- a/sync/engine/non_blocking_type_processor_core.h
+++ b/sync/engine/non_blocking_type_processor_core.h
@@ -13,8 +13,14 @@
#include "sync/internal_api/public/base/model_type.h"
#include "sync/protocol/sync.pb.h"
+namespace base {
+class SingleThreadTaskRunner;
+}
+
namespace syncer {
+class NonBlockingTypeProcessor;
+
// A smart cache for sync types that use message passing (rather than
// transactions and the syncable::Directory) to communicate with the sync
// thread.
@@ -35,12 +41,15 @@ namespace syncer {
// example, if the sync server sends down an update for a sync entity that is
// currently pending for commit, this object will detect this condition and
// cancel the pending commit.
-class SYNC_EXPORT_PRIVATE NonBlockingTypeProcessorCore
+class SYNC_EXPORT NonBlockingTypeProcessorCore
: public UpdateHandler,
public CommitContributor,
public base::NonThreadSafe {
public:
- explicit NonBlockingTypeProcessorCore(ModelType type);
+ NonBlockingTypeProcessorCore(
+ ModelType type,
+ scoped_refptr<base::SequencedTaskRunner> processor_task_runner,
+ base::WeakPtr<NonBlockingTypeProcessor> processor);
virtual ~NonBlockingTypeProcessorCore();
ModelType GetModelType() const;
@@ -65,6 +74,9 @@ class SYNC_EXPORT_PRIVATE NonBlockingTypeProcessorCore
ModelType type_;
sync_pb::DataTypeProgressMarker progress_marker_;
+ scoped_refptr<base::SequencedTaskRunner> processor_task_runner_;
+ base::WeakPtr<NonBlockingTypeProcessor> processor_;
+
base::WeakPtrFactory<NonBlockingTypeProcessorCore> weak_ptr_factory_;
};