From 4cfd02d3569fcdd2066b41b382e377065485d065 Mon Sep 17 00:00:00 2001 From: "jsbell@chromium.org" Date: Wed, 11 Jun 2014 18:08:40 +0000 Subject: [PATCH] IndexedDB: Fix trivial cpplint.py errors Classes of errors tackled: whitespace, include-what-you-use, explicit constructors, parameter names, include guards, bracing, and one use of "unsigned long" in IPC. This does not tackle use of non-const references, since those should be carefully reviewed and affects the callers. Also, several uses of "long" remain in content/child when implementing Blink interfaces. R=cmumford@chromium.org,ericu@chromium.org,tsepez@chromium.org BUG=381456 Review URL: https://codereview.chromium.org/311263014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276451 0039d316-1c4b-4281-b951-d872f2087c98 --- content/browser/indexed_db/indexed_db_active_blob_registry.h | 2 +- content/browser/indexed_db/indexed_db_backing_store.cc | 9 ++++----- content/browser/indexed_db/indexed_db_backing_store.h | 2 ++ .../browser/indexed_db/indexed_db_backing_store_unittest.cc | 2 +- content/browser/indexed_db/indexed_db_blob_info.h | 2 ++ content/browser/indexed_db/indexed_db_browsertest.cc | 1 + content/browser/indexed_db/indexed_db_connection.cc | 2 +- content/browser/indexed_db/indexed_db_context_impl.cc | 3 +-- content/browser/indexed_db/indexed_db_context_impl.h | 1 + content/browser/indexed_db/indexed_db_cursor.cc | 2 ++ content/browser/indexed_db/indexed_db_database_error.h | 3 +-- content/browser/indexed_db/indexed_db_database_unittest.cc | 7 ++++--- content/browser/indexed_db/indexed_db_dispatcher_host.cc | 3 +-- content/browser/indexed_db/indexed_db_dispatcher_host.h | 3 ++- content/browser/indexed_db/indexed_db_factory.cc | 3 ++- content/browser/indexed_db/indexed_db_factory.h | 2 ++ content/browser/indexed_db/indexed_db_factory_unittest.cc | 6 ++++-- content/browser/indexed_db/indexed_db_fake_backing_store.h | 2 +- content/browser/indexed_db/indexed_db_internals_ui.cc | 4 ++-- content/browser/indexed_db/indexed_db_leveldb_coding.h | 2 ++ content/browser/indexed_db/indexed_db_metadata.h | 2 +- content/browser/indexed_db/indexed_db_pending_connection.h | 6 +++--- content/browser/indexed_db/indexed_db_transaction.cc | 7 ++++--- content/browser/indexed_db/indexed_db_value.h | 3 +++ content/browser/indexed_db/leveldb/leveldb_database.cc | 8 ++++---- content/browser/indexed_db/mock_indexed_db_callbacks.cc | 3 ++- content/browser/indexed_db/mock_indexed_db_callbacks.h | 8 +++++--- content/child/indexed_db/indexed_db_dispatcher.cc | 10 +++++----- content/child/indexed_db/indexed_db_dispatcher.h | 7 ++++--- content/child/indexed_db/indexed_db_dispatcher_unittest.cc | 6 ++++-- content/child/indexed_db/indexed_db_key_builders.cc | 4 ++++ content/child/indexed_db/webidbcursor_impl.h | 6 +++--- content/child/indexed_db/webidbcursor_impl_unittest.cc | 6 +----- content/child/indexed_db/webidbdatabase_impl.cc | 1 + content/child/indexed_db/webidbdatabase_impl.h | 6 +++--- content/child/indexed_db/webidbfactory_impl.h | 6 +++--- content/common/indexed_db/indexed_db_key.h | 1 + content/common/indexed_db/indexed_db_key_path.h | 1 + content/common/indexed_db/indexed_db_messages.h | 9 +++++---- content/common/indexed_db/indexed_db_param_traits.h | 4 +++- 40 files changed, 97 insertions(+), 68 deletions(-) diff --git a/content/browser/indexed_db/indexed_db_active_blob_registry.h b/content/browser/indexed_db/indexed_db_active_blob_registry.h index dffdda36f46b..92380e13260c 100644 --- a/content/browser/indexed_db/indexed_db_active_blob_registry.h +++ b/content/browser/indexed_db/indexed_db_active_blob_registry.h @@ -20,7 +20,7 @@ class IndexedDBBackingStore; class CONTENT_EXPORT IndexedDBActiveBlobRegistry { public: - IndexedDBActiveBlobRegistry(IndexedDBBackingStore* backing_store); + explicit IndexedDBActiveBlobRegistry(IndexedDBBackingStore* backing_store); ~IndexedDBActiveBlobRegistry(); // Most methods of this class, and the closure returned by diff --git a/content/browser/indexed_db/indexed_db_backing_store.cc b/content/browser/indexed_db/indexed_db_backing_store.cc index 67e9acb125b7..787ab9dda300 100644 --- a/content/browser/indexed_db/indexed_db_backing_store.cc +++ b/content/browser/indexed_db/indexed_db_backing_store.cc @@ -162,8 +162,8 @@ static void RecordInternalError(const char* type, // Use to signal conditions that usually indicate developer error, but // could be caused by data corruption. A macro is used instead of an // inline function so that the assert and log report the line number. -// TODO: Improve test coverage so that all error conditions are "tested" and -// then delete this macro. +// TODO(cmumford): Improve test coverage so that all error conditions are +// "tested" and then delete this macro. #define REPORT_ERROR_UNTESTED(type, location) \ do { \ LOG(ERROR) << "IndexedDB " type " Error: " #location; \ @@ -864,7 +864,6 @@ leveldb::Status IndexedDBBackingStore::DestroyBackingStore( bool IndexedDBBackingStore::ReadCorruptionInfo(const base::FilePath& path_base, const GURL& origin_url, std::string& message) { - const base::FilePath info_path = path_base.Append(ComputeCorruptionFileName(origin_url)); @@ -2252,8 +2251,8 @@ class LocalWriteClosure : public FileWriterDelegate::DelegateWriteCallback, if (write_status == FileWriterDelegate::SUCCESS_IO_PENDING) return; // We don't care about progress events. if (rv == base::File::FILE_OK) { - DCHECK(bytes >= 0); - DCHECK(write_status == FileWriterDelegate::SUCCESS_COMPLETED); + DCHECK_GE(bytes, 0); + DCHECK_EQ(write_status, FileWriterDelegate::SUCCESS_COMPLETED); bytes_written_ = bytes; } else { DCHECK(write_status == FileWriterDelegate::ERROR_WRITE_STARTED || diff --git a/content/browser/indexed_db/indexed_db_backing_store.h b/content/browser/indexed_db/indexed_db_backing_store.h index 46e1e0646bec..7931f7635432 100644 --- a/content/browser/indexed_db/indexed_db_backing_store.h +++ b/content/browser/indexed_db/indexed_db_backing_store.h @@ -5,8 +5,10 @@ #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BACKING_STORE_H_ +#include #include #include +#include #include #include "base/basictypes.h" diff --git a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc index e35661928d3a..76d6d5fa5264 100644 --- a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc +++ b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc @@ -170,7 +170,7 @@ class TestableIndexedDBBackingStore : public IndexedDBBackingStore { class TestIDBFactory : public IndexedDBFactory { public: - TestIDBFactory(IndexedDBContextImpl* idb_context) + explicit TestIDBFactory(IndexedDBContextImpl* idb_context) : IndexedDBFactory(idb_context) {} scoped_refptr OpenBackingStoreForTest( diff --git a/content/browser/indexed_db/indexed_db_blob_info.h b/content/browser/indexed_db/indexed_db_blob_info.h index 55ddfbc9f172..a2ac99149fc7 100644 --- a/content/browser/indexed_db/indexed_db_blob_info.h +++ b/content/browser/indexed_db/indexed_db_blob_info.h @@ -5,6 +5,8 @@ #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_BLOB_INFO_H_ +#include + #include "base/callback.h" #include "base/files/file_path.h" #include "base/time/time.h" diff --git a/content/browser/indexed_db/indexed_db_browsertest.cc b/content/browser/indexed_db/indexed_db_browsertest.cc index 00b94711d092..0d62a1336749 100644 --- a/content/browser/indexed_db/indexed_db_browsertest.cc +++ b/content/browser/indexed_db/indexed_db_browsertest.cc @@ -125,6 +125,7 @@ class IndexedDBBrowserTest : public ContentBrowserTest { base::MessageLoop::current()->RunUntilIdle(); return disk_usage_; } + private: virtual void DidGetDiskUsage(int64 bytes) { EXPECT_GT(bytes, 0); diff --git a/content/browser/indexed_db/indexed_db_connection.cc b/content/browser/indexed_db/indexed_db_connection.cc index 81139895366c..0669e14c0d0e 100644 --- a/content/browser/indexed_db/indexed_db_connection.cc +++ b/content/browser/indexed_db/indexed_db_connection.cc @@ -34,4 +34,4 @@ bool IndexedDBConnection::IsConnected() { return database_.get() != NULL; } -} // namespace blink +} // namespace content diff --git a/content/browser/indexed_db/indexed_db_context_impl.cc b/content/browser/indexed_db/indexed_db_context_impl.cc index 14d8e4de06e5..c2bd0afa62cf 100644 --- a/content/browser/indexed_db/indexed_db_context_impl.cc +++ b/content/browser/indexed_db/indexed_db_context_impl.cc @@ -5,6 +5,7 @@ #include "content/browser/indexed_db/indexed_db_context_impl.h" #include +#include #include "base/bind.h" #include "base/command_line.h" @@ -197,7 +198,6 @@ base::ListValue* IndexedDBContextImpl::GetAllOriginsDetails() { for (IndexedDBFactory::OriginDBMapIterator it = range.first; it != range.second; ++it) { - const IndexedDBDatabase* db = it->second; scoped_ptr db_info(new base::DictionaryValue()); @@ -217,7 +217,6 @@ base::ListValue* IndexedDBContextImpl::GetAllOriginsDetails() { transactions.begin(); trans_it != transactions.end(); ++trans_it) { - const IndexedDBTransaction* transaction = *trans_it; scoped_ptr transaction_info( new base::DictionaryValue()); diff --git a/content/browser/indexed_db/indexed_db_context_impl.h b/content/browser/indexed_db/indexed_db_context_impl.h index 31ebc217d156..b3ec9850fdd9 100644 --- a/content/browser/indexed_db/indexed_db_context_impl.h +++ b/content/browser/indexed_db/indexed_db_context_impl.h @@ -7,6 +7,7 @@ #include #include +#include #include #include "base/compiler_specific.h" diff --git a/content/browser/indexed_db/indexed_db_cursor.cc b/content/browser/indexed_db/indexed_db_cursor.cc index 9caf29d90195..7715a998a75c 100644 --- a/content/browser/indexed_db/indexed_db_cursor.cc +++ b/content/browser/indexed_db/indexed_db_cursor.cc @@ -4,6 +4,8 @@ #include "content/browser/indexed_db/indexed_db_cursor.h" +#include + #include "base/bind.h" #include "base/logging.h" #include "content/browser/indexed_db/indexed_db_callbacks.h" diff --git a/content/browser/indexed_db/indexed_db_database_error.h b/content/browser/indexed_db/indexed_db_database_error.h index 5b81a7a36a8b..25b5ea6ed1cc 100644 --- a/content/browser/indexed_db/indexed_db_database_error.h +++ b/content/browser/indexed_db/indexed_db_database_error.h @@ -13,8 +13,7 @@ namespace content { class IndexedDBDatabaseError { public: - IndexedDBDatabaseError(uint16 code) - : code_(code) {} + explicit IndexedDBDatabaseError(uint16 code) : code_(code) {} IndexedDBDatabaseError(uint16 code, const char* message) : code_(code), message_(base::ASCIIToUTF16(message)) {} IndexedDBDatabaseError(uint16 code, const base::string16& message) diff --git a/content/browser/indexed_db/indexed_db_database_unittest.cc b/content/browser/indexed_db/indexed_db_database_unittest.cc index 307cf5144444..dcaf8233657d 100644 --- a/content/browser/indexed_db/indexed_db_database_unittest.cc +++ b/content/browser/indexed_db/indexed_db_database_unittest.cc @@ -4,6 +4,8 @@ #include "content/browser/indexed_db/indexed_db_database.h" +#include + #include "base/auto_reset.h" #include "base/logging.h" #include "base/run_loop.h" @@ -14,7 +16,6 @@ #include "content/browser/indexed_db/indexed_db_callbacks.h" #include "content/browser/indexed_db/indexed_db_connection.h" #include "content/browser/indexed_db/indexed_db_cursor.h" -#include "content/browser/indexed_db/indexed_db_database.h" #include "content/browser/indexed_db/indexed_db_factory.h" #include "content/browser/indexed_db/indexed_db_fake_backing_store.h" #include "content/browser/indexed_db/indexed_db_transaction.h" @@ -160,7 +161,7 @@ class MockDeleteCallbacks : public IndexedDBCallbacks { virtual void OnBlocked(int64 existing_version) OVERRIDE { blocked_called_ = true; } - virtual void OnSuccess(int64) OVERRIDE { success_called_ = true; } + virtual void OnSuccess(int64 result) OVERRIDE { success_called_ = true; } bool blocked_called() const { return blocked_called_; } bool success_called() const { return success_called_; } @@ -408,7 +409,7 @@ TEST_F(IndexedDBDatabaseOperationTest, CreatePutDelete) { RunPostedTasks(); EXPECT_EQ(0ULL, db_->metadata().object_stores.size()); - transaction_->Commit(); // Cleans up the object hierarchy. + transaction_->Commit(); // Cleans up the object hierarchy. } } // namespace content diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.cc b/content/browser/indexed_db/indexed_db_dispatcher_host.cc index 5ec2b943786c..b147951fa337 100644 --- a/content/browser/indexed_db/indexed_db_dispatcher_host.cc +++ b/content/browser/indexed_db/indexed_db_dispatcher_host.cc @@ -244,7 +244,6 @@ IndexedDBCursor* IndexedDBDispatcherHost::GetCursorFromId(int32 ipc_cursor_id) { web_metadata.object_stores.begin(); iter != web_metadata.object_stores.end(); ++iter) { - const content::IndexedDBObjectStoreMetadata& web_store_metadata = iter->second; ::IndexedDBObjectStoreMetadata idb_store_metadata; @@ -902,7 +901,7 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnAdvance( int32 ipc_cursor_id, int32 ipc_thread_id, int32 ipc_callbacks_id, - unsigned long count) { + uint32 count) { DCHECK( parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); IndexedDBCursor* idb_cursor = diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.h b/content/browser/indexed_db/indexed_db_dispatcher_host.h index c2c78b4f71c4..abbdab992347 100644 --- a/content/browser/indexed_db/indexed_db_dispatcher_host.h +++ b/content/browser/indexed_db/indexed_db_dispatcher_host.h @@ -6,6 +6,7 @@ #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DISPATCHER_HOST_H_ #include +#include #include #include "base/basictypes.h" @@ -240,7 +241,7 @@ class IndexedDBDispatcherHost : public BrowserMessageFilter { void OnAdvance(int32 ipc_object_store_id, int32 ipc_thread_id, int32 ipc_callbacks_id, - unsigned long count); + uint32 count); void OnContinue(int32 ipc_object_store_id, int32 ipc_thread_id, int32 ipc_callbacks_id, diff --git a/content/browser/indexed_db/indexed_db_factory.cc b/content/browser/indexed_db/indexed_db_factory.cc index dccec5f58121..3f08d06c9bdf 100644 --- a/content/browser/indexed_db/indexed_db_factory.cc +++ b/content/browser/indexed_db/indexed_db_factory.cc @@ -4,6 +4,8 @@ #include "content/browser/indexed_db/indexed_db_factory.h" +#include + #include "base/logging.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" @@ -302,7 +304,6 @@ void IndexedDBFactory::HandleBackingStoreCorruption( bool IndexedDBFactory::IsDatabaseOpen(const GURL& origin_url, const base::string16& name) const { - return !!database_map_.count(IndexedDBDatabase::Identifier(origin_url, name)); } diff --git a/content/browser/indexed_db/indexed_db_factory.h b/content/browser/indexed_db/indexed_db_factory.h index 9c16ada0aa63..c2177de7e567 100644 --- a/content/browser/indexed_db/indexed_db_factory.h +++ b/content/browser/indexed_db/indexed_db_factory.h @@ -7,6 +7,8 @@ #include #include +#include +#include #include "base/basictypes.h" #include "base/files/file_path.h" diff --git a/content/browser/indexed_db/indexed_db_factory_unittest.cc b/content/browser/indexed_db/indexed_db_factory_unittest.cc index ba7de61b9a1d..975f9bcbcd35 100644 --- a/content/browser/indexed_db/indexed_db_factory_unittest.cc +++ b/content/browser/indexed_db/indexed_db_factory_unittest.cc @@ -28,7 +28,8 @@ namespace { class MockIDBFactory : public IndexedDBFactory { public: - MockIDBFactory(IndexedDBContextImpl* context) : IndexedDBFactory(context) {} + explicit MockIDBFactory(IndexedDBContextImpl* context) + : IndexedDBFactory(context) {} scoped_refptr TestOpenBackingStore( const GURL& origin, const base::FilePath& data_directory) { @@ -198,7 +199,8 @@ TEST_F(IndexedDBFactoryTest, RejectLongOrigins) { class DiskFullFactory : public IndexedDBFactory { public: - DiskFullFactory(IndexedDBContextImpl* context) : IndexedDBFactory(context) {} + explicit DiskFullFactory(IndexedDBContextImpl* context) + : IndexedDBFactory(context) {} private: virtual ~DiskFullFactory() {} diff --git a/content/browser/indexed_db/indexed_db_fake_backing_store.h b/content/browser/indexed_db/indexed_db_fake_backing_store.h index 1529c9f0704c..fef28af3bd94 100644 --- a/content/browser/indexed_db/indexed_db_fake_backing_store.h +++ b/content/browser/indexed_db/indexed_db_fake_backing_store.h @@ -135,7 +135,7 @@ class IndexedDBFakeBackingStore : public IndexedDBBackingStore { class FakeTransaction : public IndexedDBBackingStore::Transaction { public: - FakeTransaction(leveldb::Status phase_two_result); + explicit FakeTransaction(leveldb::Status phase_two_result); virtual void Begin() OVERRIDE; virtual leveldb::Status CommitPhaseOne( scoped_refptr) OVERRIDE; diff --git a/content/browser/indexed_db/indexed_db_internals_ui.cc b/content/browser/indexed_db/indexed_db_internals_ui.cc index 7c16e19b55cb..5e181f43c896 100644 --- a/content/browser/indexed_db/indexed_db_internals_ui.cc +++ b/content/browser/indexed_db/indexed_db_internals_ui.cc @@ -263,7 +263,7 @@ void IndexedDBInternalsUI::OnForcedClose(const base::FilePath& partition_path, "indexeddb.onForcedClose", base::StringValue(partition_path.value()), base::StringValue(origin_url.spec()), - base::FundamentalValue(double(connection_count))); + base::FundamentalValue(static_cast(connection_count))); } void IndexedDBInternalsUI::OnDownloadDataReady( @@ -355,7 +355,7 @@ void IndexedDBInternalsUI::OnDownloadStarted( "indexeddb.onOriginDownloadReady", base::StringValue(partition_path.value()), base::StringValue(origin_url.spec()), - base::FundamentalValue(double(connection_count))); + base::FundamentalValue(static_cast(connection_count))); } } // namespace content diff --git a/content/browser/indexed_db/indexed_db_leveldb_coding.h b/content/browser/indexed_db/indexed_db_leveldb_coding.h index 50573ee95d32..85bc091b56ba 100644 --- a/content/browser/indexed_db/indexed_db_leveldb_coding.h +++ b/content/browser/indexed_db/indexed_db_leveldb_coding.h @@ -6,6 +6,8 @@ #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_LEVELDB_CODING_H_ #include +#include +#include #include "base/basictypes.h" #include "base/logging.h" diff --git a/content/browser/indexed_db/indexed_db_metadata.h b/content/browser/indexed_db/indexed_db_metadata.h index 00970a61ee51..68df82ed842f 100644 --- a/content/browser/indexed_db/indexed_db_metadata.h +++ b/content/browser/indexed_db/indexed_db_metadata.h @@ -79,6 +79,6 @@ struct CONTENT_EXPORT IndexedDBDatabaseMetadata { ObjectStoreMap object_stores; }; -} +} // namespace content #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_METADATA_H_ diff --git a/content/browser/indexed_db/indexed_db_pending_connection.h b/content/browser/indexed_db/indexed_db_pending_connection.h index c16691e78117..598bef2641b3 100644 --- a/content/browser/indexed_db/indexed_db_pending_connection.h +++ b/content/browser/indexed_db/indexed_db_pending_connection.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_INDEXED_DB_PENDING_CONNECTION_H_ -#define CONTENT_BROWSER_INDEXED_DB_PENDING_CONNECTION_H_ +#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_PENDING_CONNECTION_H_ +#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_PENDING_CONNECTION_H_ #include "base/basictypes.h" #include "base/memory/ref_counted.h" @@ -33,4 +33,4 @@ struct CONTENT_EXPORT IndexedDBPendingConnection { } // namespace content -#endif // CONTENT_BROWSER_INDEXED_DB_PENDING_CONNECTION_H_ +#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_PENDING_CONNECTION_H_ diff --git a/content/browser/indexed_db/indexed_db_transaction.cc b/content/browser/indexed_db/indexed_db_transaction.cc index 4fb4c24f9ce4..c7689b75e477 100644 --- a/content/browser/indexed_db/indexed_db_transaction.cc +++ b/content/browser/indexed_db/indexed_db_transaction.cc @@ -209,7 +209,8 @@ void IndexedDBTransaction::Start() { class BlobWriteCallbackImpl : public IndexedDBBackingStore::BlobWriteCallback { public: - BlobWriteCallbackImpl(scoped_refptr transaction) + explicit BlobWriteCallbackImpl( + scoped_refptr transaction) : transaction_(transaction) {} virtual void Run(bool succeeded) OVERRIDE { transaction_->BlobWriteComplete(succeeded); @@ -255,9 +256,9 @@ void IndexedDBTransaction::Commit() { state_ = COMMITTING; - if (!used_) + if (!used_) { CommitPhaseTwo(); - else { + } else { scoped_refptr callback( new BlobWriteCallbackImpl(this)); // CommitPhaseOne will call the callback synchronously if there are no blobs diff --git a/content/browser/indexed_db/indexed_db_value.h b/content/browser/indexed_db/indexed_db_value.h index 9a5385f5266d..d313038dd697 100644 --- a/content/browser/indexed_db/indexed_db_value.h +++ b/content/browser/indexed_db/indexed_db_value.h @@ -5,7 +5,10 @@ #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_VALUE_H_ #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_VALUE_H_ +#include +#include #include + #include "content/browser/indexed_db/indexed_db_blob_info.h" #include "content/common/content_export.h" diff --git a/content/browser/indexed_db/leveldb/leveldb_database.cc b/content/browser/indexed_db/leveldb/leveldb_database.cc index 9ef3929a50ab..16f4fc79c61b 100644 --- a/content/browser/indexed_db/leveldb/leveldb_database.cc +++ b/content/browser/indexed_db/leveldb/leveldb_database.cc @@ -127,7 +127,7 @@ class LockImpl : public LevelDBLock { DISALLOW_COPY_AND_ASSIGN(LockImpl); }; -} +} // namespace scoped_ptr LevelDBDatabase::LockForTesting( const base::FilePath& file_name) { @@ -190,7 +190,7 @@ static void ParseAndHistogramIOErrorDetails(const std::string& histogram_name, std::string error_histogram_name(histogram_name); if (result == leveldb_env::METHOD_AND_PFE) { - DCHECK(error < 0); + DCHECK_LT(error, 0); error_histogram_name.append(std::string(".PFE.") + leveldb_env::MethodIDToString(method)); base::LinearHistogram::FactoryGet( @@ -215,7 +215,7 @@ static void ParseAndHistogramCorruptionDetails( const std::string& histogram_name, const leveldb::Status& status) { int error = leveldb_env::GetCorruptionCode(status); - DCHECK(error >= 0); + DCHECK_GE(error, 0); std::string corruption_histogram_name(histogram_name); corruption_histogram_name.append(".Corruption"); const int kNumPatterns = leveldb_env::GetNumCorruptionCodes(); @@ -396,7 +396,7 @@ class IteratorImpl : public LevelDBIterator { DISALLOW_COPY_AND_ASSIGN(IteratorImpl); }; -} +} // namespace IteratorImpl::IteratorImpl(scoped_ptr it) : iterator_(it.Pass()) {} diff --git a/content/browser/indexed_db/mock_indexed_db_callbacks.cc b/content/browser/indexed_db/mock_indexed_db_callbacks.cc index 2ab3ca5b2269..62afee8d438e 100644 --- a/content/browser/indexed_db/mock_indexed_db_callbacks.cc +++ b/content/browser/indexed_db/mock_indexed_db_callbacks.cc @@ -19,7 +19,8 @@ MockIndexedDBCallbacks::~MockIndexedDBCallbacks() { void MockIndexedDBCallbacks::OnSuccess() {} -void MockIndexedDBCallbacks::OnSuccess(int64) {} +void MockIndexedDBCallbacks::OnSuccess(int64 result) { +} void MockIndexedDBCallbacks::OnSuccess(const std::vector&) {} diff --git a/content/browser/indexed_db/mock_indexed_db_callbacks.h b/content/browser/indexed_db/mock_indexed_db_callbacks.h index 0b99c05ae8fb..fecfd1abb29d 100644 --- a/content/browser/indexed_db/mock_indexed_db_callbacks.h +++ b/content/browser/indexed_db/mock_indexed_db_callbacks.h @@ -5,6 +5,8 @@ #ifndef CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_CALLBACKS_H_ #define CONTENT_BROWSER_INDEXED_DB_MOCK_INDEXED_DB_CALLBACKS_H_ +#include + #include "content/browser/indexed_db/indexed_db_callbacks.h" #include "content/browser/indexed_db/indexed_db_connection.h" @@ -13,11 +15,11 @@ namespace content { class MockIndexedDBCallbacks : public IndexedDBCallbacks { public: MockIndexedDBCallbacks(); - MockIndexedDBCallbacks(bool expect_connection); + explicit MockIndexedDBCallbacks(bool expect_connection); virtual void OnSuccess() OVERRIDE; - virtual void OnSuccess(int64) OVERRIDE; - virtual void OnSuccess(const std::vector&) OVERRIDE; + virtual void OnSuccess(int64 result) OVERRIDE; + virtual void OnSuccess(const std::vector& result) OVERRIDE; virtual void OnSuccess(const IndexedDBKey& key) OVERRIDE; virtual void OnSuccess(scoped_ptr connection, const IndexedDBDatabaseMetadata& metadata) OVERRIDE; diff --git a/content/child/indexed_db/indexed_db_dispatcher.cc b/content/child/indexed_db/indexed_db_dispatcher.cc index 3a66188393d0..e6fc2b97495a 100644 --- a/content/child/indexed_db/indexed_db_dispatcher.cc +++ b/content/child/indexed_db/indexed_db_dispatcher.cc @@ -310,7 +310,7 @@ void IndexedDBDispatcher::RequestIDBDatabaseGet( WebIDBCallbacks* callbacks) { ResetCursorPrefetchCaches(transaction_id, kAllCursors); IndexedDBHostMsg_DatabaseGet_Params params; - init_params(params, callbacks); + init_params(¶ms, callbacks); params.ipc_database_id = ipc_database_id; params.transaction_id = transaction_id; params.object_store_id = object_store_id; @@ -345,7 +345,7 @@ void IndexedDBDispatcher::RequestIDBDatabasePut( ResetCursorPrefetchCaches(transaction_id, kAllCursors); IndexedDBHostMsg_DatabasePut_Params params; - init_params(params, callbacks); + init_params(¶ms, callbacks); params.ipc_database_id = ipc_database_id; params.transaction_id = transaction_id; params.object_store_id = object_store_id; @@ -397,7 +397,7 @@ void IndexedDBDispatcher::RequestIDBDatabaseOpenCursor( WebIDBCallbacks* callbacks) { ResetCursorPrefetchCaches(transaction_id, kAllCursors); IndexedDBHostMsg_DatabaseOpenCursor_Params params; - init_params(params, callbacks); + init_params(¶ms, callbacks); params.ipc_database_id = ipc_database_id; params.transaction_id = transaction_id; params.object_store_id = object_store_id; @@ -422,7 +422,7 @@ void IndexedDBDispatcher::RequestIDBDatabaseCount( WebIDBCallbacks* callbacks) { ResetCursorPrefetchCaches(transaction_id, kAllCursors); IndexedDBHostMsg_DatabaseCount_Params params; - init_params(params, callbacks); + init_params(¶ms, callbacks); params.ipc_database_id = ipc_database_id; params.transaction_id = transaction_id; params.object_store_id = object_store_id; @@ -439,7 +439,7 @@ void IndexedDBDispatcher::RequestIDBDatabaseDeleteRange( WebIDBCallbacks* callbacks) { ResetCursorPrefetchCaches(transaction_id, kAllCursors); IndexedDBHostMsg_DatabaseDeleteRange_Params params; - init_params(params, callbacks); + init_params(¶ms, callbacks); params.ipc_database_id = ipc_database_id; params.transaction_id = transaction_id; params.object_store_id = object_store_id; diff --git a/content/child/indexed_db/indexed_db_dispatcher.h b/content/child/indexed_db/indexed_db_dispatcher.h index c4159bec5d56..d0e1118dc818 100644 --- a/content/child/indexed_db/indexed_db_dispatcher.h +++ b/content/child/indexed_db/indexed_db_dispatcher.h @@ -6,6 +6,7 @@ #define CONTENT_CHILD_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ #include +#include #include #include "base/gtest_prod_util.h" @@ -182,10 +183,10 @@ class CONTENT_EXPORT IndexedDBDispatcher : public WorkerTaskRunner::Observer { } template - void init_params(T& params, blink::WebIDBCallbacks* callbacks_ptr) { + void init_params(T* params, blink::WebIDBCallbacks* callbacks_ptr) { scoped_ptr callbacks(callbacks_ptr); - params.ipc_thread_id = CurrentWorkerId(); - params.ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); + params->ipc_thread_id = CurrentWorkerId(); + params->ipc_callbacks_id = pending_callbacks_.Add(callbacks.release()); } // IDBCallback message handlers. diff --git a/content/child/indexed_db/indexed_db_dispatcher_unittest.cc b/content/child/indexed_db/indexed_db_dispatcher_unittest.cc index 98f929e7322f..6bc4d5df4cda 100644 --- a/content/child/indexed_db/indexed_db_dispatcher_unittest.cc +++ b/content/child/indexed_db/indexed_db_dispatcher_unittest.cc @@ -45,7 +45,8 @@ class MockCallbacks : public WebIDBCallbacks { class MockDispatcher : public IndexedDBDispatcher { public: - MockDispatcher(ThreadSafeSender* sender) : IndexedDBDispatcher(sender) {} + explicit MockDispatcher(ThreadSafeSender* sender) + : IndexedDBDispatcher(sender) {} virtual bool Send(IPC::Message* msg) OVERRIDE { delete msg; @@ -133,7 +134,8 @@ namespace { class CursorCallbacks : public WebIDBCallbacks { public: - CursorCallbacks(scoped_ptr* cursor) : cursor_(cursor) {} + explicit CursorCallbacks(scoped_ptr* cursor) + : cursor_(cursor) {} virtual void onSuccess(const WebData&, const WebVector&) OVERRIDE {} diff --git a/content/child/indexed_db/indexed_db_key_builders.cc b/content/child/indexed_db/indexed_db_key_builders.cc index 831161c2aafd..fe3b3f0a9424 100644 --- a/content/child/indexed_db/indexed_db_key_builders.cc +++ b/content/child/indexed_db/indexed_db_key_builders.cc @@ -4,6 +4,10 @@ #include "content/child/indexed_db/indexed_db_key_builders.h" +#include +#include +#include + #include "base/logging.h" #include "third_party/WebKit/public/platform/WebVector.h" diff --git a/content/child/indexed_db/webidbcursor_impl.h b/content/child/indexed_db/webidbcursor_impl.h index f68da6a75aae..1a06d99fdc26 100644 --- a/content/child/indexed_db/webidbcursor_impl.h +++ b/content/child/indexed_db/webidbcursor_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ -#define CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ +#ifndef CONTENT_CHILD_INDEXED_DB_WEBIDBCURSOR_IMPL_H_ +#define CONTENT_CHILD_INDEXED_DB_WEBIDBCURSOR_IMPL_H_ #include #include @@ -90,4 +90,4 @@ class CONTENT_EXPORT WebIDBCursorImpl } // namespace content -#endif // CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ +#endif // CONTENT_CHILD_INDEXED_DB_WEBIDBCURSOR_IMPL_H_ diff --git a/content/child/indexed_db/webidbcursor_impl_unittest.cc b/content/child/indexed_db/webidbcursor_impl_unittest.cc index a131096be23a..2ff4617c7810 100644 --- a/content/child/indexed_db/webidbcursor_impl_unittest.cc +++ b/content/child/indexed_db/webidbcursor_impl_unittest.cc @@ -28,7 +28,7 @@ namespace { class MockDispatcher : public IndexedDBDispatcher { public: - MockDispatcher(ThreadSafeSender* thread_safe_sender) + explicit MockDispatcher(ThreadSafeSender* thread_safe_sender) : IndexedDBDispatcher(thread_safe_sender), prefetch_calls_(0), last_prefetch_count_(0), @@ -103,7 +103,6 @@ class MockContinueCallbacks : public WebIDBCallbacks { const WebIDBKey& primaryKey, const WebData& value, const WebVector& webBlobInfo) OVERRIDE { - if (key_) *key_ = IndexedDBKeyBuilder::Build(key); if (webBlobInfo_) @@ -140,7 +139,6 @@ class WebIDBCursorImplTest : public testing::Test { }; TEST_F(WebIDBCursorImplTest, PrefetchTest) { - const int64 transaction_id = 1; { WebIDBCursorImpl cursor(WebIDBCursorImpl::kInvalidCursorId, @@ -164,7 +162,6 @@ TEST_F(WebIDBCursorImplTest, PrefetchTest) { int last_prefetch_count = 0; for (int repetitions = 0; repetitions < kPrefetchRepetitions; ++repetitions) { - // Initiate the prefetch cursor.continueFunction(null_key_, new MockContinueCallbacks()); EXPECT_EQ(continue_calls, dispatcher_->continue_calls()); @@ -212,7 +209,6 @@ TEST_F(WebIDBCursorImplTest, PrefetchTest) { } TEST_F(WebIDBCursorImplTest, AdvancePrefetchTest) { - const int64 transaction_id = 1; WebIDBCursorImpl cursor(WebIDBCursorImpl::kInvalidCursorId, transaction_id, diff --git a/content/child/indexed_db/webidbdatabase_impl.cc b/content/child/indexed_db/webidbdatabase_impl.cc index ee83e187a5b9..8055ddae2729 100644 --- a/content/child/indexed_db/webidbdatabase_impl.cc +++ b/content/child/indexed_db/webidbdatabase_impl.cc @@ -4,6 +4,7 @@ #include "content/child/indexed_db/webidbdatabase_impl.h" +#include #include #include "content/child/indexed_db/indexed_db_dispatcher.h" diff --git a/content/child/indexed_db/webidbdatabase_impl.h b/content/child/indexed_db/webidbdatabase_impl.h index 088f722be5ad..bc47062089c9 100644 --- a/content/child/indexed_db/webidbdatabase_impl.h +++ b/content/child/indexed_db/webidbdatabase_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBDATABASE_IMPL_H_ -#define CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBDATABASE_IMPL_H_ +#ifndef CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ +#define CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ #include "base/basictypes.h" #include "base/memory/ref_counted.h" @@ -116,4 +116,4 @@ class WebIDBDatabaseImpl : public blink::WebIDBDatabase { } // namespace content -#endif // CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBDATABASE_IMPL_H_ +#endif // CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ diff --git a/content/child/indexed_db/webidbfactory_impl.h b/content/child/indexed_db/webidbfactory_impl.h index 1484cd675680..cc11bba7c289 100644 --- a/content/child/indexed_db/webidbfactory_impl.h +++ b/content/child/indexed_db/webidbfactory_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBFACTORY_IMPL_H_ -#define CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBFACTORY_IMPL_H_ +#ifndef CONTENT_CHILD_INDEXED_DB_WEBIDBFACTORY_IMPL_H_ +#define CONTENT_CHILD_INDEXED_DB_WEBIDBFACTORY_IMPL_H_ #include "base/memory/ref_counted.h" #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" @@ -42,4 +42,4 @@ class WebIDBFactoryImpl : public blink::WebIDBFactory { } // namespace content -#endif // CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBFACTORY_IMPL_H_ +#endif // CONTENT_CHILD_INDEXED_DB_WEBIDBFACTORY_IMPL_H_ diff --git a/content/common/indexed_db/indexed_db_key.h b/content/common/indexed_db/indexed_db_key.h index 44b288dfc01f..848a930daeab 100644 --- a/content/common/indexed_db/indexed_db_key.h +++ b/content/common/indexed_db/indexed_db_key.h @@ -5,6 +5,7 @@ #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_H_ +#include #include #include "base/basictypes.h" diff --git a/content/common/indexed_db/indexed_db_key_path.h b/content/common/indexed_db/indexed_db_key_path.h index ec5e8611b235..b9387a4c8ac5 100644 --- a/content/common/indexed_db/indexed_db_key_path.h +++ b/content/common/indexed_db/indexed_db_key_path.h @@ -5,6 +5,7 @@ #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_PATH_H_ #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_KEY_PATH_H_ +#include #include #include "base/logging.h" diff --git a/content/common/indexed_db/indexed_db_messages.h b/content/common/indexed_db/indexed_db_messages.h index ac3fa2bcac98..558d09af5043 100644 --- a/content/common/indexed_db/indexed_db_messages.h +++ b/content/common/indexed_db/indexed_db_messages.h @@ -4,6 +4,7 @@ // Message definition file, included multiple times, hence no include guard. +#include #include #include @@ -418,10 +419,10 @@ IPC_MESSAGE_CONTROL3(IndexedDBMsg_DatabaseCallbacksComplete, // WebIDBCursor::advance() message. IPC_MESSAGE_CONTROL4(IndexedDBHostMsg_CursorAdvance, - int32, /* ipc_cursor_id */ - int32, /* ipc_thread_id */ - int32, /* ipc_callbacks_id */ - unsigned long) /* count */ + int32, /* ipc_cursor_id */ + int32, /* ipc_thread_id */ + int32, /* ipc_callbacks_id */ + uint32) /* count */ // WebIDBCursor::continue() message. IPC_MESSAGE_CONTROL5(IndexedDBHostMsg_CursorContinue, diff --git a/content/common/indexed_db/indexed_db_param_traits.h b/content/common/indexed_db/indexed_db_param_traits.h index 9d684a40d02b..c091c3a8e893 100644 --- a/content/common/indexed_db/indexed_db_param_traits.h +++ b/content/common/indexed_db/indexed_db_param_traits.h @@ -5,6 +5,8 @@ #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_PARAM_TRAITS_H_ #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_PARAM_TRAITS_H_ +#include + #include "ipc/ipc_message.h" #include "ipc/ipc_param_traits.h" @@ -40,6 +42,6 @@ struct ParamTraits { static void Log(const param_type& p, std::string* l); }; -} // namespace IPC +} // namespace IPC #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_PARAM_TRAITS_H_ -- 2.11.4.GIT