Commit 9b740d11 authored by jsbell@chromium.org's avatar jsbell@chromium.org

IndexedDB: Chromium coding-style cleanup of new back-end c/o cpplint

BUG=234278
R=alecflett@chromium.org,dgrogan@chromium.org

Review URL: https://chromiumcodereview.appspot.com/16005006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204065 0039d316-1c4b-4281-b951-d872f2087c98
parent a78742cc
......@@ -1797,7 +1797,7 @@ bool IndexedDBBackingStore::Cursor::FirstSeek() {
return ContinueFunction(0, READY);
}
bool IndexedDBBackingStore::Cursor::Advance(unsigned long count) {
bool IndexedDBBackingStore::Cursor::Advance(uint32 count) {
while (count--) {
if (!ContinueFunction())
return false;
......
......@@ -28,6 +28,7 @@ class LevelDBDatabase;
class LevelDBFactory {
public:
virtual ~LevelDBFactory() {}
virtual scoped_ptr<LevelDBDatabase> OpenLevelDB(
const base::FilePath& file_name,
const LevelDBComparator* comparator) = 0;
......@@ -207,7 +208,7 @@ class CONTENT_EXPORT IndexedDBBackingStore
const IndexedDBKey& key() const { return *current_key_; }
bool ContinueFunction(const IndexedDBKey* = 0, IteratorState = SEEK);
bool Advance(unsigned long);
bool Advance(uint32 count);
bool FirstSeek();
virtual Cursor* Clone() = 0;
......
......@@ -379,22 +379,22 @@ TEST(IndexedDBFactoryTest, MemoryBackingStoreLifetime) {
scoped_refptr<MockIDBFactory> factory = MockIDBFactory::Create();
scoped_refptr<IndexedDBBackingStore> mem_store1 =
factory->TestOpenBackingStore(origin1, base::FilePath());
EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1 and factory
EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1 and factory
scoped_refptr<IndexedDBBackingStore> mem_store2 =
factory->TestOpenBackingStore(origin1, base::FilePath());
EXPECT_EQ(mem_store1.get(), mem_store2.get());
EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1, 2 and factory
EXPECT_FALSE(mem_store2->HasOneRef()); // mem_store1, 2 and factory
EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1, 2 and factory
EXPECT_FALSE(mem_store2->HasOneRef()); // mem_store1, 2 and factory
scoped_refptr<IndexedDBBackingStore> mem_store3 =
factory->TestOpenBackingStore(origin2, base::FilePath());
EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1, 2 and factory
EXPECT_FALSE(mem_store3->HasOneRef()); // mem_store3 and factory
EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1, 2 and factory
EXPECT_FALSE(mem_store3->HasOneRef()); // mem_store3 and factory
factory = NULL;
EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1 and 2
EXPECT_FALSE(mem_store2->HasOneRef()); // mem_store1 and 2
EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1 and 2
EXPECT_FALSE(mem_store2->HasOneRef()); // mem_store1 and 2
EXPECT_TRUE(mem_store3->HasOneRef());
mem_store2 = NULL;
......
......@@ -72,7 +72,7 @@ class CONTENT_EXPORT IndexedDBCallbacksWrapper
// From IDBFactory.open()/deleteDatabase()
virtual void OnBlocked(int64 existing_version);
// From IDBFactory.open()
virtual void OnUpgradeNeeded(int64 /* old_version */,
virtual void OnUpgradeNeeded(int64 old_version,
scoped_refptr<IndexedDBDatabase> db,
const IndexedDBDatabaseMetadata& metadata);
virtual void OnSuccess(scoped_refptr<IndexedDBDatabase> db,
......
......@@ -5,6 +5,7 @@
#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_H_
#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CURSOR_H_
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "content/common/indexed_db/indexed_db_key.h"
......@@ -14,7 +15,7 @@ class IndexedDBCallbacksWrapper;
class IndexedDBCursor : public base::RefCounted<IndexedDBCursor> {
public:
virtual void Advance(unsigned long count,
virtual void Advance(uint32 count,
scoped_refptr<IndexedDBCallbacksWrapper> callbacks) = 0;
virtual void ContinueFunction(
scoped_ptr<IndexedDBKey> key,
......
......@@ -34,14 +34,14 @@ class IndexedDBCursorImpl::CursorAdvanceOperation
: public IndexedDBTransaction::Operation {
public:
CursorAdvanceOperation(scoped_refptr<IndexedDBCursorImpl> cursor,
unsigned long count,
uint32 count,
scoped_refptr<IndexedDBCallbacksWrapper> callbacks)
: cursor_(cursor), count_(count), callbacks_(callbacks) {}
virtual void Perform(IndexedDBTransaction* transaction) OVERRIDE;
private:
scoped_refptr<IndexedDBCursorImpl> cursor_;
unsigned long count_;
uint32 count_;
scoped_refptr<IndexedDBCallbacksWrapper> callbacks_;
};
......@@ -90,7 +90,7 @@ void IndexedDBCursorImpl::ContinueFunction(
}
void IndexedDBCursorImpl::Advance(
unsigned long count,
uint32 count,
scoped_refptr<IndexedDBCallbacksWrapper> callbacks) {
IDB_TRACE("IndexedDBCursorImpl::advance");
......
......@@ -42,7 +42,7 @@ class IndexedDBCursorImpl : public IndexedDBCursor {
}
// IndexedDBCursor
virtual void Advance(unsigned long,
virtual void Advance(uint32 count,
scoped_refptr<IndexedDBCallbacksWrapper> callbacks)
OVERRIDE;
virtual void ContinueFunction(
......
......@@ -35,7 +35,7 @@ static const char* kBasicTests[] = {
static const char* kComplexTests[] = {
"prefetch-bugfix-108071.html",
// Flaky: http://crbug.com/226256
//"pending-version-change-stuck.html",
// "pending-version-change-stuck.html",
"pending-version-change-stuck-works-with-terminate.html",
"pending-version-change-on-exit.html",
NULL
......@@ -110,7 +110,7 @@ const char* kIntVersionTests2[] = {
NULL
};
}
} // namespace
IN_PROC_BROWSER_TEST_F(IndexedDBLayoutTest, BasicTests) {
RunLayoutTests(kBasicTests);
......
......@@ -22,8 +22,6 @@
static const quota::StorageType kTemp = quota::kStorageTypeTemporary;
static const quota::StorageType kPerm = quota::kStorageTypePersistent;
using namespace webkit_database;
namespace content {
// Base class for our test fixtures.
......
......@@ -101,7 +101,7 @@ bool IndexedDBTransactionCoordinator::CanRunTransaction(
DCHECK(queued_transactions_.has(transaction));
switch (transaction->mode()) {
case indexed_db::TRANSACTION_VERSION_CHANGE:
DCHECK(queued_transactions_.size() == 1);
DCHECK_EQ(static_cast<size_t>(1), queued_transactions_.size());
DCHECK(started_transactions_.empty());
return true;
......
......@@ -128,7 +128,7 @@ TEST_F(IndexedDBTest, SetForceKeepSessionState) {
class MockWebIDBDatabase : public WebKit::WebIDBDatabase {
public:
MockWebIDBDatabase(bool expect_force_close)
explicit MockWebIDBDatabase(bool expect_force_close)
: expect_force_close_(expect_force_close), force_close_called_(false) {}
virtual ~MockWebIDBDatabase() {
......
......@@ -293,7 +293,7 @@ class IteratorImpl : public LevelDBIterator {
private:
friend class content::LevelDBDatabase;
IteratorImpl(scoped_ptr<leveldb::Iterator> iterator);
explicit IteratorImpl(scoped_ptr<leveldb::Iterator> iterator);
void CheckStatus();
scoped_ptr<leveldb::Iterator> iterator_;
......
......@@ -170,7 +170,6 @@ void LevelDBTransaction::TreeIterator::Next() {
DCHECK(transaction_->comparator_->Compare(LevelDBSlice((*iterator_)->key),
LevelDBSlice(key_)) >
0);
(void) transaction_;
key_ = (*iterator_)->key;
}
}
......@@ -349,7 +348,6 @@ void LevelDBTransaction::TransactionIterator::RefreshTreeIterator() const {
}
if (db_iterator_->IsValid()) {
// There could be new nodes in the tree that we should iterate over.
if (direction_ == FORWARD) {
......
......@@ -34,7 +34,7 @@ class CONTENT_EXPORT LevelDBTransaction
scoped_ptr<LevelDBIterator> CreateIterator();
private:
LevelDBTransaction(LevelDBDatabase* db);
explicit LevelDBTransaction(LevelDBDatabase* db);
virtual ~LevelDBTransaction();
friend class base::RefCounted<LevelDBTransaction>;
......@@ -97,7 +97,7 @@ class CONTENT_EXPORT LevelDBTransaction
void Reset();
private:
TreeIterator(LevelDBTransaction* transaction);
explicit TreeIterator(LevelDBTransaction* transaction);
mutable TreeType::Iterator iterator_; // Dereferencing this is non-const.
TreeType* tree_;
LevelDBTransaction* transaction_;
......@@ -120,7 +120,7 @@ class CONTENT_EXPORT LevelDBTransaction
void TreeChanged();
private:
TransactionIterator(scoped_refptr<LevelDBTransaction> transaction);
explicit TransactionIterator(scoped_refptr<LevelDBTransaction> transaction);
void HandleConflictsAndDeletes();
void SetCurrentIteratorToSmallestKey();
void SetCurrentIteratorToLargestKey();
......@@ -167,7 +167,7 @@ class LevelDBWriteOnlyTransaction {
bool Commit();
private:
LevelDBWriteOnlyTransaction(LevelDBDatabase* db);
explicit LevelDBWriteOnlyTransaction(LevelDBDatabase* db);
LevelDBDatabase* db_;
scoped_ptr<LevelDBWriteBatch> write_batch_;
......
......@@ -70,12 +70,12 @@ class list_set {
typedef std::bidirectional_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
inline iterator(typename std::list<T>::iterator it) : it_(it) {}
explicit inline iterator(typename std::list<T>::iterator it) : it_(it) {}
inline self_type& operator++() {
++it_;
return *this;
}
inline self_type operator++(int) {
inline self_type operator++(int /*ignored*/) {
self_type result(*this);
++(*this);
return result;
......@@ -84,7 +84,7 @@ class list_set {
--it_;
return *this;
}
inline self_type operator--(int) {
inline self_type operator--(int /*ignored*/) {
self_type result(*this);
--(*this);
return result;
......@@ -109,12 +109,13 @@ class list_set {
typedef std::bidirectional_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
inline const_iterator(typename std::list<T>::const_iterator it) : it_(it) {}
explicit inline const_iterator(typename std::list<T>::const_iterator it)
: it_(it) {}
inline self_type& operator++() {
++it_;
return *this;
}
inline self_type operator++(int) {
inline self_type operator++(int ignored) {
self_type result(*this);
++(*this);
return result;
......@@ -123,7 +124,7 @@ class list_set {
--it_;
return *this;
}
inline self_type operator--(int) {
inline self_type operator--(int ignored) {
self_type result(*this);
--(*this);
return result;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment