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 #include "sync/engine/commit_processor.h" | 5 #include "sync/engine/commit_processor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 it.Good(); it.Inc()) { | 30 it.Good(); it.Inc()) { |
31 CommitContributorMap::iterator cm_it = | 31 CommitContributorMap::iterator cm_it = |
32 commit_contributor_map_->find(it.Get()); | 32 commit_contributor_map_->find(it.Get()); |
33 if (cm_it == commit_contributor_map_->end()) { | 33 if (cm_it == commit_contributor_map_->end()) { |
34 NOTREACHED() | 34 NOTREACHED() |
35 << "Could not find requested type " << ModelTypeToString(it.Get()) | 35 << "Could not find requested type " << ModelTypeToString(it.Get()) |
36 << " in contributor map."; | 36 << " in contributor map."; |
37 continue; | 37 continue; |
38 } | 38 } |
39 size_t spaces_remaining = max_entries - num_entries; | 39 size_t spaces_remaining = max_entries - num_entries; |
40 scoped_ptr<CommitContribution> contribution = | 40 std::unique_ptr<CommitContribution> contribution = |
41 cm_it->second->GetContribution(spaces_remaining); | 41 cm_it->second->GetContribution(spaces_remaining); |
42 if (contribution) { | 42 if (contribution) { |
43 num_entries += contribution->GetNumEntries(); | 43 num_entries += contribution->GetNumEntries(); |
44 contributions->insert(std::make_pair(it.Get(), std::move(contribution))); | 44 contributions->insert(std::make_pair(it.Get(), std::move(contribution))); |
45 } | 45 } |
46 if (num_entries >= max_entries) { | 46 if (num_entries >= max_entries) { |
47 DCHECK_EQ(num_entries, max_entries) | 47 DCHECK_EQ(num_entries, max_entries) |
48 << "Number of commit entries exceeeds maximum"; | 48 << "Number of commit entries exceeeds maximum"; |
49 break; | 49 break; |
50 } | 50 } |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 } // namespace syncer | 54 } // namespace syncer |
OLD | NEW |