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

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

Issue 18286004: Move PathExists to 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
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/session_storage_database.h" 5 #include "webkit/browser/dom_storage/session_storage_database.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 bool SessionStorageDatabase::LazyOpen(bool create_if_needed) { 272 bool SessionStorageDatabase::LazyOpen(bool create_if_needed) {
273 base::AutoLock auto_lock(db_lock_); 273 base::AutoLock auto_lock(db_lock_);
274 if (db_error_ || is_inconsistent_) { 274 if (db_error_ || is_inconsistent_) {
275 // Don't try to open a database that we know has failed already. 275 // Don't try to open a database that we know has failed already.
276 return false; 276 return false;
277 } 277 }
278 if (IsOpen()) 278 if (IsOpen())
279 return true; 279 return true;
280 280
281 if (!create_if_needed && 281 if (!create_if_needed &&
282 (!file_util::PathExists(file_path_) || 282 (!base::PathExists(file_path_) ||
283 file_util::IsDirectoryEmpty(file_path_))) { 283 file_util::IsDirectoryEmpty(file_path_))) {
284 // If the directory doesn't exist already and we haven't been asked to 284 // If the directory doesn't exist already and we haven't been asked to
285 // create a file on disk, then we don't bother opening the database. This 285 // create a file on disk, then we don't bother opening the database. This
286 // means we wait until we absolutely need to put something onto disk before 286 // means we wait until we absolutely need to put something onto disk before
287 // we do so. 287 // we do so.
288 return false; 288 return false;
289 } 289 }
290 290
291 leveldb::DB* db; 291 leveldb::DB* db;
292 leveldb::Status s = TryToOpen(&db); 292 leveldb::Status s = TryToOpen(&db);
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 std::string SessionStorageDatabase::MapKey(const std::string& map_id, 667 std::string SessionStorageDatabase::MapKey(const std::string& map_id,
668 const std::string& key) { 668 const std::string& key) {
669 return base::StringPrintf("map-%s-%s", map_id.c_str(), key.c_str()); 669 return base::StringPrintf("map-%s-%s", map_id.c_str(), key.c_str());
670 } 670 }
671 671
672 const char* SessionStorageDatabase::NextMapIdKey() { 672 const char* SessionStorageDatabase::NextMapIdKey() {
673 return "next-map-id"; 673 return "next-map-id";
674 } 674 }
675 675
676 } // namespace dom_storage 676 } // namespace dom_storage
OLDNEW
« no previous file with comments | « webkit/browser/dom_storage/dom_storage_database_unittest.cc ('k') | webkit/browser/fileapi/file_system_usage_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698