| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Utility functions manipulating syncable::Entries, intended for use by the | 5 // Utility functions manipulating syncable::Entries, intended for use by the |
| 6 // syncer. | 6 // syncer. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ | 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ |
| 9 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ | 9 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ |
| 10 | 10 |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "build/build_config.h" |
| 15 #include "chrome/browser/sync/engine/syncer.h" | 16 #include "chrome/browser/sync/engine/syncer.h" |
| 16 #include "chrome/browser/sync/engine/syncer_types.h" | 17 #include "chrome/browser/sync/engine/syncer_types.h" |
| 17 #include "chrome/browser/sync/syncable/syncable.h" | 18 #include "chrome/browser/sync/syncable/syncable.h" |
| 18 #include "chrome/browser/sync/syncable/syncable_id.h" | 19 #include "chrome/browser/sync/syncable/syncable_id.h" |
| 19 #include "chrome/browser/sync/util/path_helpers.h" | 20 #include "chrome/browser/sync/util/path_helpers.h" |
| 20 #include "chrome/browser/sync/util/sync_types.h" | 21 #include "chrome/browser/sync/util/sync_types.h" |
| 21 | 22 |
| 22 namespace browser_sync { | 23 namespace browser_sync { |
| 23 | 24 |
| 24 class SyncerSession; | 25 class SyncerSession; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // if they match. For an up-to-date item, this should be the case. | 158 // if they match. For an up-to-date item, this should be the case. |
| 158 static bool ServerAndLocalOrdersMatch(syncable::Entry* entry); | 159 static bool ServerAndLocalOrdersMatch(syncable::Entry* entry); |
| 159 | 160 |
| 160 private: | 161 private: |
| 161 // Private ctor/dtor since this class shouldn't be instantiated. | 162 // Private ctor/dtor since this class shouldn't be instantiated. |
| 162 SyncerUtil() {} | 163 SyncerUtil() {} |
| 163 virtual ~SyncerUtil() {} | 164 virtual ~SyncerUtil() {} |
| 164 DISALLOW_COPY_AND_ASSIGN(SyncerUtil); | 165 DISALLOW_COPY_AND_ASSIGN(SyncerUtil); |
| 165 }; | 166 }; |
| 166 | 167 |
| 167 #ifndef OS_WINDOWS | 168 #ifndef OS_WIN |
| 168 | 169 |
| 169 // time.h on Linux and Mac both return seconds since the epoch, this should | 170 // time.h on Linux and Mac both return seconds since the epoch, this should |
| 170 // be converted to milliseconds. | 171 // be converted to milliseconds. |
| 171 inline int64 ServerTimeToClientTime(int64 server_time) { | 172 inline int64 ServerTimeToClientTime(int64 server_time) { |
| 172 return server_time / GG_LONGLONG(1000); | 173 return server_time / GG_LONGLONG(1000); |
| 173 } | 174 } |
| 174 | 175 |
| 175 inline int64 ClientTimeToServerTime(int64 client_time) { | 176 inline int64 ClientTimeToServerTime(int64 client_time) { |
| 176 return client_time * GG_LONGLONG(1000); | 177 return client_time * GG_LONGLONG(1000); |
| 177 } | 178 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 196 | 197 |
| 197 inline bool ClientAndServerTimeMatch(int64 client_time, int64 server_time) { | 198 inline bool ClientAndServerTimeMatch(int64 client_time, int64 server_time) { |
| 198 // Compare at the coarser timescale (server) | 199 // Compare at the coarser timescale (server) |
| 199 return ClientTimeToServerTime(client_time) == server_time; | 200 return ClientTimeToServerTime(client_time) == server_time; |
| 200 } | 201 } |
| 201 #endif | 202 #endif |
| 202 | 203 |
| 203 } // namespace browser_sync | 204 } // namespace browser_sync |
| 204 | 205 |
| 205 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ | 206 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ |
| OLD | NEW |