diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-28 07:04:36 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-28 07:04:36 +0000 |
commit | e0ffc6f888aff5ee5d95c5049f182aaa27105b82 (patch) | |
tree | 497a28909a6fca306b48d0e548c1b7dcd41d689a | |
parent | 49dd0c40f7201e621f0bbf2d958e180fdeb57422 (diff) | |
download | chromium_src-e0ffc6f888aff5ee5d95c5049f182aaa27105b82.zip chromium_src-e0ffc6f888aff5ee5d95c5049f182aaa27105b82.tar.gz chromium_src-e0ffc6f888aff5ee5d95c5049f182aaa27105b82.tar.bz2 |
RefCounted types should not have public destructors, webkit/
BUG=123295
TEST=none
Review URL: http://codereview.chromium.org/10066044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134449 0039d316-1c4b-4281-b951-d872f2087c98
47 files changed, 481 insertions, 231 deletions
diff --git a/webkit/appcache/appcache_database_unittest.cc b/webkit/appcache/appcache_database_unittest.cc index e147850..5ac85d5 100644 --- a/webkit/appcache/appcache_database_unittest.cc +++ b/webkit/appcache/appcache_database_unittest.cc @@ -20,11 +20,14 @@ const base::Time kZeroTime; class TestErrorDelegate : public sql::ErrorDelegate { public: - virtual ~TestErrorDelegate() { } - virtual int OnError( - int error, sql::Connection* connection, sql::Statement* stmt) { + virtual int OnError(int error, + sql::Connection* connection, + sql::Statement* stmt) OVERRIDE { return error; } + + private: + virtual ~TestErrorDelegate() {} }; } // namespace diff --git a/webkit/appcache/appcache_host_unittest.cc b/webkit/appcache/appcache_host_unittest.cc index a5b98a2..fd4a3f3 100644 --- a/webkit/appcache/appcache_host_unittest.cc +++ b/webkit/appcache/appcache_host_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -117,6 +117,9 @@ class AppCacheHostTest : public testing::Test { // Map from origin to count of inuse notifications. std::map<GURL, int> inuse_; + + protected: + virtual ~MockQuotaManagerProxy() {} }; void GetStatusCallback(Status status, void* param) { diff --git a/webkit/appcache/appcache_request_handler_unittest.cc b/webkit/appcache/appcache_request_handler_unittest.cc index 37b7bd1..98f41a8 100644 --- a/webkit/appcache/appcache_request_handler_unittest.cc +++ b/webkit/appcache/appcache_request_handler_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -72,28 +72,34 @@ class AppCacheRequestHandlerTest : public testing::Test { class MockURLRequestJob : public net::URLRequestJob { public: - MockURLRequestJob( - net::URLRequest* request, int response_code) + MockURLRequestJob(net::URLRequest* request, + int response_code) : net::URLRequestJob(request), response_code_(response_code), has_response_info_(false) {} - MockURLRequestJob( - net::URLRequest* request, const net::HttpResponseInfo& info) + MockURLRequestJob(net::URLRequest* request, + const net::HttpResponseInfo& info) : net::URLRequestJob(request), response_code_(info.headers->response_code()), has_response_info_(true), response_info_(info) {} - virtual void Start() { + + protected: + virtual ~MockURLRequestJob() {} + virtual void Start() OVERRIDE { NotifyHeadersComplete(); } - virtual int GetResponseCode() const { + virtual int GetResponseCode() const OVERRIDE { return response_code_; } - virtual void GetResponseInfo(net::HttpResponseInfo* info) { + virtual void GetResponseInfo( + net::HttpResponseInfo* info) OVERRIDE { if (!has_response_info_) return; *info = response_info_; } + + private: int response_code_; bool has_response_info_; net::HttpResponseInfo response_info_; diff --git a/webkit/appcache/appcache_service.h b/webkit/appcache/appcache_service.h index f1f8c0b..a94e12b 100644 --- a/webkit/appcache/appcache_service.h +++ b/webkit/appcache/appcache_service.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -43,9 +43,12 @@ class AppCachePolicy; struct APPCACHE_EXPORT AppCacheInfoCollection : public base::RefCountedThreadSafe<AppCacheInfoCollection> { AppCacheInfoCollection(); - virtual ~AppCacheInfoCollection(); std::map<GURL, AppCacheInfoVector> infos_by_origin; + + private: + friend class base::RefCountedThreadSafe<AppCacheInfoCollection>; + virtual ~AppCacheInfoCollection(); }; // Class that manages the application cache service. Sends notifications diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc index 99f731e..3a01390 100644 --- a/webkit/appcache/appcache_storage_impl.cc +++ b/webkit/appcache/appcache_storage_impl.cc @@ -148,8 +148,6 @@ class AppCacheStorageImpl::DatabaseTask DCHECK(io_thread_); } - virtual ~DatabaseTask() {} - void AddDelegate(DelegateReference* delegate_reference) { delegates_.push_back(make_scoped_refptr(delegate_reference)); } @@ -175,6 +173,9 @@ class AppCacheStorageImpl::DatabaseTask virtual void CancelCompletion(); protected: + friend class base::RefCountedThreadSafe<DatabaseTask>; + virtual ~DatabaseTask() {} + AppCacheStorageImpl* storage_; AppCacheDatabase* database_; DelegateReferenceVector delegates_; @@ -258,9 +259,14 @@ class AppCacheStorageImpl::InitTask : public DatabaseTask { last_cache_id_(0), last_response_id_(0), last_deletable_response_rowid_(0) {} - virtual void Run(); - virtual void RunCompleted(); + // DatabaseTask: + virtual void Run() OVERRIDE; + virtual void RunCompleted() OVERRIDE; + + protected: + virtual ~InitTask() {} + private: int64 last_group_id_; int64 last_cache_id_; int64 last_response_id_; @@ -302,7 +308,11 @@ class AppCacheStorageImpl::CloseConnectionTask : public DatabaseTask { explicit CloseConnectionTask(AppCacheStorageImpl* storage) : DatabaseTask(storage) {} - virtual void Run() { database_->CloseConnection(); } + // DatabaseTask: + virtual void Run() OVERRIDE { database_->CloseConnection(); } + + protected: + virtual ~CloseConnectionTask() {} }; // DisableDatabaseTask ------- @@ -312,7 +322,11 @@ class AppCacheStorageImpl::DisableDatabaseTask : public DatabaseTask { explicit DisableDatabaseTask(AppCacheStorageImpl* storage) : DatabaseTask(storage) {} - virtual void Run() { database_->Disable(); } + // DatabaseTask: + virtual void Run() OVERRIDE { database_->Disable(); } + + protected: + virtual ~DisableDatabaseTask() {} }; // GetAllInfoTask ------- @@ -324,9 +338,14 @@ class AppCacheStorageImpl::GetAllInfoTask : public DatabaseTask { info_collection_(new AppCacheInfoCollection()) { } - virtual void Run(); - virtual void RunCompleted(); + // DatabaseTask: + virtual void Run() OVERRIDE; + virtual void RunCompleted() OVERRIDE; + + protected: + virtual ~GetAllInfoTask() {} + private: scoped_refptr<AppCacheInfoCollection> info_collection_; }; @@ -369,6 +388,7 @@ class AppCacheStorageImpl::StoreOrLoadTask : public DatabaseTask { protected: explicit StoreOrLoadTask(AppCacheStorageImpl* storage) : DatabaseTask(storage) {} + virtual ~StoreOrLoadTask() {} bool FindRelatedCacheRecords(int64 cache_id); void CreateCacheAndGroupFromRecords( @@ -453,9 +473,14 @@ class AppCacheStorageImpl::CacheLoadTask : public StoreOrLoadTask { : StoreOrLoadTask(storage), cache_id_(cache_id), success_(false) {} - virtual void Run(); - virtual void RunCompleted(); + // DatabaseTask: + virtual void Run() OVERRIDE; + virtual void RunCompleted() OVERRIDE; + + protected: + virtual ~CacheLoadTask() {} + private: int64 cache_id_; bool success_; }; @@ -490,9 +515,14 @@ class AppCacheStorageImpl::GroupLoadTask : public StoreOrLoadTask { : StoreOrLoadTask(storage), manifest_url_(manifest_url), success_(false) {} - virtual void Run(); - virtual void RunCompleted(); + // DatabaseTask: + virtual void Run() OVERRIDE; + virtual void RunCompleted() OVERRIDE; + + protected: + virtual ~GroupLoadTask() {} + private: GURL manifest_url_; bool success_; }; @@ -538,10 +568,15 @@ class AppCacheStorageImpl::StoreGroupAndCacheTask : public StoreOrLoadTask { void OnQuotaCallback( quota::QuotaStatusCode status, int64 usage, int64 quota); - virtual void Run(); - virtual void RunCompleted(); - virtual void CancelCompletion(); + // DatabaseTask: + virtual void Run() OVERRIDE; + virtual void RunCompleted() OVERRIDE; + virtual void CancelCompletion() OVERRIDE; + protected: + virtual ~StoreGroupAndCacheTask() {} + + private: scoped_refptr<AppCacheGroup> group_; scoped_refptr<AppCache> cache_; bool success_; @@ -832,12 +867,17 @@ class AppCacheStorageImpl::FindMainResponseTask : public DatabaseTask { } } - virtual void Run(); - virtual void RunCompleted(); + // DatabaseTask: + virtual void Run() OVERRIDE; + virtual void RunCompleted() OVERRIDE; + + protected: + virtual ~FindMainResponseTask() {} private: typedef std::vector<AppCacheDatabase::NamespaceRecord*> NamespaceRecordPtrVector; + bool FindExactMatch(int64 preferred_id); bool FindNamespaceMatch(int64 preferred_id); bool FindNamespaceHelper( @@ -1030,9 +1070,14 @@ class AppCacheStorageImpl::MarkEntryAsForeignTask : public DatabaseTask { AppCacheStorageImpl* storage, const GURL& url, int64 cache_id) : DatabaseTask(storage), cache_id_(cache_id), entry_url_(url) {} - virtual void Run(); - virtual void RunCompleted(); + // DatabaseTask: + virtual void Run() OVERRIDE; + virtual void RunCompleted() OVERRIDE; + protected: + virtual ~MarkEntryAsForeignTask() {} + + private: int64 cache_id_; GURL entry_url_; }; @@ -1053,10 +1098,15 @@ class AppCacheStorageImpl::MakeGroupObsoleteTask : public DatabaseTask { public: MakeGroupObsoleteTask(AppCacheStorageImpl* storage, AppCacheGroup* group); - virtual void Run(); - virtual void RunCompleted(); - virtual void CancelCompletion(); + // DatabaseTask: + virtual void Run() OVERRIDE; + virtual void RunCompleted() OVERRIDE; + virtual void CancelCompletion() OVERRIDE; + + protected: + virtual ~MakeGroupObsoleteTask() {} + private: scoped_refptr<AppCacheGroup> group_; int64 group_id_; GURL origin_; @@ -1130,9 +1180,14 @@ class AppCacheStorageImpl::GetDeletableResponseIdsTask : public DatabaseTask { GetDeletableResponseIdsTask(AppCacheStorageImpl* storage, int64 max_rowid) : DatabaseTask(storage), max_rowid_(max_rowid) {} - virtual void Run(); - virtual void RunCompleted(); + // DatabaseTask: + virtual void Run() OVERRIDE; + virtual void RunCompleted() OVERRIDE; + + protected: + virtual ~GetDeletableResponseIdsTask() {} + private: int64 max_rowid_; std::vector<int64> response_ids_; }; @@ -1155,8 +1210,14 @@ class AppCacheStorageImpl::InsertDeletableResponseIdsTask public: explicit InsertDeletableResponseIdsTask(AppCacheStorageImpl* storage) : DatabaseTask(storage) {} - virtual void Run(); + + // DatabaseTask: + virtual void Run() OVERRIDE; + std::vector<int64> response_ids_; + + protected: + virtual ~InsertDeletableResponseIdsTask() {} }; void AppCacheStorageImpl::InsertDeletableResponseIdsTask::Run() { @@ -1171,8 +1232,14 @@ class AppCacheStorageImpl::DeleteDeletableResponseIdsTask public: explicit DeleteDeletableResponseIdsTask(AppCacheStorageImpl* storage) : DatabaseTask(storage) {} - virtual void Run(); + + // DatabaseTask: + virtual void Run() OVERRIDE; + std::vector<int64> response_ids_; + + protected: + virtual ~DeleteDeletableResponseIdsTask() {} }; void AppCacheStorageImpl::DeleteDeletableResponseIdsTask::Run() { @@ -1191,8 +1258,13 @@ class AppCacheStorageImpl::UpdateGroupLastAccessTimeTask storage->NotifyStorageAccessed(group->manifest_url().GetOrigin()); } - virtual void Run(); + // DatabaseTask: + virtual void Run() OVERRIDE; + protected: + virtual ~UpdateGroupLastAccessTimeTask() {} + + private: int64 group_id_; base::Time last_access_time_; }; diff --git a/webkit/appcache/appcache_storage_impl_unittest.cc b/webkit/appcache/appcache_storage_impl_unittest.cc index 5521e61..c8b86e5 100644 --- a/webkit/appcache/appcache_storage_impl_unittest.cc +++ b/webkit/appcache/appcache_storage_impl_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -157,6 +157,9 @@ class AppCacheStorageImplTest : public testing::Test { } bool async_; + + protected: + virtual ~MockQuotaManager() {} }; class MockQuotaManagerProxy : public quota::QuotaManagerProxy { @@ -200,6 +203,9 @@ class AppCacheStorageImplTest : public testing::Test { GURL last_origin_; int last_delta_; scoped_refptr<MockQuotaManager> mock_manager_; + + protected: + virtual ~MockQuotaManagerProxy() {} }; template <class Method> diff --git a/webkit/appcache/appcache_storage_unittest.cc b/webkit/appcache/appcache_storage_unittest.cc index 82e3b99..8021e30 100644 --- a/webkit/appcache/appcache_storage_unittest.cc +++ b/webkit/appcache/appcache_storage_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -24,11 +24,12 @@ class AppCacheStorageTest : public testing::Test { : QuotaManagerProxy(NULL, NULL), notify_storage_accessed_count_(0), notify_storage_modified_count_(0), - last_delta_(0) {} + last_delta_(0) { + } virtual void NotifyStorageAccessed(quota::QuotaClient::ID client_id, const GURL& origin, - quota::StorageType type) { + quota::StorageType type) OVERRIDE { EXPECT_EQ(quota::QuotaClient::kAppcache, client_id); EXPECT_EQ(quota::kStorageTypeTemporary, type); ++notify_storage_accessed_count_; @@ -38,7 +39,7 @@ class AppCacheStorageTest : public testing::Test { virtual void NotifyStorageModified(quota::QuotaClient::ID client_id, const GURL& origin, quota::StorageType type, - int64 delta) { + int64 delta) OVERRIDE { EXPECT_EQ(quota::QuotaClient::kAppcache, client_id); EXPECT_EQ(quota::kStorageTypeTemporary, type); ++notify_storage_modified_count_; @@ -47,14 +48,17 @@ class AppCacheStorageTest : public testing::Test { } // Not needed for our tests. - virtual void RegisterClient(quota::QuotaClient* client) {} - virtual void NotifyOriginInUse(const GURL& origin) {} - virtual void NotifyOriginNoLongerInUse(const GURL& origin) {} + virtual void RegisterClient(quota::QuotaClient* client) OVERRIDE {} + virtual void NotifyOriginInUse(const GURL& origin) OVERRIDE {} + virtual void NotifyOriginNoLongerInUse(const GURL& origin) OVERRIDE {} int notify_storage_accessed_count_; int notify_storage_modified_count_; GURL last_origin_; int last_delta_; + + protected: + virtual ~MockQuotaManagerProxy() {} }; }; diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index 3bb3f03b..bb26d65 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -500,6 +500,9 @@ class HttpHeadersRequestTestJob : public net::URLRequestTestJob { return MockHttpServer::JobFactory(request); } + protected: + virtual ~HttpHeadersRequestTestJob() {} + private: static std::string expect_if_modified_since_; static bool saw_if_modified_since_; diff --git a/webkit/appcache/appcache_url_request_job.cc b/webkit/appcache/appcache_url_request_job.cc index 7d17909..9b0ee73 100644 --- a/webkit/appcache/appcache_url_request_job.cc +++ b/webkit/appcache/appcache_url_request_job.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -34,11 +34,6 @@ AppCacheURLRequestJob::AppCacheURLRequestJob( DCHECK(storage_); } -AppCacheURLRequestJob::~AppCacheURLRequestJob() { - if (storage_) - storage_->CancelDelegateCallbacks(this); -} - void AppCacheURLRequestJob::DeliverAppCachedResponse( const GURL& manifest_url, int64 group_id, int64 cache_id, const AppCacheEntry& entry, bool is_fallback) { @@ -116,6 +111,11 @@ void AppCacheURLRequestJob::BeginDelivery() { } } +AppCacheURLRequestJob::~AppCacheURLRequestJob() { + if (storage_) + storage_->CancelDelegateCallbacks(this); +} + void AppCacheURLRequestJob::OnResponseInfoLoaded( AppCacheResponseInfo* response_info, int64 response_id) { DCHECK(is_delivering_appcache_response()); diff --git a/webkit/appcache/appcache_url_request_job.h b/webkit/appcache/appcache_url_request_job.h index 25b0cf6..2e11abc 100644 --- a/webkit/appcache/appcache_url_request_job.h +++ b/webkit/appcache/appcache_url_request_job.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,7 +23,6 @@ class APPCACHE_EXPORT AppCacheURLRequestJob : public net::URLRequestJob, public AppCacheStorage::Delegate { public: AppCacheURLRequestJob(net::URLRequest* request, AppCacheStorage* storage); - virtual ~AppCacheURLRequestJob(); // Informs the job of what response it should deliver. Only one of these // methods should be called, and only once per job. A job will sit idle and @@ -77,6 +76,9 @@ class APPCACHE_EXPORT AppCacheURLRequestJob : public net::URLRequestJob, return cache_entry_not_found_; } + protected: + virtual ~AppCacheURLRequestJob(); + private: friend class AppCacheRequestHandlerTest; friend class AppCacheURLRequestJobTest; diff --git a/webkit/appcache/view_appcache_internals_job.cc b/webkit/appcache/view_appcache_internals_job.cc index db1fa54..3c043ba 100644 --- a/webkit/appcache/view_appcache_internals_job.cc +++ b/webkit/appcache/view_appcache_internals_job.cc @@ -312,6 +312,7 @@ class BaseInternalsJob : public net::URLRequestSimpleJob { protected: BaseInternalsJob(net::URLRequest* request, AppCacheService* service) : URLRequestSimpleJob(request), appcache_service_(service) {} + virtual ~BaseInternalsJob() {} AppCacheService* appcache_service_; }; @@ -394,6 +395,9 @@ class RedirectToMainPageJob : public BaseInternalsJob { *http_status_code = 307; return true; } + + protected: + virtual ~RedirectToMainPageJob() {} }; // Job that removes an appcache and then redirects back to the main page. diff --git a/webkit/blob/blob_url_request_job.cc b/webkit/blob/blob_url_request_job.cc index 65f8e08..6f8ef92 100644 --- a/webkit/blob/blob_url_request_job.cc +++ b/webkit/blob/blob_url_request_job.cc @@ -64,10 +64,6 @@ BlobURLRequestJob::BlobURLRequestJob( DCHECK(file_thread_proxy_); } -BlobURLRequestJob::~BlobURLRequestJob() { - STLDeleteValues(&index_to_reader_); -} - void BlobURLRequestJob::Start() { // Continue asynchronously. MessageLoop::current()->PostTask( @@ -151,6 +147,10 @@ void BlobURLRequestJob::SetExtraRequestHeaders( } } +BlobURLRequestJob::~BlobURLRequestJob() { + STLDeleteValues(&index_to_reader_); +} + void BlobURLRequestJob::DidStart() { // We only support GET request per the spec. if (request()->method() != "GET") { diff --git a/webkit/blob/blob_url_request_job.h b/webkit/blob/blob_url_request_job.h index 1df2619..436d0a9 100644 --- a/webkit/blob/blob_url_request_job.h +++ b/webkit/blob/blob_url_request_job.h @@ -34,7 +34,6 @@ class BLOB_EXPORT BlobURLRequestJob : public net::URLRequestJob { BlobURLRequestJob(net::URLRequest* request, BlobData* blob_data, base::MessageLoopProxy* resolving_message_loop_proxy); - virtual ~BlobURLRequestJob(); // net::URLRequestJob methods. virtual void Start() OVERRIDE; @@ -48,6 +47,9 @@ class BLOB_EXPORT BlobURLRequestJob : public net::URLRequestJob { virtual void SetExtraRequestHeaders( const net::HttpRequestHeaders& headers) OVERRIDE; + protected: + virtual ~BlobURLRequestJob(); + private: typedef std::map<size_t, LocalFileReader*> IndexToReaderMap; diff --git a/webkit/database/database_quota_client.cc b/webkit/database/database_quota_client.cc index f38eb3d3..4d963be 100644 --- a/webkit/database/database_quota_client.cc +++ b/webkit/database/database_quota_client.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -32,6 +32,8 @@ class DatabaseQuotaClient::HelperTask : public quota::QuotaThreadTask { client_(client), db_tracker_(client->db_tracker_) { } + virtual ~HelperTask() {} + DatabaseQuotaClient* client_; scoped_refptr<DatabaseTracker> db_tracker_; }; @@ -46,7 +48,9 @@ class DatabaseQuotaClient::GetOriginUsageTask : public HelperTask { origin_url_(origin_url), usage_(0) { } - private: + protected: + virtual ~GetOriginUsageTask() {} + virtual void RunOnTargetThread() OVERRIDE { OriginInfo info; if (db_tracker_->GetOriginInfo( @@ -55,9 +59,12 @@ class DatabaseQuotaClient::GetOriginUsageTask : public HelperTask { usage_ = info.TotalSize(); } } + virtual void Completed() OVERRIDE { client_->DidGetOriginUsage(origin_url_, usage_); } + + private: GURL origin_url_; int64 usage_; }; @@ -70,6 +77,8 @@ class DatabaseQuotaClient::GetOriginsTaskBase : public HelperTask { : HelperTask(client, db_tracker_thread) { } + virtual ~GetOriginsTaskBase() {} + virtual bool ShouldAddOrigin(const GURL& origin) = 0; virtual void RunOnTargetThread() OVERRIDE { @@ -99,6 +108,8 @@ class DatabaseQuotaClient::GetAllOriginsTask : public GetOriginsTaskBase { } protected: + virtual ~GetAllOriginsTask() {} + virtual bool ShouldAddOrigin(const GURL& origin) OVERRIDE { return true; } @@ -122,13 +133,18 @@ class DatabaseQuotaClient::GetOriginsForHostTask : public GetOriginsTaskBase { type_(type) { } - private: + protected: + virtual ~GetOriginsForHostTask() {} + virtual bool ShouldAddOrigin(const GURL& origin) OVERRIDE { return host_ == net::GetHostOrSpecFromURL(origin); } + virtual void Completed() OVERRIDE { client_->DidGetOriginsForHost(host_, origins_, type_); } + + private: std::string host_; quota::StorageType type_; }; @@ -146,7 +162,9 @@ class DatabaseQuotaClient::DeleteOriginTask : public HelperTask { caller_callback_(caller_callback) { } - private: + protected: + virtual ~DeleteOriginTask() {} + virtual void Completed() OVERRIDE { if (caller_callback_.is_null()) return; @@ -170,6 +188,7 @@ class DatabaseQuotaClient::DeleteOriginTask : public HelperTask { return false; } + private: void OnCompletionCallback(int rv) { if (rv == net::OK) result_ = quota::kQuotaStatusOk; diff --git a/webkit/database/database_quota_client_unittest.cc b/webkit/database/database_quota_client_unittest.cc index ee62722..0a178f1 100644 --- a/webkit/database/database_quota_client_unittest.cc +++ b/webkit/database/database_quota_client_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -31,8 +31,6 @@ class MockDatabaseTracker : public DatabaseTracker { delete_called_count_(0), async_delete_(false) {} - virtual ~MockDatabaseTracker() {} - virtual bool GetOriginInfo( const string16& origin_identifier, OriginInfo* info) OVERRIDE { @@ -95,6 +93,9 @@ class MockDatabaseTracker : public DatabaseTracker { bool async_delete() { return async_delete_; } void set_async_delete(bool async) { async_delete_ = async; } + protected: + virtual ~MockDatabaseTracker() {} + private: class MockOriginInfo : public OriginInfo { public: diff --git a/webkit/database/database_tracker_unittest.cc b/webkit/database/database_tracker_unittest.cc index 14d72a8..4902c72 100644 --- a/webkit/database/database_tracker_unittest.cc +++ b/webkit/database/database_tracker_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -94,10 +94,6 @@ class TestQuotaManagerProxy : public quota::QuotaManagerProxy { registered_client_(NULL) { } - virtual ~TestQuotaManagerProxy() { - EXPECT_FALSE(registered_client_); - } - virtual void RegisterClient(quota::QuotaClient* client) { EXPECT_FALSE(registered_client_); registered_client_ = client; @@ -153,6 +149,11 @@ class TestQuotaManagerProxy : public quota::QuotaManagerProxy { // Map from origin to <count, sum of deltas> std::map<GURL, std::pair<int, int64> > modifications_; + + protected: + virtual ~TestQuotaManagerProxy() { + EXPECT_FALSE(registered_client_); + } }; diff --git a/webkit/database/databases_table_unittest.cc b/webkit/database/databases_table_unittest.cc index da22440..62b56ca 100644 --- a/webkit/database/databases_table_unittest.cc +++ b/webkit/database/databases_table_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,11 +13,14 @@ namespace { class TestErrorDelegate : public sql::ErrorDelegate { public: - virtual ~TestErrorDelegate() { } - virtual int OnError( - int error, sql::Connection* connection, sql::Statement* stmt) { + virtual int OnError(int error, + sql::Connection* connection, + sql::Statement* stmt) OVERRIDE { return error; } + + protected: + virtual ~TestErrorDelegate() {} }; } // namespace diff --git a/webkit/database/quota_table_unittest.cc b/webkit/database/quota_table_unittest.cc index 492c7b9..be25898 100644 --- a/webkit/database/quota_table_unittest.cc +++ b/webkit/database/quota_table_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,11 +13,14 @@ namespace { class TestErrorDelegate : public sql::ErrorDelegate { public: - virtual ~TestErrorDelegate() { } - virtual int OnError( - int error, sql::Connection* connection, sql::Statement* stmt) { + virtual int OnError(int error, + sql::Connection* connection, + sql::Statement* stmt) OVERRIDE { return error; } + + protected: + virtual ~TestErrorDelegate() {} }; } // namespace diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc index e64f497..f0c596e 100644 --- a/webkit/fileapi/file_system_context.cc +++ b/webkit/fileapi/file_system_context.cc @@ -70,9 +70,6 @@ FileSystemContext::FileSystemContext( #endif } -FileSystemContext::~FileSystemContext() { -} - bool FileSystemContext::DeleteDataForOriginOnFileThread( const GURL& origin_url) { DCHECK(file_message_loop_->BelongsToCurrentThread()); @@ -144,14 +141,6 @@ FileSystemContext::external_provider() const { return external_provider_.get(); } -void FileSystemContext::DeleteOnCorrectThread() const { - if (!io_message_loop_->BelongsToCurrentThread() && - io_message_loop_->DeleteSoon(FROM_HERE, this)) { - return; - } - delete this; -} - void FileSystemContext::OpenFileSystem( const GURL& origin_url, FileSystemType type, @@ -206,4 +195,14 @@ webkit_blob::FileReader* FileSystemContext::CreateFileReader( return mount_point_provider->CreateFileReader(url, offset, file_proxy, this); } +FileSystemContext::~FileSystemContext() {} + +void FileSystemContext::DeleteOnCorrectThread() const { + if (!io_message_loop_->BelongsToCurrentThread() && + io_message_loop_->DeleteSoon(FROM_HERE, this)) { + return; + } + delete this; +} + } // namespace fileapi diff --git a/webkit/fileapi/file_system_context.h b/webkit/fileapi/file_system_context.h index d72a3ca..6c43037 100644 --- a/webkit/fileapi/file_system_context.h +++ b/webkit/fileapi/file_system_context.h @@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/platform_file.h" +#include "base/sequenced_task_runner_helpers.h" #include "webkit/fileapi/file_system_types.h" #include "webkit/quota/special_storage_policy.h" @@ -56,7 +57,6 @@ class FileSystemContext quota::QuotaManagerProxy* quota_manager_proxy, const FilePath& profile_path, const FileSystemOptions& options); - ~FileSystemContext(); // This method can be called on any thread. bool DeleteDataForOriginOnFileThread(const GURL& origin_url); @@ -131,6 +131,9 @@ class FileSystemContext private: friend struct DefaultContextDeleter; + friend class base::DeleteHelper<FileSystemContext>; + ~FileSystemContext(); + void DeleteOnCorrectThread() const; scoped_refptr<base::MessageLoopProxy> file_message_loop_; diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc index 20bf577..9eabd5e 100644 --- a/webkit/fileapi/file_system_operation_unittest.cc +++ b/webkit/fileapi/file_system_operation_unittest.cc @@ -62,8 +62,12 @@ class MockQuotaManager : public QuotaManager { callback.Run(quota::kQuotaStatusOk, usage_, quota_); } + protected: + virtual ~MockQuotaManager() {} + private: friend class MockQuotaManagerProxy; + void SetQuota(const GURL& origin, StorageType type, int64 quota) { EXPECT_EQ(origin_, origin); EXPECT_EQ(type_, type); @@ -97,10 +101,6 @@ class MockQuotaManagerProxy : public QuotaManagerProxy { registered_client_(NULL) { } - virtual ~MockQuotaManagerProxy() { - EXPECT_FALSE(registered_client_); - } - virtual void RegisterClient(QuotaClient* client) OVERRIDE { EXPECT_FALSE(registered_client_); registered_client_ = client; @@ -140,10 +140,16 @@ class MockQuotaManagerProxy : public QuotaManagerProxy { mock_manager()->SetQuota(origin, type, quota); } + protected: + virtual ~MockQuotaManagerProxy() { + EXPECT_FALSE(registered_client_); + } + private: MockQuotaManager* mock_manager() const { return static_cast<MockQuotaManager*>(quota_manager()); } + QuotaClient* registered_client_; }; diff --git a/webkit/fileapi/file_system_operation_write_unittest.cc b/webkit/fileapi/file_system_operation_write_unittest.cc index cf26cbc..5ba14c5 100644 --- a/webkit/fileapi/file_system_operation_write_unittest.cc +++ b/webkit/fileapi/file_system_operation_write_unittest.cc @@ -57,12 +57,15 @@ class MockQuotaManager : public QuotaManager { void set_usage(int64 usage) { usage_ = usage; } void set_quota(int64 quota) { quota_ = quota; } + protected: + virtual ~MockQuotaManager() {} + private: int64 usage_; int64 quota_; }; -} // namespace (anonymous) +} // namespace class FileSystemOperationWriteTest : public testing::Test, @@ -151,12 +154,13 @@ class TestURLRequestContext : public net::URLRequestContext { TestURLRequestContext() : blob_storage_controller_(new webkit_blob::BlobStorageController) {} - virtual ~TestURLRequestContext() {} - webkit_blob::BlobStorageController* blob_storage_controller() const { return blob_storage_controller_.get(); } + protected: + virtual ~TestURLRequestContext() {} + private: scoped_ptr<webkit_blob::BlobStorageController> blob_storage_controller_; }; diff --git a/webkit/fileapi/file_system_quota_client.cc b/webkit/fileapi/file_system_quota_client.cc index bb86fd9..d0a1ccc 100644 --- a/webkit/fileapi/file_system_quota_client.cc +++ b/webkit/fileapi/file_system_quota_client.cc @@ -41,9 +41,10 @@ class FileSystemQuotaClient::GetOriginUsageTask : public QuotaThreadTask { file_system_context_ = quota_client_->file_system_context_; } + protected: virtual ~GetOriginUsageTask() {} - protected: + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { FileSystemQuotaUtil* quota_util = file_system_context_->GetQuotaUtil(type_); if (quota_util) @@ -73,9 +74,11 @@ class FileSystemQuotaClient::GetOriginsForTypeTask : public QuotaThreadTask { DCHECK(quota_client_); file_system_context_ = quota_client_->file_system_context_; } - virtual ~GetOriginsForTypeTask() {} protected: + virtual ~GetOriginsForTypeTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { FileSystemQuotaUtil* quota_util = file_system_context_->GetQuotaUtil(type_); if (quota_util) @@ -107,9 +110,11 @@ class FileSystemQuotaClient::GetOriginsForHostTask : public QuotaThreadTask { DCHECK(quota_client_); file_system_context_ = quota_client_->file_system_context_; } - virtual ~GetOriginsForHostTask() {} protected: + virtual ~GetOriginsForHostTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { FileSystemQuotaUtil* quota_util = file_system_context_->GetQuotaUtil(type_); if (quota_util) @@ -145,8 +150,10 @@ class FileSystemQuotaClient::DeleteOriginTask callback_(callback) { } + protected: virtual ~DeleteOriginTask() {} + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (file_system_context_->DeleteDataForOriginAndTypeOnFileThread( origin_, type_)) @@ -158,6 +165,7 @@ class FileSystemQuotaClient::DeleteOriginTask virtual void Completed() OVERRIDE { callback_.Run(status_); } + private: FileSystemContext* file_system_context_; GURL origin_; @@ -176,8 +184,7 @@ FileSystemQuotaClient::FileSystemQuotaClient( DCHECK(file_message_loop); } -FileSystemQuotaClient::~FileSystemQuotaClient() { -} +FileSystemQuotaClient::~FileSystemQuotaClient() {} quota::QuotaClient::ID FileSystemQuotaClient::id() const { return quota::QuotaClient::kFileSystem; diff --git a/webkit/fileapi/file_writer_delegate.cc b/webkit/fileapi/file_writer_delegate.cc index a5da1c6..d92684b 100644 --- a/webkit/fileapi/file_writer_delegate.cc +++ b/webkit/fileapi/file_writer_delegate.cc @@ -52,6 +52,7 @@ class InitializeTask : public base::RefCountedThreadSafe<InitializeTask> { private: friend class base::RefCountedThreadSafe<InitializeTask>; + ~InitializeTask() {} void RunCallback() { callback_.Run(error_code_, file_info_); diff --git a/webkit/fileapi/file_writer_delegate_unittest.cc b/webkit/fileapi/file_writer_delegate_unittest.cc index 82ac10b..24a85cb 100644 --- a/webkit/fileapi/file_writer_delegate_unittest.cc +++ b/webkit/fileapi/file_writer_delegate_unittest.cc @@ -158,8 +158,9 @@ class FileWriterDelegateTestJob : public net::URLRequestJob { base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this)); } - virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read) - OVERRIDE { + virtual bool ReadRawData(net::IOBuffer* buf, + int buf_size, + int *bytes_read) OVERRIDE { if (remaining_bytes_ < buf_size) buf_size = static_cast<int>(remaining_bytes_); @@ -176,6 +177,9 @@ class FileWriterDelegateTestJob : public net::URLRequestJob { return 200; } + protected: + virtual ~FileWriterDelegateTestJob() {} + private: std::string content_; int remaining_bytes_; diff --git a/webkit/fileapi/obfuscated_file_util.cc b/webkit/fileapi/obfuscated_file_util.cc index 519afb4..2fe4c0f 100644 --- a/webkit/fileapi/obfuscated_file_util.cc +++ b/webkit/fileapi/obfuscated_file_util.cc @@ -271,10 +271,6 @@ ObfuscatedFileUtil::ObfuscatedFileUtil( file_system_directory_(file_system_directory) { } -ObfuscatedFileUtil::~ObfuscatedFileUtil() { - DropDatabases(); -} - PlatformFileError ObfuscatedFileUtil::CreateOrOpen( FileSystemOperationContext* context, const FileSystemPath& virtual_path, int file_flags, @@ -1006,6 +1002,10 @@ int64 ObfuscatedFileUtil::ComputeFilePathCost(const FilePath& path) { return UsageForPath(VirtualPath::BaseName(path).value().size()); } +ObfuscatedFileUtil::~ObfuscatedFileUtil() { + DropDatabases(); +} + PlatformFileError ObfuscatedFileUtil::GetFileInfoInternal( FileSystemDirectoryDatabase* db, FileSystemOperationContext* context, diff --git a/webkit/fileapi/obfuscated_file_util.h b/webkit/fileapi/obfuscated_file_util.h index fd7b21a..29fc5ea 100644 --- a/webkit/fileapi/obfuscated_file_util.h +++ b/webkit/fileapi/obfuscated_file_util.h @@ -43,7 +43,8 @@ class FileSystemOperationContext; // SandboxMountPointProvider [and the task it uses to drop the reference] and // SandboxMountPointProvider::GetFileSystemRootPathTask. Without that last one, // we wouldn't need ref counting. -class ObfuscatedFileUtil : public FileSystemFileUtil, +class ObfuscatedFileUtil : + public FileSystemFileUtil, public base::RefCountedThreadSafe<ObfuscatedFileUtil> { public: // Origin enumerator interface. @@ -65,7 +66,6 @@ class ObfuscatedFileUtil : public FileSystemFileUtil, // new ObfuscatedFileUtil(new NativeFileUtil()); ObfuscatedFileUtil(const FilePath& file_system_directory, FileSystemFileUtil* underlying_file_util); - virtual ~ObfuscatedFileUtil(); virtual base::PlatformFileError CreateOrOpen( FileSystemOperationContext* context, @@ -187,9 +187,13 @@ class ObfuscatedFileUtil : public FileSystemFileUtil, static int64 ComputeFilePathCost(const FilePath& path); private: + friend class base::RefCountedThreadSafe<ObfuscatedFileUtil>; + typedef FileSystemDirectoryDatabase::FileId FileId; typedef FileSystemDirectoryDatabase::FileInfo FileInfo; + virtual ~ObfuscatedFileUtil(); + base::PlatformFileError GetFileInfoInternal( FileSystemDirectoryDatabase* db, FileSystemOperationContext* context, diff --git a/webkit/glue/resource_loader_bridge.cc b/webkit/glue/resource_loader_bridge.cc index 91fc25a..6c20f12 100644 --- a/webkit/glue/resource_loader_bridge.cc +++ b/webkit/glue/resource_loader_bridge.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -24,8 +24,7 @@ ResourceLoadTimingInfo::ResourceLoadTimingInfo() receive_headers_end(0) { } -ResourceLoadTimingInfo::~ResourceLoadTimingInfo() { -} +ResourceLoadTimingInfo::~ResourceLoadTimingInfo() {} ResourceDevToolsInfo::ResourceDevToolsInfo() : http_status_code(0) { @@ -45,8 +44,7 @@ ResourceResponseInfo::ResourceResponseInfo() was_fetched_via_proxy(false) { } -ResourceResponseInfo::~ResourceResponseInfo() { -} +ResourceResponseInfo::~ResourceResponseInfo() {} ResourceLoaderBridge::RequestInfo::RequestInfo() : referrer_policy(WebKit::WebReferrerPolicyDefault), @@ -61,19 +59,14 @@ ResourceLoaderBridge::RequestInfo::RequestInfo() extra_data(NULL) { } -ResourceLoaderBridge::RequestInfo::~RequestInfo() { -} +ResourceLoaderBridge::RequestInfo::~RequestInfo() {} -ResourceLoaderBridge::SyncLoadResponse::SyncLoadResponse() { -} +ResourceLoaderBridge::SyncLoadResponse::SyncLoadResponse() {} -ResourceLoaderBridge::SyncLoadResponse::~SyncLoadResponse() { -} +ResourceLoaderBridge::SyncLoadResponse::~SyncLoadResponse() {} -ResourceLoaderBridge::ResourceLoaderBridge() { -} +ResourceLoaderBridge::ResourceLoaderBridge() {} -ResourceLoaderBridge::~ResourceLoaderBridge() { -} +ResourceLoaderBridge::~ResourceLoaderBridge() {} } // namespace webkit_glue diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h index 6037966..a537b1f 100644 --- a/webkit/glue/resource_loader_bridge.h +++ b/webkit/glue/resource_loader_bridge.h @@ -109,7 +109,6 @@ struct ResourceDevToolsInfo : base::RefCounted<ResourceDevToolsInfo> { HeadersVector; WEBKIT_GLUE_EXPORT ResourceDevToolsInfo(); - WEBKIT_GLUE_EXPORT ~ResourceDevToolsInfo(); int32 http_status_code; std::string http_status_text; @@ -117,6 +116,10 @@ struct ResourceDevToolsInfo : base::RefCounted<ResourceDevToolsInfo> { HeadersVector response_headers; std::string request_headers_text; std::string response_headers_text; + + private: + friend class base::RefCounted<ResourceDevToolsInfo>; + WEBKIT_GLUE_EXPORT ~ResourceDevToolsInfo(); }; struct ResourceResponseInfo { diff --git a/webkit/media/buffered_data_source.h b/webkit/media/buffered_data_source.h index 785831e..e092c25 100644 --- a/webkit/media/buffered_data_source.h +++ b/webkit/media/buffered_data_source.h @@ -35,8 +35,6 @@ class BufferedDataSource : public media::DataSource { WebKit::WebFrame* frame, media::MediaLog* media_log); - virtual ~BufferedDataSource(); - // Initialize this object using |url|. This object calls |status_cb| when // initialization has completed. // @@ -73,6 +71,8 @@ class BufferedDataSource : public media::DataSource { virtual void SetBitrate(int bitrate) OVERRIDE; protected: + virtual ~BufferedDataSource(); + // A factory method to create a BufferedResourceLoader based on the read // parameters. We can override this file to object a mock // BufferedResourceLoader for testing. diff --git a/webkit/media/buffered_data_source_unittest.cc b/webkit/media/buffered_data_source_unittest.cc index 6f41127..5cc89da 100644 --- a/webkit/media/buffered_data_source_unittest.cc +++ b/webkit/media/buffered_data_source_unittest.cc @@ -66,6 +66,8 @@ class MockBufferedDataSource : public BufferedDataSource { void set_loading(bool loading) { loading_ = loading; } private: + virtual ~MockBufferedDataSource() {} + // Whether the resource load has starting loading but yet to been cancelled. bool loading_; diff --git a/webkit/plugins/npapi/plugin_lib_unittest.cc b/webkit/plugins/npapi/plugin_lib_unittest.cc index 516c24b..c9283c3 100644 --- a/webkit/plugins/npapi/plugin_lib_unittest.cc +++ b/webkit/plugins/npapi/plugin_lib_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,9 +17,11 @@ namespace npapi { // variable, we can get a crash if no plugin libs were marked as always loaded. class PluginLibTest : public PluginLib { public: - PluginLibTest() : PluginLib(WebPluginInfo(), NULL) { - } + PluginLibTest() : PluginLib(WebPluginInfo(), NULL) {} using PluginLib::Unload; + + protected: + virtual ~PluginLibTest() {} }; TEST(PluginLibLoading, UnloadAllPlugins) { diff --git a/webkit/plugins/npapi/plugin_stream_url.cc b/webkit/plugins/npapi/plugin_stream_url.cc index b7efcdf..abb09ef 100644 --- a/webkit/plugins/npapi/plugin_stream_url.cc +++ b/webkit/plugins/npapi/plugin_stream_url.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -24,12 +24,6 @@ PluginStreamUrl::PluginStreamUrl( id_(resource_id) { } -PluginStreamUrl::~PluginStreamUrl() { - if (instance() && instance()->webplugin()) { - instance()->webplugin()->ResourceClientDeleted(AsResourceClient()); - } -} - bool PluginStreamUrl::Close(NPReason reason) { // Protect the stream against it being destroyed or the whole plugin instance // being destroyed within the destroy stream handler. @@ -44,6 +38,15 @@ WebPluginResourceClient* PluginStreamUrl::AsResourceClient() { return static_cast<WebPluginResourceClient*>(this); } +void PluginStreamUrl::CancelRequest() { + if (id_ > 0) { + if (instance()->webplugin()) { + instance()->webplugin()->CancelResource(id_); + } + id_ = 0; + } +} + void PluginStreamUrl::WillSendRequest(const GURL& url, int http_status_code) { if (notify_needed()) { // If the plugin participates in HTTP url redirect handling then notify it. @@ -119,12 +122,9 @@ int PluginStreamUrl::ResourceId() { return id_; } -void PluginStreamUrl::CancelRequest() { - if (id_ > 0) { - if (instance()->webplugin()) { - instance()->webplugin()->CancelResource(id_); - } - id_ = 0; +PluginStreamUrl::~PluginStreamUrl() { + if (instance() && instance()->webplugin()) { + instance()->webplugin()->ResourceClientDeleted(AsResourceClient()); } } diff --git a/webkit/plugins/npapi/plugin_stream_url.h b/webkit/plugins/npapi/plugin_stream_url.h index 4bf5232..144c2be 100644 --- a/webkit/plugins/npapi/plugin_stream_url.h +++ b/webkit/plugins/npapi/plugin_stream_url.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,20 +27,15 @@ class PluginStreamUrl : public PluginStream, PluginInstance *instance, bool notify_needed, void *notify_data); - virtual ~PluginStreamUrl(); // Stop sending the stream to the client. // Overrides the base Close so we can cancel our fetching the URL if // it is still loading. virtual bool Close(NPReason reason) OVERRIDE; - virtual WebPluginResourceClient* AsResourceClient() OVERRIDE; - virtual void CancelRequest() OVERRIDE; - // // WebPluginResourceClient methods - // virtual void WillSendRequest(const GURL& url, int http_status_code) OVERRIDE; virtual void DidReceiveResponse(const std::string& mime_type, const std::string& headers, @@ -55,6 +50,9 @@ class PluginStreamUrl : public PluginStream, virtual bool IsMultiByteResponseExpected() OVERRIDE; virtual int ResourceId() OVERRIDE; + protected: + virtual ~PluginStreamUrl(); + private: GURL url_; unsigned long id_; diff --git a/webkit/quota/mock_quota_manager.cc b/webkit/quota/mock_quota_manager.cc index bac3fcc..595c43a 100644 --- a/webkit/quota/mock_quota_manager.cc +++ b/webkit/quota/mock_quota_manager.cc @@ -27,9 +27,13 @@ class MockQuotaManager::GetModifiedSinceTask : public QuotaThreadTask { : QuotaThreadTask(manager, manager->io_thread_), origins_(origins), type_(type), - callback_(callback) {} + callback_(callback) { + } protected: + virtual ~GetModifiedSinceTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE {} virtual void Completed() OVERRIDE { @@ -53,9 +57,13 @@ class MockQuotaManager::DeleteOriginDataTask : public QuotaThreadTask { DeleteOriginDataTask(MockQuotaManager* manager, const StatusCallback& callback) : QuotaThreadTask(manager, manager->io_thread_), - callback_(callback) {} + callback_(callback) { + } protected: + virtual ~DeleteOriginDataTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE {} virtual void Completed() OVERRIDE { @@ -95,8 +103,6 @@ MockQuotaManager::MockQuotaManager( special_storage_policy) { } -MockQuotaManager::~MockQuotaManager() {} - bool MockQuotaManager::AddOrigin( const GURL& origin, StorageType type, @@ -155,4 +161,6 @@ void MockQuotaManager::DeleteOriginData( make_scoped_refptr(new DeleteOriginDataTask(this, callback))->Start(); } +MockQuotaManager::~MockQuotaManager() {} + } // namespace quota diff --git a/webkit/quota/mock_quota_manager.h b/webkit/quota/mock_quota_manager.h index 317c476..dac1eff 100644 --- a/webkit/quota/mock_quota_manager.h +++ b/webkit/quota/mock_quota_manager.h @@ -47,8 +47,6 @@ class MockQuotaManager : public QuotaManager { base::MessageLoopProxy* db_thread, SpecialStoragePolicy* special_storage_policy); - virtual ~MockQuotaManager(); - // Adds an origin to the canned list that will be searched through via // GetOriginsModifiedSince. The caller must provide |quota_client_mask| // which specifies the types of QuotaClients this canned origin contains @@ -84,6 +82,9 @@ class MockQuotaManager : public QuotaManager { int quota_client_mask, const StatusCallback& callback) OVERRIDE; + protected: + virtual ~MockQuotaManager(); + private: class GetModifiedSinceTask; class DeleteOriginDataTask; diff --git a/webkit/quota/mock_special_storage_policy.cc b/webkit/quota/mock_special_storage_policy.cc index c7fdb8f..b8203a3 100644 --- a/webkit/quota/mock_special_storage_policy.cc +++ b/webkit/quota/mock_special_storage_policy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,9 +7,8 @@ namespace quota { MockSpecialStoragePolicy::MockSpecialStoragePolicy() - : all_unlimited_(false) {} - -MockSpecialStoragePolicy::~MockSpecialStoragePolicy() {} + : all_unlimited_(false) { +} bool MockSpecialStoragePolicy::IsStorageProtected(const GURL& origin) { return protected_.find(origin) != protected_.end(); @@ -33,4 +32,6 @@ bool MockSpecialStoragePolicy::HasSessionOnlyOrigins() { return !session_only_.empty(); } +MockSpecialStoragePolicy::~MockSpecialStoragePolicy() {} + } // namespace quota diff --git a/webkit/quota/mock_special_storage_policy.h b/webkit/quota/mock_special_storage_policy.h index c3b5d85..1ef6b7fc 100644 --- a/webkit/quota/mock_special_storage_policy.h +++ b/webkit/quota/mock_special_storage_policy.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,7 +16,6 @@ namespace quota { class MockSpecialStoragePolicy : public quota::SpecialStoragePolicy { public: MockSpecialStoragePolicy(); - virtual ~MockSpecialStoragePolicy(); virtual bool IsStorageProtected(const GURL& origin) OVERRIDE; virtual bool IsStorageUnlimited(const GURL& origin) OVERRIDE; @@ -56,6 +55,9 @@ class MockSpecialStoragePolicy : public quota::SpecialStoragePolicy { SpecialStoragePolicy::NotifyObservers(); } + protected: + virtual ~MockSpecialStoragePolicy(); + private: std::set<GURL> protected_; std::set<GURL> unlimited_; diff --git a/webkit/quota/quota_database_unittest.cc b/webkit/quota/quota_database_unittest.cc index a653e32..bded97f 100644 --- a/webkit/quota/quota_database_unittest.cc +++ b/webkit/quota/quota_database_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,11 +26,14 @@ const base::Time kZeroTime; class TestErrorDelegate : public sql::ErrorDelegate { public: - virtual ~TestErrorDelegate() { } - virtual int OnError( - int error, sql::Connection* connection, sql::Statement* stmt) { + virtual int OnError(int error, + sql::Connection* connection, + sql::Statement* stmt) OVERRIDE { return error; } + + protected: + virtual ~TestErrorDelegate() {} }; } // namespace diff --git a/webkit/quota/quota_manager.cc b/webkit/quota/quota_manager.cc index 640de20..031aa9d 100644 --- a/webkit/quota/quota_manager.cc +++ b/webkit/quota/quota_manager.cc @@ -644,8 +644,11 @@ class QuotaManager::DatabaseTaskBase : public QuotaThreadTask { } protected: + virtual ~DatabaseTaskBase() {} + virtual void DatabaseTaskCompleted() = 0; + // QuotaThreadTask: virtual void Completed() OVERRIDE { manager_->db_disabled_ = db_disabled_; DatabaseTaskCompleted(); @@ -674,6 +677,9 @@ class QuotaManager::InitializeTask : public QuotaManager::DatabaseTaskBase { } protected: + virtual ~InitializeTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { // See if we have overriding temporary quota configuration. database()->GetQuotaConfigValue(QuotaDatabase::kTemporaryQuotaOverrideKey, @@ -682,6 +688,7 @@ class QuotaManager::InitializeTask : public QuotaManager::DatabaseTaskBase { &desired_available_space_); } + // DatabaseTaskBase: virtual void DatabaseTaskCompleted() OVERRIDE { manager()->temporary_quota_override_ = temporary_quota_override_; manager()->desired_available_space_ = desired_available_space_; @@ -706,6 +713,9 @@ class QuotaManager::UpdateTemporaryQuotaOverrideTask callback_(callback) {} protected: + virtual ~UpdateTemporaryQuotaOverrideTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (!database()->SetQuotaConfigValue( QuotaDatabase::kTemporaryQuotaOverrideKey, new_quota_)) { @@ -715,6 +725,7 @@ class QuotaManager::UpdateTemporaryQuotaOverrideTask } } + // DatabaseTaskBase: virtual void DatabaseTaskCompleted() OVERRIDE { if (!db_disabled()) { manager()->temporary_quota_override_ = new_quota_; @@ -748,15 +759,22 @@ class QuotaManager::GetPersistentHostQuotaTask quota_(-1), callback_(callback) { } + protected: + virtual ~GetPersistentHostQuotaTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (!database()->GetHostQuota(host_, kStorageTypePersistent, "a_)) quota_ = 0; } + + // DatabaseTaskBase: virtual void DatabaseTaskCompleted() OVERRIDE { callback_.Run(kQuotaStatusOk, host_, kStorageTypePersistent, quota_); } + private: std::string host_; int64 quota_; @@ -777,7 +795,11 @@ class QuotaManager::UpdatePersistentHostQuotaTask callback_(callback) { DCHECK_GE(new_quota_, 0); } + protected: + virtual ~UpdatePersistentHostQuotaTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (!database()->SetHostQuota(host_, kStorageTypePersistent, new_quota_)) { set_db_disabled(true); @@ -785,15 +807,16 @@ class QuotaManager::UpdatePersistentHostQuotaTask } } + virtual void Aborted() OVERRIDE { + callback_.Reset(); + } + + // DatabaseTaskBase: virtual void DatabaseTaskCompleted() OVERRIDE { callback_.Run(db_disabled() ? kQuotaErrorInvalidAccess : kQuotaStatusOk, host_, kStorageTypePersistent, new_quota_); } - virtual void Aborted() OVERRIDE { - callback_.Reset(); - } - private: std::string host_; int64 new_quota_; @@ -828,19 +851,23 @@ class QuotaManager::GetLRUOriginTask } protected: + virtual ~GetLRUOriginTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { database()->GetLRUOrigin( type_, exceptions_, special_storage_policy_, &url_); } - virtual void DatabaseTaskCompleted() OVERRIDE { - callback_.Run(url_); - } - virtual void Aborted() OVERRIDE { callback_.Reset(); } + // DatabaseTaskBase: + virtual void DatabaseTaskCompleted() OVERRIDE { + callback_.Run(url_); + } + private: StorageType type_; std::set<GURL> exceptions_; @@ -861,11 +888,16 @@ class QuotaManager::DeleteOriginInfo type_(type) {} protected: + virtual ~DeleteOriginInfo() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (!database()->DeleteOriginInfo(origin_, type_)) { set_db_disabled(true); } } + + // DatabaseTaskBase: virtual void DatabaseTaskCompleted() OVERRIDE {} private: @@ -886,6 +918,9 @@ class QuotaManager::InitializeTemporaryOriginsInfoTask } protected: + virtual ~InitializeTemporaryOriginsInfoTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (!database()->IsOriginDatabaseBootstrapped()) { // Register existing origins with 0 last time access. @@ -898,6 +933,8 @@ class QuotaManager::InitializeTemporaryOriginsInfoTask } } } + + // DatabaseTaskBase: virtual void DatabaseTaskCompleted() OVERRIDE { if (has_registered_origins_) manager()->StartEviction(); @@ -918,9 +955,11 @@ class QuotaManager::AvailableSpaceQueryTask : public QuotaThreadTask { space_(-1), callback_(callback) { } - virtual ~AvailableSpaceQueryTask() {} protected: + virtual ~AvailableSpaceQueryTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { space_ = base::SysInfo::AmountOfFreeDiskSpace(profile_path_); } @@ -953,11 +992,16 @@ class QuotaManager::UpdateAccessTimeTask accessed_time_(accessed_time) {} protected: + virtual ~UpdateAccessTimeTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (!database()->SetOriginLastAccessTime(origin_, type_, accessed_time_)) { set_db_disabled(true); } } + + // DatabaseTaskBase: virtual void DatabaseTaskCompleted() OVERRIDE {} private: @@ -980,12 +1024,17 @@ class QuotaManager::UpdateModifiedTimeTask modified_time_(modified_time) {} protected: + virtual ~UpdateModifiedTimeTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (!database()->SetOriginLastModifiedTime( origin_, type_, modified_time_)) { set_db_disabled(true); } } + + // DatabaseTaskBase: virtual void DatabaseTaskCompleted() OVERRIDE {} private: @@ -1008,6 +1057,9 @@ class QuotaManager::GetModifiedSinceTask callback_(callback) {} protected: + virtual ~GetModifiedSinceTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (!database()->GetOriginsModifiedSince( type_, &origins_, modified_since_)) { @@ -1015,14 +1067,15 @@ class QuotaManager::GetModifiedSinceTask } } - virtual void DatabaseTaskCompleted() OVERRIDE { - callback_.Run(origins_, type_); - } - virtual void Aborted() OVERRIDE { callback_.Run(std::set<GURL>(), type_); } + // DatabaseTaskBase: + virtual void DatabaseTaskCompleted() OVERRIDE { + callback_.Run(origins_, type_); + } + private: StorageType type_; base::Time modified_since_; @@ -1046,7 +1099,11 @@ class QuotaManager::DumpQuotaTableTask : DatabaseTaskBase(manager), callback_(callback) { } + protected: + virtual ~DumpQuotaTableTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (!database()->DumpQuotaTable( new TableCallback( @@ -1058,6 +1115,7 @@ class QuotaManager::DumpQuotaTableTask callback_.Run(TableEntries()); } + // DatabaseTaskBase: virtual void DatabaseTaskCompleted() OVERRIDE { callback_.Run(entries_); } @@ -1088,7 +1146,11 @@ class QuotaManager::DumpOriginInfoTableTask : DatabaseTaskBase(manager), callback_(callback) { } + protected: + virtual ~DumpOriginInfoTableTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (!database()->DumpOriginInfoTable( new TableCallback( @@ -1100,6 +1162,7 @@ class QuotaManager::DumpOriginInfoTableTask callback_.Run(TableEntries()); } + // DatabaseTaskBase: virtual void DatabaseTaskCompleted() OVERRIDE { callback_.Run(entries_); } @@ -1136,14 +1199,6 @@ QuotaManager::QuotaManager(bool is_incognito, weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { } -QuotaManager::~QuotaManager() { - proxy_->manager_ = NULL; - std::for_each(clients_.begin(), clients_.end(), - std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed)); - if (database_.get()) - db_thread_->DeleteSoon(FROM_HERE, database_.release()); -} - void QuotaManager::GetUsageInfo(const GetUsageInfoCallback& callback) { LazyInitialize(); GetUsageInfoTask* get_usage_info = new GetUsageInfoTask(this, callback); @@ -1274,6 +1329,14 @@ void QuotaManager::GetOriginsModifiedSince(StorageType type, this, type, modified_since, callback))->Start(); } +QuotaManager::~QuotaManager() { + proxy_->manager_ = NULL; + std::for_each(clients_.begin(), clients_.end(), + std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed)); + if (database_.get()) + db_thread_->DeleteSoon(FROM_HERE, database_.release()); +} + void QuotaManager::LazyInitialize() { DCHECK(io_thread_->BelongsToCurrentThread()); if (database_.get()) { diff --git a/webkit/quota/quota_manager.h b/webkit/quota/quota_manager.h index 6536152..b86cbfd 100644 --- a/webkit/quota/quota_manager.h +++ b/webkit/quota/quota_manager.h @@ -21,6 +21,7 @@ #include "base/memory/weak_ptr.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/sequenced_task_runner_helpers.h" #include "webkit/quota/quota_database.h" #include "webkit/quota/quota_client.h" #include "webkit/quota/quota_task.h" @@ -109,8 +110,6 @@ class QuotaManager : public QuotaTaskObserver, base::MessageLoopProxy* db_thread, SpecialStoragePolicy* special_storage_policy); - virtual ~QuotaManager(); - // Returns a proxy object that can be used on any thread. QuotaManagerProxy* proxy() { return proxy_.get(); } @@ -204,7 +203,19 @@ class QuotaManager : public QuotaTaskObserver, static const int kEvictionIntervalInMilliSeconds; + protected: + virtual ~QuotaManager(); + private: + friend class base::DeleteHelper<QuotaManager>; + friend class MockQuotaManager; + friend class MockStorageClient; + friend class quota_internals::QuotaInternalsProxy; + friend class QuotaManagerProxy; + friend class QuotaManagerTest; + friend class QuotaTemporaryStorageEvictor; + friend struct QuotaManagerDeleter; + class DatabaseTaskBase; class InitializeTask; class UpdateTemporaryQuotaOverrideTask; @@ -256,14 +267,6 @@ class QuotaManager : public QuotaTaskObserver, typedef QuotaEvictionHandler::GetUsageAndQuotaForEvictionCallback UsageAndQuotaDispatcherCallback; - friend class quota_internals::QuotaInternalsProxy; - friend struct QuotaManagerDeleter; - friend class MockStorageClient; - friend class QuotaManagerProxy; - friend class QuotaManagerTest; - friend class QuotaTemporaryStorageEvictor; - friend class MockQuotaManager; - // This initialization method is lazily called on the IO thread // when the first quota manager API is called. // Initialize must be called after all quota clients are added to the diff --git a/webkit/support/test_webmessageportchannel.cc b/webkit/support/test_webmessageportchannel.cc index 8655fd3..50207f1 100644 --- a/webkit/support/test_webmessageportchannel.cc +++ b/webkit/support/test_webmessageportchannel.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -41,9 +41,6 @@ TestWebMessagePortChannel::TestWebMessagePortChannel() AddRef(); } -TestWebMessagePortChannel::~TestWebMessagePortChannel() { -} - void TestWebMessagePortChannel::setClient(WebMessagePortChannelClient* client) { client_ = client; } @@ -82,6 +79,8 @@ bool TestWebMessagePortChannel::tryGetMessage(WebString* data, return true; } +TestWebMessagePortChannel::~TestWebMessagePortChannel() {} + void TestWebMessagePortChannel::queueMessage(Message* message) { bool was_empty = message_queue_.empty(); message_queue_.push(message); diff --git a/webkit/support/test_webmessageportchannel.h b/webkit/support/test_webmessageportchannel.h index 101a6e4..1ecdfc5 100644 --- a/webkit/support/test_webmessageportchannel.h +++ b/webkit/support/test_webmessageportchannel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,7 +20,6 @@ class TestWebMessagePortChannel public base::RefCounted<TestWebMessagePortChannel> { public: TestWebMessagePortChannel(); - virtual ~TestWebMessagePortChannel(); // WebMessagePortChannel implementation. virtual void setClient(WebKit::WebMessagePortChannelClient*) OVERRIDE; @@ -33,8 +32,14 @@ class TestWebMessagePortChannel virtual bool tryGetMessage(WebKit::WebString*, WebKit::WebMessagePortChannelArray&) OVERRIDE; + protected: + virtual ~TestWebMessagePortChannel(); + private: + friend class base::RefCounted<TestWebMessagePortChannel>; + class Message; + void queueMessage(Message*); WebKit::WebMessagePortChannelClient* client_; diff --git a/webkit/tools/test_shell/simple_file_writer.cc b/webkit/tools/test_shell/simple_file_writer.cc index 86be501..6689bf1 100644 --- a/webkit/tools/test_shell/simple_file_writer.cc +++ b/webkit/tools/test_shell/simple_file_writer.cc @@ -40,9 +40,6 @@ class SimpleFileWriter::IOThreadProxy main_thread_ = base::MessageLoopProxy::current(); } - virtual ~IOThreadProxy() { - } - void Truncate(const GURL& path, int64 offset) { if (!io_thread_->BelongsToCurrentThread()) { io_thread_->PostTask( @@ -85,6 +82,9 @@ class SimpleFileWriter::IOThreadProxy } private: + friend class base::RefCountedThreadSafe<IOThreadProxy>; + virtual ~IOThreadProxy() {} + FileSystemOperationInterface* GetNewOperation(const GURL& path) { return file_system_context_->CreateFileSystemOperation(path, io_thread_); } diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc index 374fb70..27f7042 100644 --- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc +++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc @@ -109,7 +109,7 @@ class TestShellNetworkDelegate : public net::NetworkDelegate { public: virtual ~TestShellNetworkDelegate() {} - private: + protected: // net::NetworkDelegate implementation. virtual int OnBeforeURLRequest(net::URLRequest* request, const net::CompletionCallback& callback, @@ -195,14 +195,13 @@ FileOverHTTPParams* g_file_over_http_params = NULL; class IOThread : public base::Thread { public: - IOThread() : base::Thread("IOThread") { - } + IOThread() : base::Thread("IOThread") {} ~IOThread() { Stop(); } - virtual void Init() { + virtual void Init() OVERRIDE { if (g_request_context_params) { g_request_context = new TestShellRequestContext( g_request_context_params->cache_path, @@ -228,7 +227,7 @@ class IOThread : public base::Thread { g_request_context->blob_storage_controller()); } - virtual void CleanUp() { + virtual void CleanUp() OVERRIDE { // In reverse order of initialization. TestShellWebBlobRegistryImpl::Cleanup(); SimpleFileSystem::CleanupOnIOThread(); @@ -779,12 +778,12 @@ class SyncRequestProxy : public RequestProxy { } // -------------------------------------------------------------------------- - // Event hooks that run on the IO thread: + // RequestProxy event hooks that run on the IO thread: virtual void OnReceivedRedirect( const GURL& new_url, const ResourceResponseInfo& info, - bool* defer_redirect) { + bool* defer_redirect) OVERRIDE { // TODO(darin): It would be much better if this could live in WebCore, but // doing so requires API changes at all levels. Similar code exists in // WebCore/platform/network/cf/ResourceHandleCFNet.cpp :-( @@ -796,11 +795,11 @@ class SyncRequestProxy : public RequestProxy { result_->url = new_url; } - virtual void OnReceivedResponse(const ResourceResponseInfo& info) { + virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE { *static_cast<ResourceResponseInfo*>(result_) = info; } - virtual void OnReceivedData(int bytes_read) { + virtual void OnReceivedData(int bytes_read) OVERRIDE { if (download_to_file_) file_stream_.WriteSync(buf_->data(), bytes_read); else @@ -808,15 +807,19 @@ class SyncRequestProxy : public RequestProxy { AsyncReadData(); // read more (may recurse) } - virtual void OnCompletedRequest(const net::URLRequestStatus& status, - const std::string& security_info, - const base::TimeTicks& complete_time) { + virtual void OnCompletedRequest( + const net::URLRequestStatus& status, + const std::string& security_info, + const base::TimeTicks& complete_time) OVERRIDE { if (download_to_file_) file_stream_.CloseSync(); result_->status = status; event_.Signal(); } + protected: + virtual ~SyncRequestProxy() {} + private: ResourceLoaderBridge::SyncLoadResponse* result_; base::WaitableEvent event_; @@ -949,7 +952,6 @@ class CookieSetter : public base::RefCountedThreadSafe<CookieSetter> { private: friend class base::RefCountedThreadSafe<CookieSetter>; - ~CookieSetter() {} }; @@ -970,13 +972,13 @@ class CookieGetter : public base::RefCountedThreadSafe<CookieGetter> { } private: + friend class base::RefCountedThreadSafe<CookieGetter>; + ~CookieGetter() {} + void OnGetCookies(const std::string& cookie_line) { result_ = cookie_line; event_.Signal(); } - friend class base::RefCountedThreadSafe<CookieGetter>; - - ~CookieGetter() {} base::WaitableEvent event_; std::string result_; diff --git a/webkit/tools/test_shell/test_shell_webblobregistry_impl.cc b/webkit/tools/test_shell/test_shell_webblobregistry_impl.cc index 1b8a31f..422ad3c 100644 --- a/webkit/tools/test_shell/test_shell_webblobregistry_impl.cc +++ b/webkit/tools/test_shell/test_shell_webblobregistry_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,9 +36,6 @@ void TestShellWebBlobRegistryImpl::Cleanup() { g_blob_storage_controller = NULL; } -TestShellWebBlobRegistryImpl::TestShellWebBlobRegistryImpl() { -} - void TestShellWebBlobRegistryImpl::registerBlobURL( const WebURL& url, WebBlobData& data) { DCHECK(g_io_thread); @@ -66,6 +63,8 @@ void TestShellWebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) { thread_safe_url)); } +TestShellWebBlobRegistryImpl::TestShellWebBlobRegistryImpl() {} + void TestShellWebBlobRegistryImpl::AddFinishedBlob( const GURL& url, BlobData* blob_data) { DCHECK(g_blob_storage_controller); diff --git a/webkit/tools/test_shell/test_shell_webblobregistry_impl.h b/webkit/tools/test_shell/test_shell_webblobregistry_impl.h index 6739c8f..dee1682 100644 --- a/webkit/tools/test_shell/test_shell_webblobregistry_impl.h +++ b/webkit/tools/test_shell/test_shell_webblobregistry_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -32,6 +32,9 @@ class TestShellWebBlobRegistryImpl const WebKit::WebURL& src_url); virtual void unregisterBlobURL(const WebKit::WebURL& url); + protected: + virtual ~TestShellWebBlobRegistryImpl() {} + private: friend class base::RefCountedThreadSafe<TestShellWebBlobRegistryImpl>; |