| 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 <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/debug/dump_without_crashing.h" | |
| 12 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 13 #include "components/sync/base/attachment_id_proto.h" | 12 #include "components/sync/base/attachment_id_proto.h" |
| 14 #include "components/sync/base/time.h" | 13 #include "components/sync/base/time.h" |
| 15 #include "components/sync/base/unique_position.h" | 14 #include "components/sync/base/unique_position.h" |
| 16 #include "components/sync/engine_impl/syncer_proto_util.h" | 15 #include "components/sync/engine_impl/syncer_proto_util.h" |
| 17 #include "components/sync/protocol/bookmark_specifics.pb.h" | 16 #include "components/sync/protocol/bookmark_specifics.pb.h" |
| 18 #include "components/sync/syncable/directory.h" | 17 #include "components/sync/syncable/directory.h" |
| 19 #include "components/sync/syncable/entry.h" | 18 #include "components/sync/syncable/entry.h" |
| 20 #include "components/sync/syncable/model_neutral_mutable_entry.h" | 19 #include "components/sync/syncable/model_neutral_mutable_entry.h" |
| 21 #include "components/sync/syncable/syncable_base_transaction.h" | 20 #include "components/sync/syncable/syncable_base_transaction.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // Both insert_after_item_id and position_in_parent fields are set only | 169 // Both insert_after_item_id and position_in_parent fields are set only |
| 171 // for legacy reasons. See comments in sync.proto for more information. | 170 // for legacy reasons. See comments in sync.proto for more information. |
| 172 const Id& prev_id = meta_entry.GetPredecessorId(); | 171 const Id& prev_id = meta_entry.GetPredecessorId(); |
| 173 string prev_id_string = | 172 string prev_id_string = |
| 174 prev_id.IsNull() ? string() : prev_id.GetServerId(); | 173 prev_id.IsNull() ? string() : prev_id.GetServerId(); |
| 175 sync_entry->set_insert_after_item_id(prev_id_string); | 174 sync_entry->set_insert_after_item_id(prev_id_string); |
| 176 sync_entry->set_position_in_parent( | 175 sync_entry->set_position_in_parent( |
| 177 meta_entry.GetUniquePosition().ToInt64()); | 176 meta_entry.GetUniquePosition().ToInt64()); |
| 178 meta_entry.GetUniquePosition().ToProto( | 177 meta_entry.GetUniquePosition().ToProto( |
| 179 sync_entry->mutable_unique_position()); | 178 sync_entry->mutable_unique_position()); |
| 180 if (!meta_entry.GetUniquePosition().IsValid()) { | |
| 181 // Should never upload invalid unique position for bookmark to server. | |
| 182 base::debug::DumpWithoutCrashing(); | |
| 183 } | |
| 184 } | 179 } |
| 185 // Always send specifics for bookmarks. | 180 // Always send specifics for bookmarks. |
| 186 SetEntrySpecifics(meta_entry, sync_entry); | 181 SetEntrySpecifics(meta_entry, sync_entry); |
| 187 return; | 182 return; |
| 188 } | 183 } |
| 189 | 184 |
| 190 // Deletion is final on the server, let's move things and then delete them. | 185 // Deletion is final on the server, let's move things and then delete them. |
| 191 if (meta_entry.GetIsDel()) { | 186 if (meta_entry.GetIsDel()) { |
| 192 sync_entry->set_deleted(true); | 187 sync_entry->set_deleted(true); |
| 193 | 188 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 441 |
| 447 ProcessSuccessfulCommitResponse(commit_request_entry, server_entry, | 442 ProcessSuccessfulCommitResponse(commit_request_entry, server_entry, |
| 448 local_entry.GetId(), &local_entry, | 443 local_entry.GetId(), &local_entry, |
| 449 dirty_sync_was_set, deleted_folders); | 444 dirty_sync_was_set, deleted_folders); |
| 450 return response; | 445 return response; |
| 451 } | 446 } |
| 452 | 447 |
| 453 } // namespace commit_util | 448 } // namespace commit_util |
| 454 | 449 |
| 455 } // namespace syncer | 450 } // namespace syncer |
| OLD | NEW |