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 | |
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')
-rw-r--r-- | sync/api/sync_change_processor.h | 1 | ||||
-rw-r--r-- | sync/internal_api/http_post_provider_interface.h | 5 | ||||
-rw-r--r-- | sync/internal_api/js_mutation_event_observer.cc | 4 | ||||
-rw-r--r-- | sync/internal_api/js_mutation_event_observer.h | 4 | ||||
-rw-r--r-- | sync/internal_api/syncapi_server_connection_manager_unittest.cc | 2 | ||||
-rw-r--r-- | sync/internal_api/syncapi_unittest.cc | 2 | ||||
-rw-r--r-- | sync/notifier/chrome_invalidation_client.cc | 28 | ||||
-rw-r--r-- | sync/notifier/chrome_invalidation_client.h | 4 | ||||
-rw-r--r-- | sync/notifier/invalidation_notifier.cc | 16 | ||||
-rw-r--r-- | sync/notifier/invalidation_notifier.h | 5 | ||||
-rw-r--r-- | sync/notifier/registration_manager.cc | 24 | ||||
-rw-r--r-- | sync/notifier/registration_manager.h | 3 | ||||
-rw-r--r-- | sync/notifier/sync_notifier_observer.h | 6 | ||||
-rw-r--r-- | sync/test/engine/fake_model_worker.cc | 6 | ||||
-rw-r--r-- | sync/test/engine/fake_model_worker.h | 4 | ||||
-rw-r--r-- | sync/test/fake_extensions_activity_monitor.cc | 6 | ||||
-rw-r--r-- | sync/test/fake_extensions_activity_monitor.h | 5 |
17 files changed, 61 insertions, 64 deletions
diff --git a/sync/api/sync_change_processor.h b/sync/api/sync_change_processor.h index 1eed159..d97d28d 100644 --- a/sync/api/sync_change_processor.h +++ b/sync/api/sync_change_processor.h @@ -34,7 +34,6 @@ class SyncChangeProcessor { virtual SyncError ProcessSyncChanges( const tracked_objects::Location& from_here, const SyncChangeList& change_list) = 0; - protected: }; #endif // SYNC_API_SYNC_CHANGE_PROCESSOR_H_ 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); } }; diff --git a/sync/notifier/chrome_invalidation_client.cc b/sync/notifier/chrome_invalidation_client.cc index 5ddb56b..278076f 100644 --- a/sync/notifier/chrome_invalidation_client.cc +++ b/sync/notifier/chrome_invalidation_client.cc @@ -35,11 +35,11 @@ ChromeInvalidationClient::ChromeInvalidationClient( ALLOW_THIS_IN_INITIALIZER_LIST(this)), listener_(NULL), ticl_ready_(false) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); } ChromeInvalidationClient::~ChromeInvalidationClient() { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); Stop(); DCHECK(!listener_); } @@ -51,7 +51,7 @@ void ChromeInvalidationClient::Start( const browser_sync::WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, Listener* listener) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); Stop(); chrome_system_resources_.set_platform(client_info); @@ -94,12 +94,12 @@ void ChromeInvalidationClient::Start( void ChromeInvalidationClient::UpdateCredentials( const std::string& email, const std::string& token) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); chrome_system_resources_.network()->UpdateCredentials(email, token); } void ChromeInvalidationClient::Stop() { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); if (!invalidation_client_.get()) { return; } @@ -116,7 +116,7 @@ void ChromeInvalidationClient::Stop() { } void ChromeInvalidationClient::RegisterTypes(syncable::ModelTypeSet types) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); registered_types_ = types; if (ticl_ready_ && registration_manager_.get()) { registration_manager_->SetRegisteredTypes(registered_types_); @@ -135,7 +135,7 @@ void ChromeInvalidationClient::Invalidate( invalidation::InvalidationClient* client, const invalidation::Invalidation& invalidation, const invalidation::AckHandle& ack_handle) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); DVLOG(1) << "Invalidate: " << InvalidationToString(invalidation); syncable::ModelType model_type; if (!ObjectIdToRealModelType(invalidation.object_id(), &model_type)) { @@ -185,7 +185,7 @@ void ChromeInvalidationClient::InvalidateUnknownVersion( invalidation::InvalidationClient* client, const invalidation::ObjectId& object_id, const invalidation::AckHandle& ack_handle) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); DVLOG(1) << "InvalidateUnknownVersion"; syncable::ModelType model_type; @@ -208,7 +208,7 @@ void ChromeInvalidationClient::InvalidateUnknownVersion( void ChromeInvalidationClient::InvalidateAll( invalidation::InvalidationClient* client, const invalidation::AckHandle& ack_handle) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); DVLOG(1) << "InvalidateAll"; EmitInvalidation(registered_types_, std::string()); // TODO(akalin): We should really acknowledge only after we get the @@ -218,7 +218,7 @@ void ChromeInvalidationClient::InvalidateAll( void ChromeInvalidationClient::EmitInvalidation( syncable::ModelTypeSet types, const std::string& payload) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); syncable::ModelTypePayloadMap type_payloads = syncable::ModelTypePayloadMapFromEnumSet(types, payload); listener_->OnInvalidate(type_payloads); @@ -228,7 +228,7 @@ void ChromeInvalidationClient::InformRegistrationStatus( invalidation::InvalidationClient* client, const invalidation::ObjectId& object_id, InvalidationListener::RegistrationState new_state) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); DVLOG(1) << "InformRegistrationStatus: " << ObjectIdToString(object_id) << " " << new_state; @@ -249,7 +249,7 @@ void ChromeInvalidationClient::InformRegistrationFailure( const invalidation::ObjectId& object_id, bool is_transient, const std::string& error_message) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); DVLOG(1) << "InformRegistrationFailure: " << ObjectIdToString(object_id) << "is_transient=" << is_transient @@ -278,7 +278,7 @@ void ChromeInvalidationClient::ReissueRegistrations( invalidation::InvalidationClient* client, const std::string& prefix, int prefix_length) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); DVLOG(1) << "AllRegistrationsLost"; registration_manager_->MarkAllRegistrationsLost(); } @@ -292,7 +292,7 @@ void ChromeInvalidationClient::InformError( } void ChromeInvalidationClient::WriteState(const std::string& state) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); DVLOG(1) << "WriteState"; invalidation_state_tracker_.Call( FROM_HERE, &InvalidationStateTracker::SetInvalidationState, state); diff --git a/sync/notifier/chrome_invalidation_client.h b/sync/notifier/chrome_invalidation_client.h index acfc001..ce0939b 100644 --- a/sync/notifier/chrome_invalidation_client.h +++ b/sync/notifier/chrome_invalidation_client.h @@ -42,7 +42,8 @@ class RegistrationManager; // thread. class ChromeInvalidationClient : public InvalidationListener, - public StateWriter { + public StateWriter, + public base::NonThreadSafe { public: class Listener { public: @@ -117,7 +118,6 @@ class ChromeInvalidationClient void EmitInvalidation( syncable::ModelTypeSet types, const std::string& payload); - base::NonThreadSafe non_thread_safe_; ChromeSystemResources chrome_system_resources_; InvalidationVersionMap max_invalidation_versions_; browser_sync::WeakHandle<InvalidationStateTracker> diff --git a/sync/notifier/invalidation_notifier.cc b/sync/notifier/invalidation_notifier.cc index 6f5c382..485e969 100644 --- a/sync/notifier/invalidation_notifier.cc +++ b/sync/notifier/invalidation_notifier.cc @@ -32,28 +32,28 @@ InvalidationNotifier::InvalidationNotifier( } InvalidationNotifier::~InvalidationNotifier() { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); } void InvalidationNotifier::AddObserver(SyncNotifierObserver* observer) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); observers_.AddObserver(observer); } void InvalidationNotifier::RemoveObserver(SyncNotifierObserver* observer) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); observers_.RemoveObserver(observer); } void InvalidationNotifier::SetUniqueId(const std::string& unique_id) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); invalidation_client_id_ = unique_id; DVLOG(1) << "Setting unique ID to " << unique_id; CHECK(!invalidation_client_id_.empty()); } void InvalidationNotifier::SetStateDeprecated(const std::string& state) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); DCHECK_LT(state_, STARTED); if (invalidation_state_.empty()) { // Migrate state from sync to invalidation state tracker (bug @@ -88,20 +88,20 @@ void InvalidationNotifier::UpdateCredentials( void InvalidationNotifier::UpdateEnabledTypes( syncable::ModelTypeSet enabled_types) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); CHECK(!invalidation_client_id_.empty()); invalidation_client_.RegisterTypes(enabled_types); } void InvalidationNotifier::SendNotification( syncable::ModelTypeSet changed_types) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); // Do nothing. } void InvalidationNotifier::OnInvalidate( const syncable::ModelTypePayloadMap& type_payloads) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); FOR_EACH_OBSERVER(SyncNotifierObserver, observers_, OnIncomingNotification(type_payloads, sync_notifier::REMOTE_NOTIFICATION)); diff --git a/sync/notifier/invalidation_notifier.h b/sync/notifier/invalidation_notifier.h index 01108f5..f7f2efd 100644 --- a/sync/notifier/invalidation_notifier.h +++ b/sync/notifier/invalidation_notifier.h @@ -35,7 +35,8 @@ namespace sync_notifier { // This class must live on the IO thread. class InvalidationNotifier : public SyncNotifier, - public ChromeInvalidationClient::Listener { + public ChromeInvalidationClient::Listener, + public base::NonThreadSafe { public: // |invalidation_state_tracker| must be initialized. InvalidationNotifier( @@ -66,8 +67,6 @@ class InvalidationNotifier virtual void OnSessionStatusChanged(bool has_session) OVERRIDE; private: - base::NonThreadSafe non_thread_safe_; - // We start off in the STOPPED state. When we get our initial // credentials, we connect and move to the CONNECTING state. When // we're connected we start the invalidation client and move to the diff --git a/sync/notifier/registration_manager.cc b/sync/notifier/registration_manager.cc index 8e04916..63a7e8c 100644 --- a/sync/notifier/registration_manager.cc +++ b/sync/notifier/registration_manager.cc @@ -67,12 +67,12 @@ RegistrationManager::RegistrationManager( } RegistrationManager::~RegistrationManager() { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); } void RegistrationManager::SetRegisteredTypes( syncable::ModelTypeSet types) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { @@ -91,7 +91,7 @@ void RegistrationManager::SetRegisteredTypes( void RegistrationManager::MarkRegistrationLost( syncable::ModelType model_type) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); RegistrationStatus* status = ®istration_statuses_[model_type]; if (!status->enabled) { return; @@ -102,7 +102,7 @@ void RegistrationManager::MarkRegistrationLost( } void RegistrationManager::MarkAllRegistrationsLost() { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { syncable::ModelType model_type = syncable::ModelTypeFromInt(i); @@ -113,14 +113,14 @@ void RegistrationManager::MarkAllRegistrationsLost() { } void RegistrationManager::DisableType(syncable::ModelType model_type) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); RegistrationStatus* status = ®istration_statuses_[model_type]; LOG(INFO) << "Disabling " << syncable::ModelTypeToString(model_type); status->Disable(); } syncable::ModelTypeSet RegistrationManager::GetRegisteredTypes() const { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); syncable::ModelTypeSet registered_types; for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { @@ -134,7 +134,7 @@ syncable::ModelTypeSet RegistrationManager::GetRegisteredTypes() const { RegistrationManager::PendingRegistrationMap RegistrationManager::GetPendingRegistrations() const { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); PendingRegistrationMap pending_registrations; for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { @@ -154,7 +154,7 @@ RegistrationManager::PendingRegistrationMap } void RegistrationManager::FirePendingRegistrationsForTest() { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { syncable::ModelType model_type = syncable::ModelTypeFromInt(i); @@ -194,7 +194,7 @@ double RegistrationManager::GetJitter() { void RegistrationManager::TryRegisterType(syncable::ModelType model_type, bool is_retry) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); RegistrationStatus* status = ®istration_statuses_[model_type]; if (!status->enabled) { // Disabled, so do nothing. @@ -241,7 +241,7 @@ void RegistrationManager::TryRegisterType(syncable::ModelType model_type, } void RegistrationManager::DoRegisterType(syncable::ModelType model_type) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); invalidation::ObjectId object_id; if (!RealModelTypeToObjectId(model_type, &object_id)) { LOG(DFATAL) << "Invalid model type: " << model_type; @@ -254,7 +254,7 @@ void RegistrationManager::DoRegisterType(syncable::ModelType model_type) { } void RegistrationManager::UnregisterType(syncable::ModelType model_type) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); invalidation::ObjectId object_id; if (!RealModelTypeToObjectId(model_type, &object_id)) { LOG(DFATAL) << "Invalid model type: " << model_type; @@ -267,7 +267,7 @@ void RegistrationManager::UnregisterType(syncable::ModelType model_type) { bool RegistrationManager::IsTypeRegistered( syncable::ModelType model_type) const { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); return registration_statuses_[model_type].state == invalidation::InvalidationListener::REGISTERED; } diff --git a/sync/notifier/registration_manager.h b/sync/notifier/registration_manager.h index 44e7cf3..8b27054 100644 --- a/sync/notifier/registration_manager.h +++ b/sync/notifier/registration_manager.h @@ -32,7 +32,7 @@ using ::invalidation::InvalidationListener; // implementations include the syncer thread (both versions) and XMPP // retries. The most sophisticated one is URLRequestThrottler; making // that generic should work for everyone. -class RegistrationManager { +class RegistrationManager : public base::NonThreadSafe { public: // Constants for exponential backoff (used by tests). static const int kInitialRegistrationDelaySeconds; @@ -164,7 +164,6 @@ class RegistrationManager { // Returns true iff the given type, which must be valid, is registered. bool IsTypeRegistered(syncable::ModelType model_type) const; - base::NonThreadSafe non_thread_safe_; RegistrationStatus registration_statuses_[syncable::MODEL_TYPE_COUNT]; // Weak pointer. invalidation::InvalidationClient* invalidation_client_; diff --git a/sync/notifier/sync_notifier_observer.h b/sync/notifier/sync_notifier_observer.h index a6a629f..0685528 100644 --- a/sync/notifier/sync_notifier_observer.h +++ b/sync/notifier/sync_notifier_observer.h @@ -21,13 +21,13 @@ enum IncomingNotificationSource { class SyncNotifierObserver { public: - SyncNotifierObserver() {} - virtual ~SyncNotifierObserver() {} - virtual void OnIncomingNotification( const syncable::ModelTypePayloadMap& type_payloads, IncomingNotificationSource source) = 0; virtual void OnNotificationStateChange(bool notifications_enabled) = 0; + + protected: + virtual ~SyncNotifierObserver() {} }; } // namespace sync_notifier diff --git a/sync/test/engine/fake_model_worker.cc b/sync/test/engine/fake_model_worker.cc index 9938e08..3c254f5 100644 --- a/sync/test/engine/fake_model_worker.cc +++ b/sync/test/engine/fake_model_worker.cc @@ -13,18 +13,18 @@ FakeModelWorker::~FakeModelWorker() { // multi-threaded test; since ModelSafeWorkers are // RefCountedThreadSafe, they could theoretically be destroyed from // a different thread. - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); } SyncerError FakeModelWorker::DoWorkAndWaitUntilDone( const WorkCallback& work) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); // Simply do the work on the current thread. return work.Run(); } ModelSafeGroup FakeModelWorker::GetModelSafeGroup() { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); return group_; } diff --git a/sync/test/engine/fake_model_worker.h b/sync/test/engine/fake_model_worker.h index 72ad59e..59a9e0b 100644 --- a/sync/test/engine/fake_model_worker.h +++ b/sync/test/engine/fake_model_worker.h @@ -18,7 +18,7 @@ namespace browser_sync { // Fake implementation of ModelSafeWorker that does work on the // current thread regardless of the group. -class FakeModelWorker : public ModelSafeWorker { +class FakeModelWorker : public ModelSafeWorker, public base::NonThreadSafe { public: explicit FakeModelWorker(ModelSafeGroup group); @@ -30,8 +30,6 @@ class FakeModelWorker : public ModelSafeWorker { private: virtual ~FakeModelWorker(); - base::NonThreadSafe non_thread_safe_; - const ModelSafeGroup group_; DISALLOW_COPY_AND_ASSIGN(FakeModelWorker); diff --git a/sync/test/fake_extensions_activity_monitor.cc b/sync/test/fake_extensions_activity_monitor.cc index b3e38cd..4cf5042 100644 --- a/sync/test/fake_extensions_activity_monitor.cc +++ b/sync/test/fake_extensions_activity_monitor.cc @@ -11,17 +11,17 @@ namespace browser_sync { FakeExtensionsActivityMonitor::FakeExtensionsActivityMonitor() {} FakeExtensionsActivityMonitor::~FakeExtensionsActivityMonitor() { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); } void FakeExtensionsActivityMonitor::GetAndClearRecords(Records* buffer) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); buffer->clear(); buffer->swap(records_); } void FakeExtensionsActivityMonitor::PutRecords(const Records& records) { - DCHECK(non_thread_safe_.CalledOnValidThread()); + DCHECK(CalledOnValidThread()); for (Records::const_iterator i = records.begin(); i != records.end(); ++i) { records_[i->first].extension_id = i->second.extension_id; records_[i->first].bookmark_write_count += i->second.bookmark_write_count; diff --git a/sync/test/fake_extensions_activity_monitor.h b/sync/test/fake_extensions_activity_monitor.h index 2beb64f..4152bf7 100644 --- a/sync/test/fake_extensions_activity_monitor.h +++ b/sync/test/fake_extensions_activity_monitor.h @@ -14,7 +14,9 @@ namespace browser_sync { // Fake non-thread-safe implementation of ExtensionsActivityMonitor // suitable to be used in single-threaded sync tests. -class FakeExtensionsActivityMonitor : public ExtensionsActivityMonitor { +class FakeExtensionsActivityMonitor + : public ExtensionsActivityMonitor, + public base::NonThreadSafe { public: FakeExtensionsActivityMonitor(); virtual ~FakeExtensionsActivityMonitor(); @@ -25,7 +27,6 @@ class FakeExtensionsActivityMonitor : public ExtensionsActivityMonitor { private: Records records_; - base::NonThreadSafe non_thread_safe_; }; } // namespace browser_sync |