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

Side by Side Diff: chrome/browser/value_store/leveldb_value_store.cc

Issue 16950028: Move file_util::Delete 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
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 "chrome/browser/value_store/leveldb_value_store.h" 5 #include "chrome/browser/value_store/leveldb_value_store.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 LeveldbValueStore::~LeveldbValueStore() { 88 LeveldbValueStore::~LeveldbValueStore() {
89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
90 90
91 // Delete the database from disk if it's empty (but only if we managed to 91 // Delete the database from disk if it's empty (but only if we managed to
92 // open it!). This is safe on destruction, assuming that we have exclusive 92 // open it!). This is safe on destruction, assuming that we have exclusive
93 // access to the database. 93 // access to the database.
94 if (db_ && IsEmpty()) { 94 if (db_ && IsEmpty()) {
95 // Close |db_| now to release any lock on the directory. 95 // Close |db_| now to release any lock on the directory.
96 db_.reset(); 96 db_.reset();
97 if (!file_util::Delete(db_path_, true)) { 97 if (!base::Delete(db_path_, true)) {
98 LOG(WARNING) << "Failed to delete LeveldbValueStore database " << 98 LOG(WARNING) << "Failed to delete LeveldbValueStore database " <<
99 db_path_.value(); 99 db_path_.value();
100 } 100 }
101 } 101 }
102 } 102 }
103 103
104 size_t LeveldbValueStore::GetBytesInUse(const std::string& key) { 104 size_t LeveldbValueStore::GetBytesInUse(const std::string& key) {
105 // Let SettingsStorageQuotaEnforcer implement this. 105 // Let SettingsStorageQuotaEnforcer implement this.
106 NOTREACHED() << "Not implemented"; 106 NOTREACHED() << "Not implemented";
107 return 0; 107 return 0;
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 scoped_ptr<leveldb::Iterator> it(db_->NewIterator(leveldb::ReadOptions())); 427 scoped_ptr<leveldb::Iterator> it(db_->NewIterator(leveldb::ReadOptions()));
428 428
429 it->SeekToFirst(); 429 it->SeekToFirst();
430 bool is_empty = !it->Valid(); 430 bool is_empty = !it->Valid();
431 if (!it->status().ok()) { 431 if (!it->status().ok()) {
432 LOG(ERROR) << "Checking DB emptiness failed: " << it->status().ToString(); 432 LOG(ERROR) << "Checking DB emptiness failed: " << it->status().ToString();
433 return false; 433 return false;
434 } 434 }
435 return is_empty; 435 return is_empty;
436 } 436 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/net_internals/net_internals_ui.cc ('k') | chrome/browser/web_applications/web_app_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698