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

Unified Diff: chrome/browser/sync/syncable/syncable.h

Issue 7977034: Revert 102184 - [Sync] use base::Time in sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/syncable/syncable.h
===================================================================
--- chrome/browser/sync/syncable/syncable.h (revision 102184)
+++ chrome/browser/sync/syncable/syncable.h (working copy)
@@ -34,7 +34,6 @@
#include "chrome/browser/sync/syncable/model_type.h"
#include "chrome/browser/sync/util/dbgq.h"
#include "chrome/browser/sync/util/immutable.h"
-#include "chrome/browser/sync/util/time.h"
struct PurgeInfo;
@@ -60,14 +59,8 @@
static const int64 kInvalidMetaHandle = 0;
-// Things you need to update if you change any of the fields below:
-// - EntryKernel struct in syncable.h (this file)
-// - syncable_columns.h
-// - syncable_enum_conversions{.h,.cc,_unittest.cc}
-// - EntryKernel::EntryKernel(), EntryKernel::ToValue(), operator<<
-// for Entry in syncable.cc
-// - BindFields() and UnpackEntry() in directory_backing_store.cc
-// - TestSimpleFieldsPreservedDuringSaveChanges in syncable_unittest.cc
+// Update syncable_enum_conversions{.h,.cc,_unittest.cc} if you change
+// any fields in this file.
enum {
BEGIN_FIELDS = 0,
@@ -88,6 +81,10 @@
enum Int64Field {
SERVER_VERSION = BASE_VERSION + 1,
+ MTIME,
+ SERVER_MTIME,
+ CTIME,
+ SERVER_CTIME,
// A numeric position value that indicates the relative ordering of
// this object among its siblings.
@@ -100,23 +97,10 @@
};
enum {
- INT64_FIELDS_COUNT = INT64_FIELDS_END - INT64_FIELDS_BEGIN,
- TIME_FIELDS_BEGIN = INT64_FIELDS_END,
+ INT64_FIELDS_COUNT = INT64_FIELDS_END,
+ ID_FIELDS_BEGIN = INT64_FIELDS_END,
};
-enum TimeField {
- MTIME = TIME_FIELDS_BEGIN,
- SERVER_MTIME,
- CTIME,
- SERVER_CTIME,
- TIME_FIELDS_END,
-};
-
-enum {
- TIME_FIELDS_COUNT = TIME_FIELDS_END - TIME_FIELDS_BEGIN,
- ID_FIELDS_BEGIN = TIME_FIELDS_END,
-};
-
enum IdField {
// Code in InitializeTables relies on ID being the first IdField value.
ID = ID_FIELDS_BEGIN,
@@ -253,7 +237,6 @@
std::string string_fields[STRING_FIELDS_COUNT];
sync_pb::EntitySpecifics specifics_fields[PROTO_FIELDS_COUNT];
int64 int64_fields[INT64_FIELDS_COUNT];
- base::Time time_fields[TIME_FIELDS_COUNT];
Id id_fields[ID_FIELDS_COUNT];
std::bitset<BIT_FIELDS_COUNT> bit_fields;
std::bitset<BIT_TEMPS_COUNT> bit_temps;
@@ -295,13 +278,6 @@
inline void put(Int64Field field, int64 value) {
int64_fields[field - INT64_FIELDS_BEGIN] = value;
}
- inline void put(TimeField field, const base::Time& value) {
- // Round-trip to proto time format and back so that we have
- // consistent time resolutions (ms).
- time_fields[field - TIME_FIELDS_BEGIN] =
- browser_sync::ProtoTimeToTime(
- browser_sync::TimeToProtoTime(value));
- }
inline void put(IdField field, const Id& value) {
id_fields[field - ID_FIELDS_BEGIN] = value;
}
@@ -334,9 +310,6 @@
inline int64 ref(Int64Field field) const {
return int64_fields[field - INT64_FIELDS_BEGIN];
}
- inline const base::Time& ref(TimeField field) const {
- return time_fields[field - TIME_FIELDS_BEGIN];
- }
inline const Id& ref(IdField field) const {
return id_fields[field - ID_FIELDS_BEGIN];
}
@@ -416,10 +389,6 @@
DCHECK(kernel_);
return kernel_->ref(field);
}
- inline const base::Time& Get(TimeField field) const {
- DCHECK(kernel_);
- return kernel_->ref(field);
- }
inline int64 Get(BaseVersion field) const {
DCHECK(kernel_);
return kernel_->ref(field);
@@ -521,7 +490,6 @@
// that putting the value would have caused a duplicate in the index.
// TODO(chron): Remove some of these unecessary return values.
bool Put(Int64Field field, const int64& value);
- bool Put(TimeField field, const base::Time& value);
bool Put(IdField field, const Id& value);
// Do a simple property-only update if the PARENT_ID field. Use with caution.
@@ -1245,9 +1213,15 @@
bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid);
+int64 Now();
+
// This function sets only the flags needed to get this entry to sync.
void MarkForSyncing(syncable::MutableEntry* e);
+// This is not a reset. It just sets the numeric fields which are not
+// initialized by the constructor to zero.
+void ZeroFields(EntryKernel* entry, int first_field);
+
} // namespace syncable
std::ostream& operator <<(std::ostream&, const syncable::Blob&);
« no previous file with comments | « chrome/browser/sync/syncable/directory_backing_store_unittest.cc ('k') | chrome/browser/sync/syncable/syncable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698