summaryrefslogtreecommitdiffstats
path: root/extensions/browser/value_store
diff options
context:
space:
mode:
authorjyasskin@chromium.org <jyasskin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-29 17:37:24 +0000
committerjyasskin@chromium.org <jyasskin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-29 17:37:24 +0000
commit54ee8195669456ecc5d929911a2aa3af2db47931 (patch)
treeccef27549113baffd823c5003efb36a00aafae2e /extensions/browser/value_store
parente24b74fe09d92384df55ce53436b1d5dcb309042 (diff)
downloadchromium_src-54ee8195669456ecc5d929911a2aa3af2db47931.zip
chromium_src-54ee8195669456ecc5d929911a2aa3af2db47931.tar.gz
chromium_src-54ee8195669456ecc5d929911a2aa3af2db47931.tar.bz2
Replace DCHECK(BrowserThread::CurrentlyOn) with DCHECK_CURRENTLY_ON in extensions.
This is a follow-up to https://src.chromium.org/viewvc/chrome?revision=256913&view=revision that makes error messages more descriptive. It was automatically produced with git grep -l 'DCHECK(.*CurrentlyOn' extensions chrome/*/extensions|xargs sed -i -e 's/DCHECK(BrowserThread::CurrentlyOn(\([^)]*\)))/DCHECK_CURRENTLY_ON(\1)/' -e 's/DCHECK(content::BrowserThread::CurrentlyOn(\([^)]*\)))/DCHECK_CURRENTLY_ON(\1)/' Review URL: https://codereview.chromium.org/216513002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260380 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/browser/value_store')
-rw-r--r--extensions/browser/value_store/leveldb_value_store.cc30
-rw-r--r--extensions/browser/value_store/value_store_frontend.cc12
2 files changed, 21 insertions, 21 deletions
diff --git a/extensions/browser/value_store/leveldb_value_store.cc b/extensions/browser/value_store/leveldb_value_store.cc
index 58a8cb5..0f09f5b 100644
--- a/extensions/browser/value_store/leveldb_value_store.cc
+++ b/extensions/browser/value_store/leveldb_value_store.cc
@@ -48,7 +48,7 @@ class ScopedSnapshot {
LeveldbValueStore::LeveldbValueStore(const base::FilePath& db_path)
: db_path_(db_path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
scoped_ptr<Error> open_error = EnsureDbIsOpen();
if (open_error)
@@ -56,7 +56,7 @@ LeveldbValueStore::LeveldbValueStore(const base::FilePath& db_path)
}
LeveldbValueStore::~LeveldbValueStore() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
// Delete the database from disk if it's empty (but only if we managed to
// open it!). This is safe on destruction, assuming that we have exclusive
@@ -85,7 +85,7 @@ size_t LeveldbValueStore::GetBytesInUse() {
}
ValueStore::ReadResult LeveldbValueStore::Get(const std::string& key) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
scoped_ptr<Error> open_error = EnsureDbIsOpen();
if (open_error)
@@ -104,7 +104,7 @@ ValueStore::ReadResult LeveldbValueStore::Get(const std::string& key) {
ValueStore::ReadResult LeveldbValueStore::Get(
const std::vector<std::string>& keys) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
scoped_ptr<Error> open_error = EnsureDbIsOpen();
if (open_error)
@@ -131,7 +131,7 @@ ValueStore::ReadResult LeveldbValueStore::Get(
}
ValueStore::ReadResult LeveldbValueStore::Get() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
scoped_ptr<Error> open_error = EnsureDbIsOpen();
if (open_error)
@@ -169,7 +169,7 @@ ValueStore::ReadResult LeveldbValueStore::Get() {
ValueStore::WriteResult LeveldbValueStore::Set(
WriteOptions options, const std::string& key, const base::Value& value) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
scoped_ptr<Error> open_error = EnsureDbIsOpen();
if (open_error)
@@ -189,7 +189,7 @@ ValueStore::WriteResult LeveldbValueStore::Set(
ValueStore::WriteResult LeveldbValueStore::Set(
WriteOptions options, const base::DictionaryValue& settings) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
scoped_ptr<Error> open_error = EnsureDbIsOpen();
if (open_error)
@@ -212,13 +212,13 @@ ValueStore::WriteResult LeveldbValueStore::Set(
}
ValueStore::WriteResult LeveldbValueStore::Remove(const std::string& key) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
return Remove(std::vector<std::string>(1, key));
}
ValueStore::WriteResult LeveldbValueStore::Remove(
const std::vector<std::string>& keys) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
scoped_ptr<Error> open_error = EnsureDbIsOpen();
if (open_error)
@@ -248,7 +248,7 @@ ValueStore::WriteResult LeveldbValueStore::Remove(
}
ValueStore::WriteResult LeveldbValueStore::Clear() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
scoped_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
@@ -270,7 +270,7 @@ ValueStore::WriteResult LeveldbValueStore::Clear() {
}
bool LeveldbValueStore::Restore() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
ReadResult result = Get();
std::string previous_key;
@@ -297,7 +297,7 @@ bool LeveldbValueStore::Restore() {
}
bool LeveldbValueStore::RestoreKey(const std::string& key) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
ReadResult result = Get(key);
if (result->IsCorrupted()) {
@@ -319,7 +319,7 @@ bool LeveldbValueStore::WriteToDbForTest(leveldb::WriteBatch* batch) {
}
scoped_ptr<ValueStore::Error> LeveldbValueStore::EnsureDbIsOpen() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
if (db_)
return util::NoError();
@@ -343,7 +343,7 @@ scoped_ptr<ValueStore::Error> LeveldbValueStore::ReadFromDb(
leveldb::ReadOptions options,
const std::string& key,
scoped_ptr<base::Value>* setting) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(setting);
std::string value_as_json;
@@ -405,7 +405,7 @@ scoped_ptr<ValueStore::Error> LeveldbValueStore::WriteToDb(
}
bool LeveldbValueStore::IsEmpty() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
scoped_ptr<leveldb::Iterator> it(db_->NewIterator(leveldb::ReadOptions()));
it->SeekToFirst();
diff --git a/extensions/browser/value_store/value_store_frontend.cc b/extensions/browser/value_store/value_store_frontend.cc
index 6ef11cc..73b6aff 100644
--- a/extensions/browser/value_store/value_store_frontend.cc
+++ b/extensions/browser/value_store/value_store_frontend.cc
@@ -18,7 +18,7 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> {
Backend() : storage_(NULL) {}
void Init(const base::FilePath& db_path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(!storage_);
TRACE_EVENT0("ValueStoreFrontend::Backend", "Init");
db_path_ = db_path;
@@ -27,14 +27,14 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> {
// This variant is useful for testing (using a mock ValueStore).
void InitWithStore(scoped_ptr<ValueStore> storage) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(!storage_);
storage_ = storage.release();
}
void Get(const std::string& key,
const ValueStoreFrontend::ReadCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
ValueStore::ReadResult result = storage_->Get(key);
// Extract the value from the ReadResult and pass ownership of it to the
@@ -53,14 +53,14 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> {
}
void Set(const std::string& key, scoped_ptr<base::Value> value) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
// We don't need the old value, so skip generating changes.
storage_->Set(ValueStore::IGNORE_QUOTA | ValueStore::NO_GENERATE_CHANGES,
key, *value.get());
}
void Remove(const std::string& key) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ DCHECK_CURRENTLY_ON(BrowserThread::FILE);
storage_->Remove(key);
}
@@ -77,7 +77,7 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> {
void RunCallback(const ValueStoreFrontend::ReadCallback& callback,
scoped_ptr<base::Value> value) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
callback.Run(value.Pass());
}