summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormeelapshah@chromium.org <meelapshah@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 20:15:49 +0000
committermeelapshah@chromium.org <meelapshah@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-14 20:15:49 +0000
commit2e066b3eed13cc1dc502a1f9cc7c1ac3891b0bdc (patch)
tree53bb33229e2ff88fa112504febf5efaff94d667c
parent71209500be9de1ac73329d4694b4508db31561ce (diff)
downloadchromium_src-2e066b3eed13cc1dc502a1f9cc7c1ac3891b0bdc.zip
chromium_src-2e066b3eed13cc1dc502a1f9cc7c1ac3891b0bdc.tar.gz
chromium_src-2e066b3eed13cc1dc502a1f9cc7c1ac3891b0bdc.tar.bz2
Transactionalize ThumbnailStore db operations.
Review URL: http://codereview.chromium.org/149582 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20644 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/thumbnail_store.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/chrome/browser/thumbnail_store.cc b/chrome/browser/thumbnail_store.cc
index 315f12f..9ad570e 100644
--- a/chrome/browser/thumbnail_store.cc
+++ b/chrome/browser/thumbnail_store.cc
@@ -178,6 +178,9 @@ void ThumbnailStore::CommitCacheToDB(
if (!db_)
return;
+ int rv = sqlite3_exec(db_, "BEGIN TRANSACTION", NULL, NULL, NULL);
+ DCHECK(rv == SQLITE_OK) << "Failed to begin transaction";
+
// Delete old thumbnails.
if (stale_urls.get()) {
for (std::vector<GURL>::iterator it = stale_urls->data.begin();
@@ -212,6 +215,9 @@ void ThumbnailStore::CommitCacheToDB(
else
it->second.dirty_ = false;
}
+
+ rv = sqlite3_exec(db_, "COMMIT", NULL, NULL, NULL);
+ DCHECK(rv == SQLITE_OK) << "Failed to commit transaction";
}
void ThumbnailStore::InitializeFromDB(const FilePath& db_name,