diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-11 22:27:54 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-11 22:27:54 +0000 |
commit | 870bcb302d6597636fee73cd7bac110664b5a51d (patch) | |
tree | ba441b6275c472d77b3b4e9f0d64d8a9ab2017a6 /sync/internal_api | |
parent | 00cee28d45333558a3b7d842923d8e2eb07d7696 (diff) | |
download | chromium_src-870bcb302d6597636fee73cd7bac110664b5a51d.zip chromium_src-870bcb302d6597636fee73cd7bac110664b5a51d.tar.gz chromium_src-870bcb302d6597636fee73cd7bac110664b5a51d.tar.bz2 |
RefCounted types should not have public destructors - sync and jingle
In the process of ensuring no base classes for RefCounted classes have
public destructors, base::NonThreadSafe shows up frequently due to having
a public destructor.
Begin migrating all the code that has a base::NonThreadSafe member to
directly inheriting from base::NonThreadSafe, so that base::NonThreadSafe's
destructor can be made private.
BUG=123295
TEST=existing
Review URL: https://chromiumcodereview.appspot.com/10411046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141530 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api')
5 files changed, 9 insertions, 8 deletions
diff --git a/sync/internal_api/http_post_provider_interface.h b/sync/internal_api/http_post_provider_interface.h index 10b02b5..df31b7f 100644 --- a/sync/internal_api/http_post_provider_interface.h +++ b/sync/internal_api/http_post_provider_interface.h @@ -16,8 +16,6 @@ namespace sync_api { // want to make a subsequent POST. class HttpPostProviderInterface { public: - virtual ~HttpPostProviderInterface() {} - // Use specified user agent string when POSTing. If not called a default UA // may be used. virtual void SetUserAgent(const char* user_agent) = 0; @@ -59,6 +57,9 @@ class HttpPostProviderInterface { // Abandon any pending POST and unblock caller in MakeSynchronousPost. // This must be safe to call from any thread. virtual void Abort() = 0; + + protected: + virtual ~HttpPostProviderInterface() {} }; } // namespace sync_api diff --git a/sync/internal_api/js_mutation_event_observer.cc b/sync/internal_api/js_mutation_event_observer.cc index 9833b09..f03d47a 100644 --- a/sync/internal_api/js_mutation_event_observer.cc +++ b/sync/internal_api/js_mutation_event_observer.cc @@ -19,7 +19,7 @@ JsMutationEventObserver::JsMutationEventObserver() : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {} JsMutationEventObserver::~JsMutationEventObserver() { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); } base::WeakPtr<JsMutationEventObserver> JsMutationEventObserver::AsWeakPtr() { @@ -86,7 +86,7 @@ void JsMutationEventObserver::OnChangesComplete( void JsMutationEventObserver::OnTransactionWrite( const syncable::ImmutableWriteTransactionInfo& write_transaction_info, syncable::ModelTypeSet models_with_changes) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); if (!event_handler_.IsInitialized()) { return; } diff --git a/sync/internal_api/js_mutation_event_observer.h b/sync/internal_api/js_mutation_event_observer.h index 60a33a2..3022fa0 100644 --- a/sync/internal_api/js_mutation_event_observer.h +++ b/sync/internal_api/js_mutation_event_observer.h @@ -29,7 +29,8 @@ class JsEventHandler; // summarized version to a JsEventHandler. class JsMutationEventObserver : public sync_api::SyncManager::ChangeObserver, - public syncable::TransactionObserver { + public syncable::TransactionObserver, + public base::NonThreadSafe { public: JsMutationEventObserver(); @@ -54,7 +55,6 @@ class JsMutationEventObserver syncable::ModelTypeSet models_with_changes) OVERRIDE; private: - base::NonThreadSafe non_thread_safe_; base::WeakPtrFactory<JsMutationEventObserver> weak_ptr_factory_; WeakHandle<JsEventHandler> event_handler_; diff --git a/sync/internal_api/syncapi_server_connection_manager_unittest.cc b/sync/internal_api/syncapi_server_connection_manager_unittest.cc index a2f5280..0c81e98 100644 --- a/sync/internal_api/syncapi_server_connection_manager_unittest.cc +++ b/sync/internal_api/syncapi_server_connection_manager_unittest.cc @@ -66,7 +66,7 @@ class BlockingHttpPostFactory : public HttpPostProviderFactory { return new BlockingHttpPost(); } virtual void Destroy(HttpPostProviderInterface* http) OVERRIDE { - delete http; + delete static_cast<BlockingHttpPost*>(http); } }; diff --git a/sync/internal_api/syncapi_unittest.cc b/sync/internal_api/syncapi_unittest.cc index e8fa2bd..991aed6 100644 --- a/sync/internal_api/syncapi_unittest.cc +++ b/sync/internal_api/syncapi_unittest.cc @@ -680,7 +680,7 @@ class TestHttpPostProviderFactory : public HttpPostProviderFactory { return new TestHttpPostProviderInterface(); } virtual void Destroy(HttpPostProviderInterface* http) OVERRIDE { - delete http; + delete static_cast<TestHttpPostProviderInterface*>(http); } }; |