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

Side by Side Diff: webkit/browser/dom_storage/dom_storage_database.cc

Issue 19052005: Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
« no previous file with comments | « webkit/browser/database/database_tracker.cc ('k') | webkit/browser/fileapi/dump_file_system.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "webkit/browser/dom_storage/dom_storage_database.h" 5 #include "webkit/browser/dom_storage/dom_storage_database.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "sql/statement.h" 10 #include "sql/statement.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 DCHECK(!IsOpen()); 259 DCHECK(!IsOpen());
260 DCHECK(base::PathExists(file_path_)); 260 DCHECK(base::PathExists(file_path_));
261 261
262 // We should only try and do this once. 262 // We should only try and do this once.
263 if (tried_to_recreate_) 263 if (tried_to_recreate_)
264 return false; 264 return false;
265 265
266 tried_to_recreate_ = true; 266 tried_to_recreate_ = true;
267 267
268 // If it's not a directory and we can delete the file, try and open it again. 268 // If it's not a directory and we can delete the file, try and open it again.
269 if (!file_util::DirectoryExists(file_path_) && 269 if (!base::DirectoryExists(file_path_) &&
270 sql::Connection::Delete(file_path_)) { 270 sql::Connection::Delete(file_path_)) {
271 return LazyOpen(true); 271 return LazyOpen(true);
272 } 272 }
273 273
274 failed_to_open_ = true; 274 failed_to_open_ = true;
275 return false; 275 return false;
276 } 276 }
277 277
278 bool DomStorageDatabase::UpgradeVersion1To2() { 278 bool DomStorageDatabase::UpgradeVersion1To2() {
279 DCHECK(IsOpen()); 279 DCHECK(IsOpen());
(...skipping 19 matching lines...) Expand all
299 CreateTableV2() && 299 CreateTableV2() &&
300 CommitChanges(false, values) && 300 CommitChanges(false, values) &&
301 migration.Commit(); 301 migration.Commit();
302 } 302 }
303 303
304 void DomStorageDatabase::Close() { 304 void DomStorageDatabase::Close() {
305 db_.reset(NULL); 305 db_.reset(NULL);
306 } 306 }
307 307
308 } // namespace dom_storage 308 } // namespace dom_storage
OLDNEW
« no previous file with comments | « webkit/browser/database/database_tracker.cc ('k') | webkit/browser/fileapi/dump_file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698