Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(735)

Side by Side Diff: sync/engine/commit_processor.cc

Issue 1490613002: (trybot test) base: Make ScopedPtrMap use DISALLOW_COPY_AND_ASSIGN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sync/engine/commit.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <map> 7 #include <map>
8 #include <utility>
8 9
9 #include "sync/engine/commit_contribution.h" 10 #include "sync/engine/commit_contribution.h"
10 #include "sync/engine/commit_contributor.h" 11 #include "sync/engine/commit_contributor.h"
11 #include "sync/protocol/sync.pb.h" 12 #include "sync/protocol/sync.pb.h"
12 13
13 namespace syncer { 14 namespace syncer {
14 15
15 typedef std::map<ModelType, size_t> TypeToIndexMap; 16 typedef std::map<ModelType, size_t> TypeToIndexMap;
16 17
17 CommitProcessor::CommitProcessor(CommitContributorMap* commit_contributor_map) 18 CommitProcessor::CommitProcessor(CommitContributorMap* commit_contributor_map)
(...skipping 14 matching lines...) Expand all
32 NOTREACHED() 33 NOTREACHED()
33 << "Could not find requested type " << ModelTypeToString(it.Get()) 34 << "Could not find requested type " << ModelTypeToString(it.Get())
34 << " in contributor map."; 35 << " in contributor map.";
35 continue; 36 continue;
36 } 37 }
37 size_t spaces_remaining = max_entries - num_entries; 38 size_t spaces_remaining = max_entries - num_entries;
38 scoped_ptr<CommitContribution> contribution = 39 scoped_ptr<CommitContribution> contribution =
39 cm_it->second->GetContribution(spaces_remaining); 40 cm_it->second->GetContribution(spaces_remaining);
40 if (contribution) { 41 if (contribution) {
41 num_entries += contribution->GetNumEntries(); 42 num_entries += contribution->GetNumEntries();
42 contributions->insert(it.Get(), contribution.Pass()); 43 DCHECK(!contributions->count(it.Get()));
44 (*contributions)[it.Get()] = std::move(contribution);
Nico 2015/12/01 01:02:16 Should there be a comment here saying that this us
danakj 2015/12/01 01:03:12 Oh, or maybe we don't need to do this and can inse
vmpstr 2015/12/01 01:03:58 Oh this was just me applying the latest patchset,
43 } 45 }
44 if (num_entries >= max_entries) { 46 if (num_entries >= max_entries) {
45 DCHECK_EQ(num_entries, max_entries) 47 DCHECK_EQ(num_entries, max_entries)
46 << "Number of commit entries exceeeds maximum"; 48 << "Number of commit entries exceeeds maximum";
47 break; 49 break;
48 } 50 }
49 } 51 }
50 } 52 }
51 53
52 } // namespace syncer 54 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/commit.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698