OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTION_H_ | 5 #ifndef SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTION_H_ |
6 #define SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTION_H_ | 6 #define SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTION_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Updates this contribution's contents in accordance with the provided | 59 // Updates this contribution's contents in accordance with the provided |
60 // |response|. | 60 // |response|. |
61 // | 61 // |
62 // This function may make model-neutral changes to the directory. It is not | 62 // This function may make model-neutral changes to the directory. It is not |
63 // valid to call this function unless AddToCommitMessage() was called earlier. | 63 // valid to call this function unless AddToCommitMessage() was called earlier. |
64 // This function should not be called more than once. | 64 // This function should not be called more than once. |
65 virtual SyncerError ProcessCommitResponse( | 65 virtual SyncerError ProcessCommitResponse( |
66 const sync_pb::ClientToServerResponse& response, | 66 const sync_pb::ClientToServerResponse& response, |
67 sessions::StatusController* status) OVERRIDE; | 67 sessions::StatusController* status) OVERRIDE; |
68 | 68 |
69 // Cleans up any temproary state associated with the commit. Must be called | 69 // Cleans up any temporary state associated with the commit. Must be called |
70 // before destruction. | 70 // before destruction. |
71 virtual void CleanUp() OVERRIDE; | 71 virtual void CleanUp() OVERRIDE; |
72 | 72 |
73 // Returns the number of entries included in this contribution. | 73 // Returns the number of entries included in this contribution. |
74 virtual size_t GetNumEntries() const OVERRIDE; | 74 virtual size_t GetNumEntries() const OVERRIDE; |
75 | 75 |
76 private: | 76 private: |
77 class DirectoryCommitContributionTest; | 77 class DirectoryCommitContributionTest; |
78 FRIEND_TEST_ALL_PREFIXES(DirectoryCommitContributionTest, GatherByTypes); | 78 FRIEND_TEST_ALL_PREFIXES(DirectoryCommitContributionTest, GatherByTypes); |
79 FRIEND_TEST_ALL_PREFIXES(DirectoryCommitContributionTest, | 79 FRIEND_TEST_ALL_PREFIXES(DirectoryCommitContributionTest, |
80 GatherAndTruncate); | 80 GatherAndTruncate); |
81 | 81 |
82 DirectoryCommitContribution( | 82 DirectoryCommitContribution( |
| 83 ModelType type, |
83 const std::vector<int64>& metahandles, | 84 const std::vector<int64>& metahandles, |
84 const google::protobuf::RepeatedPtrField<sync_pb::SyncEntity>& entities, | 85 const google::protobuf::RepeatedPtrField<sync_pb::SyncEntity>& entities, |
85 syncable::Directory* directory); | 86 syncable::Directory* directory); |
86 | 87 |
87 void UnsetSyncingBits(); | 88 void UnsetSyncingBits(); |
88 | 89 |
89 syncable::Directory* dir_; | 90 syncable::Directory* dir_; |
| 91 ModelType type_; |
90 const std::vector<int64> metahandles_; | 92 const std::vector<int64> metahandles_; |
91 const google::protobuf::RepeatedPtrField<sync_pb::SyncEntity> entities_; | 93 const google::protobuf::RepeatedPtrField<sync_pb::SyncEntity> entities_; |
92 size_t entries_start_index_; | 94 size_t entries_start_index_; |
93 | 95 |
94 // This flag is tracks whether or not the directory entries associated with | 96 // This flag is tracks whether or not the directory entries associated with |
95 // this commit still have their SYNCING bits set. These bits will be set when | 97 // this commit still have their SYNCING bits set. These bits will be set when |
96 // the CommitContribution is created with Build() and unset when CleanUp() is | 98 // the CommitContribution is created with Build() and unset when CleanUp() is |
97 // called. This flag must be unset by the time our destructor is called. | 99 // called. This flag must be unset by the time our destructor is called. |
98 bool syncing_bits_set_; | 100 bool syncing_bits_set_; |
99 | 101 |
100 DISALLOW_COPY_AND_ASSIGN(DirectoryCommitContribution); | 102 DISALLOW_COPY_AND_ASSIGN(DirectoryCommitContribution); |
101 }; | 103 }; |
102 | 104 |
103 } // namespace syncer | 105 } // namespace syncer |
104 | 106 |
105 #endif // SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTION_H_ | 107 #endif // SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTION_H_ |
OLD | NEW |