Index: sync/engine/directory_commit_contribution.h |
diff --git a/sync/engine/sync_directory_commit_contribution.h b/sync/engine/directory_commit_contribution.h |
similarity index 76% |
rename from sync/engine/sync_directory_commit_contribution.h |
rename to sync/engine/directory_commit_contribution.h |
index 89340566755b55ce1e396ba4fad22ac32c12ddf1..8659cc60df5b4d63c3db14a62fc2a8d9c4d1c05e 100644 |
--- a/sync/engine/sync_directory_commit_contribution.h |
+++ b/sync/engine/directory_commit_contribution.h |
@@ -2,13 +2,15 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef SYNC_ENGINE_SYNC_DIRECTORY_COMMIT_CONTRIBUTION_H_ |
-#define SYNC_ENGINE_SYNC_DIRECTORY_COMMIT_CONTRIBUTION_H_ |
+#ifndef SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTION_H_ |
+#define SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTION_H_ |
#include <vector> |
#include "base/gtest_prod_util.h" |
+#include "base/memory/scoped_ptr.h" |
#include "sync/base/sync_export.h" |
+#include "sync/engine/commit_contribution.h" |
#include "sync/internal_api/public/base/model_type.h" |
#include "sync/internal_api/public/util/syncer_error.h" |
#include "sync/protocol/sync.pb.h" |
@@ -30,10 +32,11 @@ class Directory; |
// This class handles the bookkeeping related to the commit of these items, |
// including processing the commit response message and setting and unsetting |
// the SYNCING bits. |
-class SYNC_EXPORT_PRIVATE SyncDirectoryCommitContribution { |
+class SYNC_EXPORT_PRIVATE DirectoryCommitContribution |
+ : public CommitContribution { |
public: |
// This destructor will DCHECK if UnsetSyncingBits() has not been called yet. |
- ~SyncDirectoryCommitContribution(); |
+ virtual ~DirectoryCommitContribution(); |
// Build a CommitContribution from the IS_UNSYNCED items in |dir| with the |
// given |type|. The contribution will include at most |max_items| entries. |
@@ -41,7 +44,7 @@ class SYNC_EXPORT_PRIVATE SyncDirectoryCommitContribution { |
// This function may return NULL if this type has no items ready for and |
// requiring commit. This function may make model neutral changes to the |
// directory. |
- static SyncDirectoryCommitContribution* Build( |
+ static scoped_ptr<DirectoryCommitContribution> Build( |
syncable::Directory* dir, |
ModelType type, |
size_t max_items); |
@@ -51,7 +54,7 @@ class SYNC_EXPORT_PRIVATE SyncDirectoryCommitContribution { |
// This function is not const. It will update some state in this contribution |
// that will be used when processing the associated commit response. This |
// function should not be called more than once. |
- void AddToCommitMessage(sync_pb::ClientToServerMessage* msg); |
+ virtual void AddToCommitMessage(sync_pb::ClientToServerMessage* msg) OVERRIDE; |
// Updates this contribution's contents in accordance with the provided |
// |response|. |
@@ -59,24 +62,24 @@ class SYNC_EXPORT_PRIVATE SyncDirectoryCommitContribution { |
// This function may make model-neutral changes to the directory. It is not |
// valid to call this function unless AddToCommitMessage() was called earlier. |
// This function should not be called more than once. |
- SyncerError ProcessCommitResponse( |
+ virtual SyncerError ProcessCommitResponse( |
const sync_pb::ClientToServerResponse& response, |
- sessions::StatusController* status); |
+ sessions::StatusController* status) OVERRIDE; |
// Cleans up any temproary state associated with the commit. Must be called |
// before destruction. |
- void CleanUp(); |
+ virtual void CleanUp() OVERRIDE; |
// Returns the number of entries included in this contribution. |
- size_t GetNumEntries() const; |
+ virtual size_t GetNumEntries() const OVERRIDE; |
private: |
- class SyncDirectoryCommitContributionTest; |
- FRIEND_TEST_ALL_PREFIXES(SyncDirectoryCommitContributionTest, GatherByTypes); |
- FRIEND_TEST_ALL_PREFIXES(SyncDirectoryCommitContributionTest, |
+ class DirectoryCommitContributionTest; |
+ FRIEND_TEST_ALL_PREFIXES(DirectoryCommitContributionTest, GatherByTypes); |
+ FRIEND_TEST_ALL_PREFIXES(DirectoryCommitContributionTest, |
GatherAndTruncate); |
- SyncDirectoryCommitContribution( |
+ DirectoryCommitContribution( |
const std::vector<int64>& metahandles, |
const google::protobuf::RepeatedPtrField<sync_pb::SyncEntity>& entities, |
syncable::Directory* directory); |
@@ -94,9 +97,9 @@ class SYNC_EXPORT_PRIVATE SyncDirectoryCommitContribution { |
// called. This flag must be unset by the time our destructor is called. |
bool syncing_bits_set_; |
- DISALLOW_COPY_AND_ASSIGN(SyncDirectoryCommitContribution); |
+ DISALLOW_COPY_AND_ASSIGN(DirectoryCommitContribution); |
}; |
} // namespace syncer |
-#endif // SYNC_ENGINE_SYNC_DIRECTORY_COMMIT_CONTRIBUTION_H_ |
+#endif // SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTION_H_ |