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

Unified Diff: chrome/browser/sync/glue/generic_change_processor.h

Issue 6995008: Implement new SyncAPI and convert Preferences to it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Foward Declare++ Created 9 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: chrome/browser/sync/glue/generic_change_processor.h
diff --git a/chrome/browser/sync/glue/generic_change_processor.h b/chrome/browser/sync/glue/generic_change_processor.h
index a5547c24546f29c4f9c2cfa312384cd0405dac8f..c2110820b8faeced7d1a042c51ea8309d0231381 100644
--- a/chrome/browser/sync/glue/generic_change_processor.h
+++ b/chrome/browser/sync/glue/generic_change_processor.h
@@ -6,34 +6,69 @@
#define CHROME_BROWSER_SYNC_GLUE_GENERIC_CHANGE_PROCESSOR_H_
#pragma once
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "chrome/browser/sync/api/sync_event_processor.h"
#include "chrome/browser/sync/glue/change_processor.h"
+class SyncData;
class SyncableService;
+typedef std::vector<SyncData> SyncDataList;
+
namespace browser_sync {
-// TODO(sync): Have this become a SyncableService implementation and deprecate
-// ChangeProcessor.
-// For now, it acts as a dummy change processor that just passes all
-// ApplySyncChanges commands onto the local SyncableService..
-class GenericChangeProcessor : public ChangeProcessor {
+// TODO(sync): deprecate all change processors and have them replaced by
+// instances of this.
+// Datatype agnostic change processor. One instance of GenericChangeProcessor
+// is created for each datatype and lives on the datatype's thread. It then
+// handles all interaction with the sync api, both translating pushes from the
+// local service into transactions and receiving changes from the sync model,
+// which then get converted into SyncEvent's and sent to the local service.
+class GenericChangeProcessor : public ChangeProcessor,
+ public SyncEventProcessor {
public:
GenericChangeProcessor(SyncableService* local_service,
- UnrecoverableErrorHandler* error_handler);
+ UnrecoverableErrorHandler* error_handler,
+ sync_api::UserShare* user_share);
~GenericChangeProcessor();
// ChangeProcessor interface.
- // Just passes all arguments onto the |local_service_|
+ // Just passes all arguments onto |local_service_| by way of it's
+ // ProcessSyncEvents method.
virtual void ApplyChangesFromSyncModel(
const sync_api::BaseTransaction* trans,
const sync_api::SyncManager::ChangeRecord* changes,
- int change_count);
+ int change_count) OVERRIDE;
+
+ // SyncEventProcessor implementation.
+ virtual void ProcessSyncEvents(const SyncEventList& event_list) OVERRIDE;
+
+ // Fills |current_sync_data| with all the syncer data for the specified type.
+ virtual bool GetSyncDataForType(syncable::ModelType type,
+ SyncDataList* current_sync_data);
+
+ // Generic versions of AssociatorInterface methods. Called by
+ // SyncableServiceAdapter.
+ bool SyncModelHasUserCreatedNodes(syncable::ModelType type,
+ bool* has_nodes);
+ bool CryptoReadyIfNecessary(syncable::ModelType type);
protected:
// ChangeProcessor interface.
- virtual void StartImpl(Profile* profile); // Not implemented.
- virtual void StopImpl(); // Not implemented.
+ virtual void StartImpl(Profile* profile) OVERRIDE; // Not implemented.
+ virtual void StopImpl() OVERRIDE; // Not implemented.
+ virtual sync_api::UserShare* share_handle() OVERRIDE;
private:
+ // The SyncableService this change processor will forward changes on to.
SyncableService* local_service_;
+
+ // Our handle to the sync model. Unlike normal ChangeProcessors, we need to
+ // be able to access the sync model before the change processor begins
+ // listening to changes (the local_service_ will be interacting with us
+ // when it starts up). As such we can't wait until Start(_) has been called,
+ // and have to keep a local pointer to the user_share.
+ sync_api::UserShare* user_share_;
};
} // namespace browser_sync

Powered by Google App Engine
This is Rietveld 408576698