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

Unified Diff: sync/engine/commit.cc

Issue 1096983002: Update usages of std::map to use ScopedPtrMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@passwordmanager-scopedmemory
Patch Set: Rebase. Created 5 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/engine/commit.h ('k') | sync/engine/commit_processor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/commit.cc
diff --git a/sync/engine/commit.cc b/sync/engine/commit.cc
index 1811923f1dfbc779da12a8bf6abf0470929be2d5..f607be4c8b4e91499e2d1184c9c8d491d6b0d7ba 100644
--- a/sync/engine/commit.cc
+++ b/sync/engine/commit.cc
@@ -16,15 +16,13 @@
namespace syncer {
-Commit::Commit(
- const std::map<ModelType, CommitContribution*>& contributions,
- const sync_pb::ClientToServerMessage& message,
- ExtensionsActivity::Records extensions_activity_buffer)
- : contributions_(contributions),
- deleter_(&contributions_),
- message_(message),
- extensions_activity_buffer_(extensions_activity_buffer),
- cleaned_up_(false) {
+Commit::Commit(ContributionMap contributions,
+ const sync_pb::ClientToServerMessage& message,
+ ExtensionsActivity::Records extensions_activity_buffer)
+ : contributions_(contributions.Pass()),
+ message_(message),
+ extensions_activity_buffer_(extensions_activity_buffer),
+ cleaned_up_(false) {
}
Commit::~Commit() {
@@ -59,7 +57,7 @@ Commit* Commit::Init(
// Set extensions activity if bookmark commits are present.
ExtensionsActivity::Records extensions_activity_buffer;
- ContributionMap::iterator it = contributions.find(syncer::BOOKMARKS);
+ ContributionMap::const_iterator it = contributions.find(syncer::BOOKMARKS);
if (it != contributions.end() && it->second->GetNumEntries() != 0) {
commit_util::AddExtensionsActivityToMessage(
extensions_activity,
@@ -73,13 +71,14 @@ Commit* Commit::Init(
commit_message);
// Finally, serialize all our contributions.
- for (std::map<ModelType, CommitContribution*>::iterator it =
- contributions.begin(); it != contributions.end(); ++it) {
+ for (std::map<ModelType, CommitContribution*>::const_iterator it =
+ contributions.begin();
+ it != contributions.end(); ++it) {
it->second->AddToCommitMessage(&message);
}
// If we made it this far, then we've successfully prepared a commit message.
- return new Commit(contributions, message, extensions_activity_buffer);
+ return new Commit(contributions.Pass(), message, extensions_activity_buffer);
}
SyncerError Commit::PostAndProcessResponse(
@@ -148,8 +147,8 @@ SyncerError Commit::PostAndProcessResponse(
// Let the contributors process the responses to each of their requests.
SyncerError processing_result = SYNCER_OK;
- for (std::map<ModelType, CommitContribution*>::iterator it =
- contributions_.begin(); it != contributions_.end(); ++it) {
+ for (ContributionMap::const_iterator it = contributions_.begin();
+ it != contributions_.end(); ++it) {
TRACE_EVENT1("sync", "ProcessCommitResponse",
"type", ModelTypeToString(it->first));
SyncerError type_result =
@@ -172,7 +171,7 @@ SyncerError Commit::PostAndProcessResponse(
}
void Commit::CleanUp() {
- for (ContributionMap::iterator it = contributions_.begin();
+ for (ContributionMap::const_iterator it = contributions_.begin();
it != contributions_.end(); ++it) {
it->second->CleanUp();
}
« no previous file with comments | « sync/engine/commit.h ('k') | sync/engine/commit_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698