#ifndef SYNC_ENGINE_NON_BLOCKING_TYPE_PROCESSOR_CORE_H_
#define SYNC_ENGINE_NON_BLOCKING_TYPE_PROCESSOR_CORE_H_
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "sync/base/sync_export.h"
#include "sync/engine/commit_contributor.h"
#include "sync/engine/update_handler.h"
#include "sync/internal_api/public/base/model_type.h"
#include "sync/protocol/sync.pb.h"
namespace base {
class SingleThreadTaskRunner;
}
namespace syncer {
class NonBlockingTypeProcessor;
class SYNC_EXPORT NonBlockingTypeProcessorCore
: public UpdateHandler,
public CommitContributor,
public base::NonThreadSafe {
public:
NonBlockingTypeProcessorCore(
ModelType type,
scoped_refptr<base::SequencedTaskRunner> processor_task_runner,
base::WeakPtr<NonBlockingTypeProcessor> processor);
virtual ~NonBlockingTypeProcessorCore();
ModelType GetModelType() const;
virtual void GetDownloadProgress(
sync_pb::DataTypeProgressMarker* progress_marker) const OVERRIDE;
virtual void GetDataTypeContext(sync_pb::DataTypeContext* context) const
OVERRIDE;
virtual void ProcessGetUpdatesResponse(
const sync_pb::DataTypeProgressMarker& progress_marker,
const sync_pb::DataTypeContext& mutated_context,
const SyncEntityList& applicable_updates,
sessions::StatusController* status) OVERRIDE;
virtual void ApplyUpdates(sessions::StatusController* status) OVERRIDE;
virtual void PassiveApplyUpdates(sessions::StatusController* status) OVERRIDE;
virtual scoped_ptr<CommitContribution> GetContribution(
size_t max_entries) OVERRIDE;
base::WeakPtr<NonBlockingTypeProcessorCore> AsWeakPtr();
private:
ModelType type_;
sync_pb::DataTypeProgressMarker progress_marker_;
scoped_refptr<base::SequencedTaskRunner> processor_task_runner_;
base::WeakPtr<NonBlockingTypeProcessor> processor_;
base::WeakPtrFactory<NonBlockingTypeProcessorCore> weak_ptr_factory_;
};
}
#endif