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

Side by Side Diff: chrome/browser/sync/engine/syncer_util.h

Issue 6588119: First-time sync: asymptotic running time improvement (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/Release
Patch Set: Fix unit_tests Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
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 #pragma once 10 #pragma once
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const bool deleted, 94 const bool deleted,
95 const bool is_directory, 95 const bool is_directory,
96 syncable::ModelType model_type); 96 syncable::ModelType model_type);
97 97
98 // Assumes we have an existing entry; verify an update that seems to be 98 // Assumes we have an existing entry; verify an update that seems to be
99 // expressing an 'undelete' 99 // expressing an 'undelete'
100 static VerifyResult VerifyUndelete(syncable::WriteTransaction* trans, 100 static VerifyResult VerifyUndelete(syncable::WriteTransaction* trans,
101 const SyncEntity& update, 101 const SyncEntity& update,
102 syncable::MutableEntry* target); 102 syncable::MutableEntry* target);
103 103
104 // Compute a local predecessor position for |update_item|. The position
105 // is determined by the SERVER_POSITION_IN_PARENT value of |update_item|,
106 // as well as the SERVER_POSITION_IN_PARENT values of any up-to-date
107 // children of |parent_id|.
108 static syncable::Id ComputePrevIdFromServerPosition(
109 syncable::BaseTransaction* trans,
110 syncable::Entry* update_item,
111 const syncable::Id& parent_id);
112
113 // Append |item|, followed by a chain of its predecessors selected by 104 // Append |item|, followed by a chain of its predecessors selected by
114 // |inclusion_filter|, to the |commit_ids| vector and tag them as included by 105 // |inclusion_filter|, to the |commit_ids| vector and tag them as included by
115 // storing in the set |inserted_items|. |inclusion_filter| (typically one of 106 // storing in the set |inserted_items|. |inclusion_filter| (typically one of
116 // IS_UNAPPLIED_UPDATE or IS_UNSYNCED) selects which type of predecessors to 107 // IS_UNAPPLIED_UPDATE or IS_UNSYNCED) selects which type of predecessors to
117 // include. Returns true if |item| was added, and false if it was already in 108 // include. Returns true if |item| was added, and false if it was already in
118 // the list. 109 // the list.
119 // 110 //
120 // Use AddPredecessorsThenItem instead of this method if you want the 111 // Use AddPredecessorsThenItem instead of this method if you want the
121 // item to be the last, rather than first, item appended. 112 // item to be the last, rather than first, item appended.
122 static bool AddItemThenPredecessors( 113 static bool AddItemThenPredecessors(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 179
189 inline bool ClientAndServerTimeMatch(int64 client_time, int64 server_time) { 180 inline bool ClientAndServerTimeMatch(int64 client_time, int64 server_time) {
190 // Compare at the coarser timescale (server) 181 // Compare at the coarser timescale (server)
191 return ClientTimeToServerTime(client_time) == server_time; 182 return ClientTimeToServerTime(client_time) == server_time;
192 } 183 }
193 #endif 184 #endif
194 185
195 } // namespace browser_sync 186 } // namespace browser_sync
196 187
197 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ 188 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698