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

Side by Side Diff: sync/engine/syncer_util.cc

Issue 1545553003: Switch to standard integer types in sync/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 unified diff | Download patch
« no previous file with comments | « sync/engine/syncer_util.h ('k') | sync/engine/syncer_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/syncer_util.h" 5 #include "sync/engine/syncer_util.h"
6 6
7 #include <stdint.h>
8
7 #include <algorithm> 9 #include <algorithm>
8 #include <set> 10 #include <set>
9 #include <string> 11 #include <string>
10 #include <vector> 12 #include <vector>
11 13
12 #include "base/base64.h" 14 #include "base/base64.h"
13 #include "base/location.h" 15 #include "base/location.h"
14 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
15 #include "base/rand_util.h" 17 #include "base/rand_util.h"
16 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // server side ones to avoid multiple copies of the same thing. 133 // server side ones to avoid multiple copies of the same thing.
132 134
133 syncable::Id client_item_id = syncable::Id::CreateFromClientString( 135 syncable::Id client_item_id = syncable::Id::CreateFromClientString(
134 update.originator_client_item_id()); 136 update.originator_client_item_id());
135 DCHECK(!client_item_id.ServerKnows()); 137 DCHECK(!client_item_id.ServerKnows());
136 syncable::Entry local_entry(trans, GET_BY_ID, client_item_id); 138 syncable::Entry local_entry(trans, GET_BY_ID, client_item_id);
137 139
138 // If it exists, then our local client lost a commit response. Use 140 // If it exists, then our local client lost a commit response. Use
139 // the local entry. 141 // the local entry.
140 if (local_entry.good() && !local_entry.GetIsDel()) { 142 if (local_entry.good() && !local_entry.GetIsDel()) {
141 int64 old_version = local_entry.GetBaseVersion(); 143 int64_t old_version = local_entry.GetBaseVersion();
142 int64 new_version = update.version(); 144 int64_t new_version = update.version();
143 DCHECK_LE(old_version, 0); 145 DCHECK_LE(old_version, 0);
144 DCHECK_GT(new_version, 0); 146 DCHECK_GT(new_version, 0);
145 // Otherwise setting the base version could cause a consistency failure. 147 // Otherwise setting the base version could cause a consistency failure.
146 // An entry should never be version 0 and SYNCED. 148 // An entry should never be version 0 and SYNCED.
147 DCHECK(local_entry.GetIsUnsynced()); 149 DCHECK(local_entry.GetIsUnsynced());
148 150
149 // Just a quick sanity check. 151 // Just a quick sanity check.
150 DCHECK(!local_entry.GetId().ServerKnows()); 152 DCHECK(!local_entry.GetId().ServerKnows());
151 153
152 DVLOG(1) << "Reuniting lost commit response IDs. server id: " 154 DVLOG(1) << "Reuniting lost commit response IDs. server id: "
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 if (update.version() < target->GetServerVersion()) { 658 if (update.version() < target->GetServerVersion()) {
657 LOG(WARNING) << "Update older than current server version for " 659 LOG(WARNING) << "Update older than current server version for "
658 << *target << " Update:" 660 << *target << " Update:"
659 << SyncerProtoUtil::SyncEntityDebugString(update); 661 << SyncerProtoUtil::SyncEntityDebugString(update);
660 return VERIFY_SUCCESS; // Expected in new sync protocol. 662 return VERIFY_SUCCESS; // Expected in new sync protocol.
661 } 663 }
662 return VERIFY_UNDECIDED; 664 return VERIFY_UNDECIDED;
663 } 665 }
664 666
665 } // namespace syncer 667 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer_util.h ('k') | sync/engine/syncer_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698