| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 499 |
| 500 // Add moves and creates, and prepend their uncommitted parents. | 500 // Add moves and creates, and prepend their uncommitted parents. |
| 501 traversal.AddCreatesAndMoves(ready_unsynced_set); | 501 traversal.AddCreatesAndMoves(ready_unsynced_set); |
| 502 | 502 |
| 503 // Add all deletes. | 503 // Add all deletes. |
| 504 traversal.AddDeletes(ready_unsynced_set); | 504 traversal.AddDeletes(ready_unsynced_set); |
| 505 } | 505 } |
| 506 | 506 |
| 507 } // namespace | 507 } // namespace |
| 508 | 508 |
| 509 void GetCommitIds( | |
| 510 syncable::BaseTransaction* trans, | |
| 511 ModelTypeSet requested_types, | |
| 512 size_t commit_batch_size, | |
| 513 sessions::OrderedCommitSet* ordered_commit_set) { | |
| 514 for (ModelTypeSet::Iterator it = requested_types.First(); | |
| 515 it.Good(); it.Inc()) { | |
| 516 DCHECK_LE(ordered_commit_set->Size(), commit_batch_size); | |
| 517 if (ordered_commit_set->Size() >= commit_batch_size) | |
| 518 break; | |
| 519 size_t space_remaining = commit_batch_size - ordered_commit_set->Size(); | |
| 520 syncable::Directory::Metahandles out; | |
| 521 GetCommitIdsForType( | |
| 522 trans, | |
| 523 it.Get(), | |
| 524 space_remaining, | |
| 525 &out); | |
| 526 ordered_commit_set->AddCommitItems(out, it.Get()); | |
| 527 } | |
| 528 } | |
| 529 | |
| 530 } // namespace syncer | 509 } // namespace syncer |
| OLD | NEW |