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

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

Issue 10389103: Sync: Clear IS_UNSYNCED for deleted local items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix check_deps issue by moving ChangeEntryIDAndUpdateChildren Created 8 years, 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // 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 SYNC_ENGINE_SYNCER_UTIL_H_ 8 #ifndef SYNC_ENGINE_SYNCER_UTIL_H_
9 #define SYNC_ENGINE_SYNCER_UTIL_H_ 9 #define SYNC_ENGINE_SYNCER_UTIL_H_
10 #pragma once 10 #pragma once
11 11
12 #include <set> 12 #include <set>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "sync/engine/syncer.h" 16 #include "sync/engine/syncer.h"
17 #include "sync/engine/syncer_types.h" 17 #include "sync/engine/syncer_types.h"
18 #include "sync/syncable/syncable.h" 18 #include "sync/syncable/syncable.h"
19 #include "sync/syncable/syncable_id.h" 19 #include "sync/syncable/syncable_id.h"
20 20
21 namespace browser_sync { 21 namespace browser_sync {
22 22
23 class Cryptographer; 23 class Cryptographer;
24 class SyncEntity; 24 class SyncEntity;
25 25
26 class SyncerUtil { 26 class SyncerUtil {
27 public: 27 public:
28 static void ChangeEntryIDAndUpdateChildren(
29 syncable::WriteTransaction* trans,
30 syncable::MutableEntry* entry,
31 const syncable::Id& new_id,
32 syncable::Directory::ChildHandles* children);
33
34 // Returns the number of unsynced entries. 28 // Returns the number of unsynced entries.
35 static int GetUnsyncedEntries(syncable::BaseTransaction* trans, 29 static int GetUnsyncedEntries(syncable::BaseTransaction* trans,
36 std::vector<int64> *handles); 30 std::vector<int64> *handles);
37 31
38 static void ChangeEntryIDAndUpdateChildren(syncable::WriteTransaction* trans,
39 syncable::MutableEntry* entry,
40 const syncable::Id& new_id);
41
42 // If the server sent down a client-tagged entry, or an entry whose 32 // If the server sent down a client-tagged entry, or an entry whose
43 // commit response was lost, it is necessary to update a local entry 33 // commit response was lost, it is necessary to update a local entry
44 // with an ID that doesn't match the ID of the update. Here, we 34 // with an ID that doesn't match the ID of the update. Here, we
45 // find the ID of such an entry, if it exists. This function may 35 // find the ID of such an entry, if it exists. This function may
46 // determine that |server_entry| should be dropped; if so, it returns 36 // determine that |server_entry| should be dropped; if so, it returns
47 // the null ID -- callers must handle this case. When update application 37 // the null ID -- callers must handle this case. When update application
48 // should proceed normally with a new local entry, this function will 38 // should proceed normally with a new local entry, this function will
49 // return server_entry.id(); the caller must create an entry with that 39 // return server_entry.id(); the caller must create an entry with that
50 // ID. This function does not alter the database. 40 // ID. This function does not alter the database.
51 static syncable::Id FindLocalIdToUpdate( 41 static syncable::Id FindLocalIdToUpdate(
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 syncable::Directory* dir, 118 syncable::Directory* dir,
129 std::set<syncable::Id>* deleted_folders); 119 std::set<syncable::Id>* deleted_folders);
130 120
131 private: 121 private:
132 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncerUtil); 122 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncerUtil);
133 }; 123 };
134 124
135 } // namespace browser_sync 125 } // namespace browser_sync
136 126
137 #endif // SYNC_ENGINE_SYNCER_UTIL_H_ 127 #endif // SYNC_ENGINE_SYNCER_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698