OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "sync/engine/get_commit_ids.h" | 5 #include "sync/engine/get_commit_ids.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 DVLOG(1) << "Excluding entry from commit due to version mismatch " | 101 DVLOG(1) << "Excluding entry from commit due to version mismatch " |
102 << entry; | 102 << entry; |
103 return true; | 103 return true; |
104 } | 104 } |
105 return false; | 105 return false; |
106 } | 106 } |
107 | 107 |
108 // Return true if this entry has any attachments that haven't yet been uploaded | 108 // Return true if this entry has any attachments that haven't yet been uploaded |
109 // to the server. | 109 // to the server. |
110 bool HasAttachmentNotOnServer(const syncable::Entry& entry) { | 110 bool HasAttachmentNotOnServer(const syncable::Entry& entry) { |
111 // TODO(maniscalco): Once AttachmentMetadata is fleshed out, implement this | 111 // TODO(maniscalco): Add test case (bug 356266). |
112 // function to return true if any of the attachments haven't been uploaded to | 112 const sync_pb::AttachmentMetadata& metadata = entry.GetAttachmentMetadata(); |
113 // the server. Add test case (bug 356266). | 113 for (int i = 0; i < metadata.record_size(); ++i) { |
| 114 if (!metadata.record(i).is_on_server()) { |
| 115 return true; |
| 116 } |
| 117 } |
114 return false; | 118 return false; |
115 } | 119 } |
116 | 120 |
117 // An entry is not considered ready for commit if any are true: | 121 // An entry is not considered ready for commit if any are true: |
118 // 1. It's in conflict. | 122 // 1. It's in conflict. |
119 // 2. It requires encryption (either the type is encrypted but a passphrase | 123 // 2. It requires encryption (either the type is encrypted but a passphrase |
120 // is missing from the cryptographer, or the entry itself wasn't properly | 124 // is missing from the cryptographer, or the entry itself wasn't properly |
121 // encrypted). | 125 // encrypted). |
122 // 3. It's type is currently throttled. | 126 // 3. It's type is currently throttled. |
123 // 4. It's a delete but has not been committed. | 127 // 4. It's a delete but has not been committed. |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 // Add moves and creates, and prepend their uncommitted parents. | 524 // Add moves and creates, and prepend their uncommitted parents. |
521 traversal.AddCreatesAndMoves(ready_unsynced_set); | 525 traversal.AddCreatesAndMoves(ready_unsynced_set); |
522 | 526 |
523 // Add all deletes. | 527 // Add all deletes. |
524 traversal.AddDeletes(ready_unsynced_set); | 528 traversal.AddDeletes(ready_unsynced_set); |
525 } | 529 } |
526 | 530 |
527 } // namespace | 531 } // namespace |
528 | 532 |
529 } // namespace syncer | 533 } // namespace syncer |
OLD | NEW |