| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "sync/engine/commit.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 DCHECK(cleaned_up_); | 32 DCHECK(cleaned_up_); |
| 33 } | 33 } |
| 34 | 34 |
| 35 Commit* Commit::Init( | 35 Commit* Commit::Init( |
| 36 ModelTypeSet requested_types, | 36 ModelTypeSet requested_types, |
| 37 ModelTypeSet enabled_types, | 37 ModelTypeSet enabled_types, |
| 38 size_t max_entries, | 38 size_t max_entries, |
| 39 const std::string& account_name, | 39 const std::string& account_name, |
| 40 const std::string& cache_guid, | 40 const std::string& cache_guid, |
| 41 bool cookie_jar_mismatch, | 41 bool cookie_jar_mismatch, |
| 42 bool cookie_jar_empty, |
| 42 CommitProcessor* commit_processor, | 43 CommitProcessor* commit_processor, |
| 43 ExtensionsActivity* extensions_activity) { | 44 ExtensionsActivity* extensions_activity) { |
| 44 // Gather per-type contributions. | 45 // Gather per-type contributions. |
| 45 ContributionMap contributions; | 46 ContributionMap contributions; |
| 46 commit_processor->GatherCommitContributions( | 47 commit_processor->GatherCommitContributions( |
| 47 requested_types, | 48 requested_types, |
| 48 max_entries, | 49 max_entries, |
| 50 cookie_jar_mismatch, |
| 51 cookie_jar_empty, |
| 49 &contributions); | 52 &contributions); |
| 50 | 53 |
| 51 // Give up if no one had anything to commit. | 54 // Give up if no one had anything to commit. |
| 52 if (contributions.empty()) | 55 if (contributions.empty()) |
| 53 return NULL; | 56 return NULL; |
| 54 | 57 |
| 55 sync_pb::ClientToServerMessage message; | 58 sync_pb::ClientToServerMessage message; |
| 56 message.set_message_contents(sync_pb::ClientToServerMessage::COMMIT); | 59 message.set_message_contents(sync_pb::ClientToServerMessage::COMMIT); |
| 57 message.set_share(account_name); | 60 message.set_share(account_name); |
| 58 | 61 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 189 |
| 187 void Commit::CleanUp() { | 190 void Commit::CleanUp() { |
| 188 for (ContributionMap::const_iterator it = contributions_.begin(); | 191 for (ContributionMap::const_iterator it = contributions_.begin(); |
| 189 it != contributions_.end(); ++it) { | 192 it != contributions_.end(); ++it) { |
| 190 it->second->CleanUp(); | 193 it->second->CleanUp(); |
| 191 } | 194 } |
| 192 cleaned_up_ = true; | 195 cleaned_up_ = true; |
| 193 } | 196 } |
| 194 | 197 |
| 195 } // namespace syncer | 198 } // namespace syncer |
| OLD | NEW |