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

Unified Diff: sync/engine/non_blocking_type_processor_core.h

Issue 294473017: WIP: Towards NonBlockingTypeProcessorCore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: sync/engine/non_blocking_type_processor_core.h
diff --git a/sync/engine/non_blocking_type_processor_core.h b/sync/engine/non_blocking_type_processor_core.h
index e2263499562f82fe9515b0455ee40b79ac155636..5b8cf225bb6dee3b520339e80121712ee10fa4f6 100644
--- a/sync/engine/non_blocking_type_processor_core.h
+++ b/sync/engine/non_blocking_type_processor_core.h
@@ -6,10 +6,12 @@
#define SYNC_ENGINE_NON_BLOCKING_TYPE_PROCESSOR_CORE_H_
#include "base/memory/weak_ptr.h"
+#include "base/stl_util.h"
#include "base/threading/non_thread_safe.h"
#include "sync/base/sync_export.h"
#include "sync/engine/commit_contributor.h"
#include "sync/engine/non_blocking_sync_common.h"
+#include "sync/engine/non_blocking_type_processor_interface.h"
#include "sync/engine/update_handler.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/protocol/sync.pb.h"
@@ -21,6 +23,7 @@ class SingleThreadTaskRunner;
namespace syncer {
class NonBlockingTypeProcessor;
+class SyncThreadSyncEntity;
// A smart cache for sync types that use message passing (rather than
// transactions and the syncable::Directory) to communicate with the sync
@@ -49,8 +52,8 @@ class SYNC_EXPORT NonBlockingTypeProcessorCore
public:
NonBlockingTypeProcessorCore(
ModelType type,
- scoped_refptr<base::SequencedTaskRunner> processor_task_runner,
- base::WeakPtr<NonBlockingTypeProcessor> processor);
+ DataTypeState initial_state,
+ scoped_ptr<NonBlockingTypeProcessorInterface> processor_interface);
virtual ~NonBlockingTypeProcessorCore();
ModelType GetModelType() const;
@@ -75,14 +78,29 @@ class SYNC_EXPORT NonBlockingTypeProcessorCore
virtual scoped_ptr<CommitContribution> GetContribution(
size_t max_entries) OVERRIDE;
+ // Callback for when our contribution gets a response.
+ void ProcessCommitResponses(const CommitResponseDataList& response_list);
+
base::WeakPtr<NonBlockingTypeProcessorCore> AsWeakPtr();
private:
+ typedef std::map<std::string, SyncThreadSyncEntity*> EntityMap;
+
+ void RequestCommit(const CommitRequestData& request);
+
+ bool CanCommitItems() const;
+ void ContributeToCommitEntity(sync_pb::SyncEntity* commit_entity);
+
ModelType type_;
- sync_pb::DataTypeProgressMarker progress_marker_;
+ DataTypeState data_type_state_;
+
+ // Abstraction around the NonBlockingTypeProcessor so this class
+ // doesn't need to know about its specific implementation or
+ // which thread it's on. This makes it easier to write tests.
+ scoped_ptr<NonBlockingTypeProcessorInterface> processor_interface_;
- scoped_refptr<base::SequencedTaskRunner> processor_task_runner_;
- base::WeakPtr<NonBlockingTypeProcessor> processor_;
+ EntityMap entities_;
+ STLValueDeleter<EntityMap> entities_deleter_;
base::WeakPtrFactory<NonBlockingTypeProcessorCore> weak_ptr_factory_;
};
« no previous file with comments | « sync/engine/non_blocking_type_commit_contribution.cc ('k') | sync/engine/non_blocking_type_processor_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698