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

Unified Diff: chrome/browser/sync/syncable/directory_backing_store.cc

Issue 2865022: sync: add CleanupDisabledTypesCommand to purge data pertaining to previously... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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/directory_backing_store.cc
===================================================================
--- chrome/browser/sync/syncable/directory_backing_store.cc (revision 51231)
+++ chrome/browser/sync/syncable/directory_backing_store.cc (working copy)
@@ -250,6 +250,33 @@
load_dbhandle_ = NULL; // No longer used.
}
+void DirectoryBackingStore::EndSave() {
+ sqlite3_close(save_dbhandle_);
+ save_dbhandle_ = NULL;
+}
+
+bool DirectoryBackingStore::DeleteEntries(const MetahandleSet& handles) {
+ if (handles.empty())
+ return true;
+
+ sqlite3* dbhandle = LazyGetSaveHandle();
+
+ string query = "DELETE FROM metas WHERE metahandle IN (";
+ for (MetahandleSet::const_iterator it = handles.begin(); it != handles.end();
+ ++it) {
+ if (it != handles.begin())
+ query.append(",");
+ query.append(Int64ToString(*it));
+ }
+ query.append(")");
+ SQLStatement statement;
+ int result = statement.prepare(dbhandle, query.data(), query.size());
+ if (SQLITE_OK == result)
+ result = statement.step();
+
+ return SQLITE_DONE == result;
+}
+
bool DirectoryBackingStore::SaveChanges(
const Directory::SaveChangesSnapshot& snapshot) {
sqlite3* dbhandle = LazyGetSaveHandle();
@@ -273,6 +300,9 @@
return false;
}
+ if (!DeleteEntries(snapshot.metahandles_to_purge))
+ return false;
+
if (save_info) {
const Directory::PersistedKernelInfo& info = snapshot.kernel_info;
SQLStatement update;

Powered by Google App Engine
This is Rietveld 408576698