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

Side by Side Diff: chrome/browser/sync/syncable/syncable.cc

Issue 593094: Add unique hashing to sync API. (Closed)
Patch Set: New unit test, review fixes. Created 10 years, 10 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/sync/syncable/syncable.h" 5 #include "chrome/browser/sync/syncable/syncable.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #if defined(OS_POSIX) 10 #if defined(OS_POSIX)
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 if (Get(SPECIFICS).HasExtension(sync_pb::preference)) 1068 if (Get(SPECIFICS).HasExtension(sync_pb::preference))
1069 return PREFERENCES; 1069 return PREFERENCES;
1070 if (Get(SPECIFICS).HasExtension(sync_pb::autofill)) 1070 if (Get(SPECIFICS).HasExtension(sync_pb::autofill))
1071 return AUTOFILL; 1071 return AUTOFILL;
1072 if (IsRoot()) 1072 if (IsRoot())
1073 return TOP_LEVEL_FOLDER; 1073 return TOP_LEVEL_FOLDER;
1074 // Loose check for server-created top-level folders that aren't 1074 // Loose check for server-created top-level folders that aren't
1075 // bound to a particular model type. 1075 // bound to a particular model type.
1076 if (!Get(UNIQUE_SERVER_TAG).empty() && Get(IS_DIR)) 1076 if (!Get(UNIQUE_SERVER_TAG).empty() && Get(IS_DIR))
1077 return TOP_LEVEL_FOLDER; 1077 return TOP_LEVEL_FOLDER;
1078 1078
ncarter (slow) 2010/02/18 01:05:40 It's probably okay for these DCHECKs to die -- but
chron 2010/02/18 01:09:32 These dchecks weren't really valid since we call G
1079 // Otherwise, we don't have a local type yet. That should only happen
1080 // if the item doesn't exist locally -- like if it's a new update item.
1081 // It's possible we'll need to relax these checks in the future; they're
1082 // just here for now as a safety measure.
1083 DCHECK(Get(ID).ServerKnows());
1084 DCHECK(Get(IS_UNAPPLIED_UPDATE));
1085 DCHECK(!Get(IS_UNSYNCED));
1086 DCHECK(Get(BASE_VERSION) == CHANGES_VERSION);
1087 DCHECK(Get(IS_DEL));
1088 return UNSPECIFIED; 1079 return UNSPECIFIED;
1089 } 1080 }
1090 1081
1091 /////////////////////////////////////////////////////////////////////////// 1082 ///////////////////////////////////////////////////////////////////////////
1092 // MutableEntry 1083 // MutableEntry
1093 1084
1094 MutableEntry::MutableEntry(WriteTransaction* trans, Create, 1085 MutableEntry::MutableEntry(WriteTransaction* trans, Create,
1095 const Id& parent_id, const string& name) 1086 const Id& parent_id, const string& name)
1096 : Entry(trans), 1087 : Entry(trans),
1097 write_transaction_(trans) { 1088 write_transaction_(trans) {
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 return s << std::dec; 1549 return s << std::dec;
1559 } 1550 }
1560 1551
1561 FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) { 1552 FastDump& operator<<(FastDump& dump, const syncable::Blob& blob) {
1562 if (blob.empty()) 1553 if (blob.empty())
1563 return dump; 1554 return dump;
1564 string buffer(HexEncode(&blob[0], blob.size())); 1555 string buffer(HexEncode(&blob[0], blob.size()));
1565 dump.out_->sputn(buffer.c_str(), buffer.size()); 1556 dump.out_->sputn(buffer.c_str(), buffer.size());
1566 return dump; 1557 return dump;
1567 } 1558 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698