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 14 matching lines...) Expand all Loading... |
25 ExtensionsActivity::Records extensions_activity_buffer) | 25 ExtensionsActivity::Records extensions_activity_buffer) |
26 : contributions_(std::move(contributions)), | 26 : contributions_(std::move(contributions)), |
27 message_(message), | 27 message_(message), |
28 extensions_activity_buffer_(extensions_activity_buffer), | 28 extensions_activity_buffer_(extensions_activity_buffer), |
29 cleaned_up_(false) {} | 29 cleaned_up_(false) {} |
30 | 30 |
31 Commit::~Commit() { | 31 Commit::~Commit() { |
32 DCHECK(cleaned_up_); | 32 DCHECK(cleaned_up_); |
33 } | 33 } |
34 | 34 |
35 Commit* Commit::Init( | 35 Commit* Commit::Init(ModelTypeSet requested_types, |
36 ModelTypeSet requested_types, | 36 ModelTypeSet enabled_types, |
37 ModelTypeSet enabled_types, | 37 size_t max_entries, |
38 size_t max_entries, | 38 const std::string& account_name, |
39 const std::string& account_name, | 39 const std::string& cache_guid, |
40 const std::string& cache_guid, | 40 bool cookie_jar_mismatch, |
41 bool cookie_jar_mismatch, | 41 bool cookie_jar_empty, |
42 CommitProcessor* commit_processor, | 42 CommitProcessor* commit_processor, |
43 ExtensionsActivity* extensions_activity) { | 43 ExtensionsActivity* extensions_activity) { |
44 // Gather per-type contributions. | 44 // Gather per-type contributions. |
45 ContributionMap contributions; | 45 ContributionMap contributions; |
46 commit_processor->GatherCommitContributions( | 46 commit_processor->GatherCommitContributions(requested_types, max_entries, |
47 requested_types, | 47 cookie_jar_mismatch, |
48 max_entries, | 48 cookie_jar_empty, &contributions); |
49 &contributions); | |
50 | 49 |
51 // Give up if no one had anything to commit. | 50 // Give up if no one had anything to commit. |
52 if (contributions.empty()) | 51 if (contributions.empty()) |
53 return NULL; | 52 return NULL; |
54 | 53 |
55 sync_pb::ClientToServerMessage message; | 54 sync_pb::ClientToServerMessage message; |
56 message.set_message_contents(sync_pb::ClientToServerMessage::COMMIT); | 55 message.set_message_contents(sync_pb::ClientToServerMessage::COMMIT); |
57 message.set_share(account_name); | 56 message.set_share(account_name); |
58 | 57 |
59 sync_pb::CommitMessage* commit_message = message.mutable_commit(); | 58 sync_pb::CommitMessage* commit_message = message.mutable_commit(); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 185 |
187 void Commit::CleanUp() { | 186 void Commit::CleanUp() { |
188 for (ContributionMap::const_iterator it = contributions_.begin(); | 187 for (ContributionMap::const_iterator it = contributions_.begin(); |
189 it != contributions_.end(); ++it) { | 188 it != contributions_.end(); ++it) { |
190 it->second->CleanUp(); | 189 it->second->CleanUp(); |
191 } | 190 } |
192 cleaned_up_ = true; | 191 cleaned_up_ = true; |
193 } | 192 } |
194 | 193 |
195 } // namespace syncer | 194 } // namespace syncer |
OLD | NEW |