| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/sync/engine_impl/commit_util.h" | 5 #include "components/sync/engine_impl/commit_util.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/debug/dump_without_crashing.h" | 14 #include "base/debug/dump_without_crashing.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "components/sync/base/attachment_id_proto.h" | 16 #include "components/sync/base/attachment_id_proto.h" |
| 17 #include "components/sync/base/time.h" | 17 #include "components/sync/base/time.h" |
| 18 #include "components/sync/base/unique_position.h" | 18 #include "components/sync/base/unique_position.h" |
| 19 #include "components/sync/engine_impl/syncer_proto_util.h" | 19 #include "components/sync/engine_impl/syncer_proto_util.h" |
| 20 #include "components/sync/protocol/bookmark_specifics.pb.h" | 20 #include "components/sync/protocol/bookmark_specifics.pb.h" |
| 21 #include "components/sync/protocol/sync.pb.h" | 21 #include "components/sync/protocol/sync.pb.h" |
| 22 #include "components/sync/sessions_impl/sync_session.h" | |
| 23 #include "components/sync/syncable/directory.h" | 22 #include "components/sync/syncable/directory.h" |
| 24 #include "components/sync/syncable/entry.h" | 23 #include "components/sync/syncable/entry.h" |
| 25 #include "components/sync/syncable/model_neutral_mutable_entry.h" | 24 #include "components/sync/syncable/model_neutral_mutable_entry.h" |
| 26 #include "components/sync/syncable/syncable_base_transaction.h" | 25 #include "components/sync/syncable/syncable_base_transaction.h" |
| 27 #include "components/sync/syncable/syncable_base_write_transaction.h" | 26 #include "components/sync/syncable/syncable_base_write_transaction.h" |
| 28 #include "components/sync/syncable/syncable_changes_version.h" | 27 #include "components/sync/syncable/syncable_changes_version.h" |
| 29 #include "components/sync/syncable/syncable_proto_util.h" | 28 #include "components/sync/syncable/syncable_proto_util.h" |
| 30 #include "components/sync/syncable/syncable_util.h" | 29 #include "components/sync/syncable/syncable_util.h" |
| 31 | 30 |
| 32 using std::set; | 31 using std::set; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 44 ExtensionsActivity* activity, | 43 ExtensionsActivity* activity, |
| 45 ExtensionsActivity::Records* extensions_activity_buffer, | 44 ExtensionsActivity::Records* extensions_activity_buffer, |
| 46 sync_pb::CommitMessage* message) { | 45 sync_pb::CommitMessage* message) { |
| 47 // This isn't perfect, since the set of extensions activity may not correlate | 46 // This isn't perfect, since the set of extensions activity may not correlate |
| 48 // exactly with the items being committed. That's OK as long as we're looking | 47 // exactly with the items being committed. That's OK as long as we're looking |
| 49 // for a rough estimate of extensions activity, not an precise mapping of | 48 // for a rough estimate of extensions activity, not an precise mapping of |
| 50 // which commits were triggered by which extension. | 49 // which commits were triggered by which extension. |
| 51 // | 50 // |
| 52 // We will push this list of extensions activity back into the | 51 // We will push this list of extensions activity back into the |
| 53 // ExtensionsActivityMonitor if this commit fails. That's why we must keep a | 52 // ExtensionsActivityMonitor if this commit fails. That's why we must keep a |
| 54 // copy of these records in the session. | 53 // copy of these records in the cycle. |
| 55 activity->GetAndClearRecords(extensions_activity_buffer); | 54 activity->GetAndClearRecords(extensions_activity_buffer); |
| 56 | 55 |
| 57 const ExtensionsActivity::Records& records = *extensions_activity_buffer; | 56 const ExtensionsActivity::Records& records = *extensions_activity_buffer; |
| 58 for (ExtensionsActivity::Records::const_iterator it = records.begin(); | 57 for (ExtensionsActivity::Records::const_iterator it = records.begin(); |
| 59 it != records.end(); ++it) { | 58 it != records.end(); ++it) { |
| 60 sync_pb::ChromiumExtensionsActivity* activity_message = | 59 sync_pb::ChromiumExtensionsActivity* activity_message = |
| 61 message->add_extensions_activity(); | 60 message->add_extensions_activity(); |
| 62 activity_message->set_extension_id(it->second.extension_id); | 61 activity_message->set_extension_id(it->second.extension_id); |
| 63 activity_message->set_bookmark_writes_since_last_commit( | 62 activity_message->set_bookmark_writes_since_last_commit( |
| 64 it->second.bookmark_write_count); | 63 it->second.bookmark_write_count); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 451 |
| 453 ProcessSuccessfulCommitResponse(commit_request_entry, server_entry, | 452 ProcessSuccessfulCommitResponse(commit_request_entry, server_entry, |
| 454 local_entry.GetId(), &local_entry, | 453 local_entry.GetId(), &local_entry, |
| 455 dirty_sync_was_set, deleted_folders); | 454 dirty_sync_was_set, deleted_folders); |
| 456 return response; | 455 return response; |
| 457 } | 456 } |
| 458 | 457 |
| 459 } // namespace commit_util | 458 } // namespace commit_util |
| 460 | 459 |
| 461 } // namespace syncer | 460 } // namespace syncer |
| OLD | NEW |