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

Unified Diff: sync/engine/sync_directory_update_handler.h

Issue 72403003: sync: Per-type update application (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/sync_directory_update_handler.h
diff --git a/sync/engine/sync_directory_update_handler.h b/sync/engine/sync_directory_update_handler.h
index 38256a42668162647ca3b263c2a1efeb0786eb78..bdb176d17b130fffa0fdfd0857ba4383016d8379 100644
--- a/sync/engine/sync_directory_update_handler.h
+++ b/sync/engine/sync_directory_update_handler.h
@@ -8,9 +8,11 @@
#include <map>
#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
#include "sync/base/sync_export.h"
#include "sync/engine/process_updates_util.h"
#include "sync/internal_api/public/base/model_type.h"
+#include "sync/internal_api/public/engine/model_safe_worker.h"
Nicolas Zea 2013/11/19 22:45:26 I think you can probably forward declare this
rlarocque 2013/11/21 18:28:47 Done.
namespace sync_pb {
class DataTypeProgressMarker;
@@ -35,7 +37,9 @@ class Directory;
// It can also process a set of received SyncEntities and store their data.
class SYNC_EXPORT_PRIVATE SyncDirectoryUpdateHandler {
public:
- SyncDirectoryUpdateHandler(syncable::Directory* dir, ModelType type);
+ SyncDirectoryUpdateHandler(syncable::Directory* dir,
+ ModelType type,
+ scoped_refptr<ModelSafeWorker> worker);
~SyncDirectoryUpdateHandler();
// Fills the given parameter with the stored progress marker for this type.
@@ -53,8 +57,13 @@ class SYNC_EXPORT_PRIVATE SyncDirectoryUpdateHandler {
const SyncEntityList& applicable_updates,
sessions::StatusController* status);
+ // If there are updates to apply, apply them on the proper thread.
+ // Delegates to ApplyUpdatesImpl().
+ void ApplyUpdates(sessions::StatusController* status);
+
private:
- friend class SyncDirectoryUpdateHandlerTest;
+ friend class SyncDirectoryUpdateHandlerApplyUpdateTest;
+ friend class SyncDirectoryUpdateHandlerProcessUpdateTest;
// Processes the given SyncEntities and stores their data in the directory.
// Their types must match this update handler's type.
@@ -68,8 +77,12 @@ class SYNC_EXPORT_PRIVATE SyncDirectoryUpdateHandler {
void UpdateProgressMarker(
const sync_pb::DataTypeProgressMarker& progress_marker);
+ // Skips all checks and goes straight to applying the updates.
+ SyncerError ApplyUpdatesImpl(sessions::StatusController* status);
+
syncable::Directory* dir_;
ModelType type_;
+ scoped_refptr<ModelSafeWorker> worker_;
DISALLOW_COPY_AND_ASSIGN(SyncDirectoryUpdateHandler);
};

Powered by Google App Engine
This is Rietveld 408576698