diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-21 04:55:52 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-21 04:55:52 +0000 |
commit | 20305ec6f1acf21392c2f3938a14a96f1e28e76d (patch) | |
tree | 6eff1f7be4bad1a1362d3466f0ac59292dc51acc /chrome/browser/sync | |
parent | c6e8346b56ab61b35845aefcf9b241c654fe1253 (diff) | |
download | chromium_src-20305ec6f1acf21392c2f3938a14a96f1e28e76d.zip chromium_src-20305ec6f1acf21392c2f3938a14a96f1e28e76d.tar.gz chromium_src-20305ec6f1acf21392c2f3938a14a96f1e28e76d.tar.bz2 |
Remove obsolete base/lock.h and fix up callers to use the new header file and
the base namespace. Fix several files including lock.h unnecessarily.
BUG=none
TEST=none
Original review=http://codereview.chromium.org/6142009/
Patch by leviw@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
28 files changed, 93 insertions, 93 deletions
diff --git a/chrome/browser/sync/engine/all_status.cc b/chrome/browser/sync/engine/all_status.cc index 8d4b85e..1580dc4 100644 --- a/chrome/browser/sync/engine/all_status.cc +++ b/chrome/browser/sync/engine/all_status.cc @@ -138,7 +138,7 @@ void AllStatus::HandleServerConnectionEvent( } sync_api::SyncManager::Status AllStatus::status() const { - AutoLock lock(mutex_); + base::AutoLock lock(mutex_); return status_; } diff --git a/chrome/browser/sync/engine/all_status.h b/chrome/browser/sync/engine/all_status.h index 5b2f1d0..015bfb7 100644 --- a/chrome/browser/sync/engine/all_status.h +++ b/chrome/browser/sync/engine/all_status.h @@ -11,8 +11,8 @@ #include <map> -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/engine/syncer_types.h" @@ -57,7 +57,7 @@ class AllStatus : public SyncEngineEventListener { sync_api::SyncManager::Status status_; - mutable Lock mutex_; // Protects all data members. + mutable base::Lock mutex_; // Protects all data members. DISALLOW_COPY_AND_ASSIGN(AllStatus); }; diff --git a/chrome/browser/sync/engine/net/server_connection_manager.cc b/chrome/browser/sync/engine/net/server_connection_manager.cc index 20776fe..7f53a29 100644 --- a/chrome/browser/sync/engine/net/server_connection_manager.cc +++ b/chrome/browser/sync/engine/net/server_connection_manager.cc @@ -255,7 +255,7 @@ bool ServerConnectionManager::CheckServerReachable() { void ServerConnectionManager::kill() { { - AutoLock lock(terminate_all_io_mutex_); + base::AutoLock lock(terminate_all_io_mutex_); terminate_all_io_ = true; } } @@ -294,7 +294,7 @@ void ServerConnectionManager::SetServerParameters(const string& server_url, int port, bool use_ssl) { { - AutoLock lock(server_parameters_mutex_); + base::AutoLock lock(server_parameters_mutex_); sync_server_ = server_url; sync_server_port_ = port; use_ssl_ = use_ssl; @@ -305,7 +305,7 @@ void ServerConnectionManager::SetServerParameters(const string& server_url, void ServerConnectionManager::GetServerParameters(string* server_url, int* port, bool* use_ssl) const { - AutoLock lock(server_parameters_mutex_); + base::AutoLock lock(server_parameters_mutex_); if (server_url != NULL) *server_url = sync_server_; if (port != NULL) diff --git a/chrome/browser/sync/engine/net/server_connection_manager.h b/chrome/browser/sync/engine/net/server_connection_manager.h index 6380151..8921428 100644 --- a/chrome/browser/sync/engine/net/server_connection_manager.h +++ b/chrome/browser/sync/engine/net/server_connection_manager.h @@ -10,8 +10,8 @@ #include <string> #include "base/atomicops.h" -#include "base/lock.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "chrome/browser/sync/syncable/syncable_id.h" #include "chrome/common/deprecated/event_sys.h" #include "chrome/common/deprecated/event_sys-inl.h" @@ -149,7 +149,7 @@ class ScopedServerStatusWatcher { // one instance for every server that you need to talk to. class ServerConnectionManager { public: - typedef EventChannel<ServerConnectionEvent, Lock> Channel; + typedef EventChannel<ServerConnectionEvent, base::Lock> Channel; // buffer_in - will be POSTed // buffer_out - string will be overwritten with response @@ -192,7 +192,7 @@ class ServerConnectionManager { void GetServerParams(std::string* server, int* server_port, bool* use_ssl) const { - AutoLock lock(scm_->server_parameters_mutex_); + base::AutoLock lock(scm_->server_parameters_mutex_); server->assign(scm_->sync_server_); *server_port = scm_->sync_server_port_; *use_ssl = scm_->use_ssl_; @@ -269,7 +269,7 @@ class ServerConnectionManager { std::string GetServerHost() const; bool terminate_all_io() const { - AutoLock lock(terminate_all_io_mutex_); + base::AutoLock lock(terminate_all_io_mutex_); return terminate_all_io_; } @@ -284,23 +284,23 @@ class ServerConnectionManager { void set_auth_token(const std::string& auth_token) { // TODO(chron): Consider adding a message loop check here. - AutoLock lock(auth_token_mutex_); + base::AutoLock lock(auth_token_mutex_); auth_token_.assign(auth_token); } const std::string auth_token() const { - AutoLock lock(auth_token_mutex_); + base::AutoLock lock(auth_token_mutex_); return auth_token_; } protected: inline std::string proto_sync_path() const { - AutoLock lock(path_mutex_); + base::AutoLock lock(path_mutex_); return proto_sync_path_; } std::string get_time_path() const { - AutoLock lock(path_mutex_); + base::AutoLock lock(path_mutex_); return get_time_path_; } @@ -317,7 +317,7 @@ class ServerConnectionManager { ScopedServerStatusWatcher* watcher); // Protects access to sync_server_, sync_server_port_ and use_ssl_: - mutable Lock server_parameters_mutex_; + mutable base::Lock server_parameters_mutex_; // The sync_server_ is the server that requests will be made to. std::string sync_server_; @@ -335,15 +335,15 @@ class ServerConnectionManager { bool use_ssl_; // The paths we post to. - mutable Lock path_mutex_; + mutable base::Lock path_mutex_; std::string proto_sync_path_; std::string get_time_path_; - mutable Lock auth_token_mutex_; + mutable base::Lock auth_token_mutex_; // The auth token to use in authenticated requests. Set by the AuthWatcher. std::string auth_token_; - Lock error_count_mutex_; // Protects error_count_ + base::Lock error_count_mutex_; // Protects error_count_ int error_count_; // Tracks the number of connection errors. Channel* const channel_; @@ -363,7 +363,7 @@ class ServerConnectionManager { void NotifyStatusChanged(); void ResetConnection(); - mutable Lock terminate_all_io_mutex_; + mutable base::Lock terminate_all_io_mutex_; bool terminate_all_io_; // When set to true, terminate all connections asap. DISALLOW_COPY_AND_ASSIGN(ServerConnectionManager); }; diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc index 7725afd..bc11b31 100644 --- a/chrome/browser/sync/engine/syncapi.cc +++ b/chrome/browser/sync/engine/syncapi.cc @@ -11,12 +11,12 @@ #include <vector> #include "base/base64.h" -#include "base/lock.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "base/sha1.h" #include "base/string_util.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_thread.h" @@ -1070,7 +1070,7 @@ class SyncManager::SyncInternal // Whether we're initialized to the point of being able to accept changes // (and hence allow transaction creation). See initialized_ for details. bool initialized() const { - AutoLock lock(initialized_mutex_); + base::AutoLock lock(initialized_mutex_); return initialized_; } @@ -1310,7 +1310,7 @@ class SyncManager::SyncInternal // meaning we are ready to accept changes. Protected by initialized_mutex_ // as it can get read/set by both the SyncerThread and the AuthWatcherThread. bool initialized_; - mutable Lock initialized_mutex_; + mutable base::Lock initialized_mutex_; notifier::NotifierOptions notifier_options_; @@ -1531,7 +1531,7 @@ void SyncManager::SyncInternal::MarkAndNotifyInitializationComplete() { // between their respective threads to call MarkAndNotify. We need to make // sure the observer is notified once and only once. { - AutoLock lock(initialized_mutex_); + base::AutoLock lock(initialized_mutex_); if (initialized_) return; initialized_ = true; diff --git a/chrome/browser/sync/engine/syncer.cc b/chrome/browser/sync/engine/syncer.cc index cbf9753..70d585f 100644 --- a/chrome/browser/sync/engine/syncer.cc +++ b/chrome/browser/sync/engine/syncer.cc @@ -62,12 +62,12 @@ Syncer::Syncer() Syncer::~Syncer() {} bool Syncer::ExitRequested() { - AutoLock lock(early_exit_requested_lock_); + base::AutoLock lock(early_exit_requested_lock_); return early_exit_requested_; } void Syncer::RequestEarlyExit() { - AutoLock lock(early_exit_requested_lock_); + base::AutoLock lock(early_exit_requested_lock_); early_exit_requested_ = true; } diff --git a/chrome/browser/sync/engine/syncer.h b/chrome/browser/sync/engine/syncer.h index 2789ed2..89f1307 100644 --- a/chrome/browser/sync/engine/syncer.h +++ b/chrome/browser/sync/engine/syncer.h @@ -12,8 +12,8 @@ #include "base/basictypes.h" #include "base/callback.h" #include "base/gtest_prod_util.h" -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "chrome/browser/sync/engine/conflict_resolver.h" #include "chrome/browser/sync/engine/syncer_types.h" #include "chrome/browser/sync/engine/syncproto.h" @@ -109,7 +109,7 @@ class Syncer { SyncerStep last_step); bool early_exit_requested_; - Lock early_exit_requested_lock_; + base::Lock early_exit_requested_lock_; int32 max_commit_batch_size_; diff --git a/chrome/browser/sync/engine/syncer_thread.cc b/chrome/browser/sync/engine/syncer_thread.cc index e9a3a20..8813709 100644 --- a/chrome/browser/sync/engine/syncer_thread.cc +++ b/chrome/browser/sync/engine/syncer_thread.cc @@ -556,7 +556,7 @@ SyncSession* SyncerThread::SyncMain(Syncer* syncer, bool was_throttled, continue_sync_cycle, initial_sync_for_thread, was_nudged)); scoped_ptr<SyncSession> session; - AutoUnlock unlock(lock_); + base::AutoUnlock unlock(lock_); do { session.reset(new SyncSession(session_context_.get(), this, info, routes, workers)); diff --git a/chrome/browser/sync/engine/syncer_thread_unittest.cc b/chrome/browser/sync/engine/syncer_thread_unittest.cc index 4b13e8f..1553e9c 100644 --- a/chrome/browser/sync/engine/syncer_thread_unittest.cc +++ b/chrome/browser/sync/engine/syncer_thread_unittest.cc @@ -5,8 +5,8 @@ #include <list> #include <map> -#include "base/lock.h" #include "base/scoped_ptr.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "base/synchronization/waitable_event.h" #include "chrome/browser/sync/engine/model_safe_worker.h" @@ -125,7 +125,7 @@ class SyncerThreadWithSyncerTest : public testing::Test, void WaitForDisconnect() { // Wait for the SyncerThread to detect loss of connection, up to a max of // 10 seconds to timeout the test. - AutoLock lock(syncer_thread()->lock_); + base::AutoLock lock(syncer_thread()->lock_); TimeTicks start = TimeTicks::Now(); TimeDelta ten_seconds = TimeDelta::FromSeconds(10); while (syncer_thread()->vault_.connected_) { @@ -139,7 +139,7 @@ class SyncerThreadWithSyncerTest : public testing::Test, bool Pause(ListenerMock* listener) { WaitableEvent event(false, false); { - AutoLock lock(syncer_thread()->lock_); + base::AutoLock lock(syncer_thread()->lock_); EXPECT_CALL(*listener, OnSyncEngineEvent( Field(&SyncEngineEvent::what_happened, SyncEngineEvent::SYNCER_THREAD_PAUSED))). @@ -153,7 +153,7 @@ class SyncerThreadWithSyncerTest : public testing::Test, bool Resume(ListenerMock* listener) { WaitableEvent event(false, false); { - AutoLock lock(syncer_thread()->lock_); + base::AutoLock lock(syncer_thread()->lock_); EXPECT_CALL(*listener, OnSyncEngineEvent( Field(&SyncEngineEvent::what_happened, SyncEngineEvent::SYNCER_THREAD_RESUMED))). @@ -330,7 +330,7 @@ TEST_F(SyncerThreadTest, CalculatePollingWaitTime) { scoped_refptr<SyncerThread> syncer_thread(new SyncerThread(context)); syncer_thread->DisableIdleDetection(); // Hold the lock to appease asserts in code. - AutoLock lock(syncer_thread->lock_); + base::AutoLock lock(syncer_thread->lock_); // Notifications disabled should result in a polling interval of // kDefaultShortPollInterval. diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.cc b/chrome/browser/sync/glue/autofill_data_type_controller.cc index 8661e14..1c57df2 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller.cc @@ -109,7 +109,7 @@ void AutofillDataTypeController::Stop() { // thread to finish the StartImpl() task. if (state_ == ASSOCIATING) { { - AutoLock lock(abort_association_lock_); + base::AutoLock lock(abort_association_lock_); abort_association_ = true; if (model_associator_.get()) model_associator_->AbortAssociation(); @@ -189,7 +189,7 @@ void AutofillDataTypeController::StartImpl() { // No additional services need to be started before we can proceed // with model association. { - AutoLock lock(abort_association_lock_); + base::AutoLock lock(abort_association_lock_); if (abort_association_) { abort_association_complete_.Signal(); return; @@ -232,7 +232,7 @@ void AutofillDataTypeController::StartDone( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); abort_association_complete_.Signal(); - AutoLock lock(abort_association_lock_); + base::AutoLock lock(abort_association_lock_); if (!abort_association_) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod( diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.h b/chrome/browser/sync/glue/autofill_data_type_controller.h index 2daedb42..05b964c 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.h +++ b/chrome/browser/sync/glue/autofill_data_type_controller.h @@ -101,7 +101,7 @@ class AutofillDataTypeController : public DataTypeController, NotificationRegistrar notification_registrar_; - Lock abort_association_lock_; + base::Lock abort_association_lock_; bool abort_association_; base::WaitableEvent abort_association_complete_; diff --git a/chrome/browser/sync/glue/autofill_model_associator.cc b/chrome/browser/sync/glue/autofill_model_associator.cc index 43e4db6..14b9f2b 100644 --- a/chrome/browser/sync/glue/autofill_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_model_associator.cc @@ -136,7 +136,7 @@ bool AutofillModelAssociator::AssociateModels() { VLOG(1) << "Associating Autofill Models"; DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = false; } @@ -401,7 +401,7 @@ bool AutofillModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) { void AutofillModelAssociator::AbortAssociation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = true; } @@ -454,7 +454,7 @@ bool AutofillModelAssociator::GetSyncIdForTaggedNode(const std::string& tag, } bool AutofillModelAssociator::IsAbortPending() { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); return abort_association_pending_; } diff --git a/chrome/browser/sync/glue/autofill_model_associator.h b/chrome/browser/sync/glue/autofill_model_associator.h index fb660e6..a0eee27 100644 --- a/chrome/browser/sync/glue/autofill_model_associator.h +++ b/chrome/browser/sync/glue/autofill_model_associator.h @@ -12,8 +12,8 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "chrome/browser/autofill/personal_data_manager.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/model_associator.h" @@ -183,7 +183,7 @@ class AutofillModelAssociator // Abort association pending flag and lock. If this is set to true // (via the AbortAssociation method), return from the // AssociateModels method as soon as possible. - Lock abort_association_pending_lock_; + base::Lock abort_association_pending_lock_; bool abort_association_pending_; int number_of_entries_created_; diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator.cc b/chrome/browser/sync/glue/autofill_profile_model_associator.cc index c517e2c..d6a6792 100644 --- a/chrome/browser/sync/glue/autofill_profile_model_associator.cc +++ b/chrome/browser/sync/glue/autofill_profile_model_associator.cc @@ -129,7 +129,7 @@ bool AutofillProfileModelAssociator::AssociateModels() { VLOG(1) << "Associating Autofill Models"; DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = false; } @@ -458,7 +458,7 @@ int64 AutofillProfileModelAssociator::GetSyncIdFromChromeId( void AutofillProfileModelAssociator::AbortAssociation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = true; } @@ -469,7 +469,7 @@ const std::string* AutofillProfileModelAssociator::GetChromeNodeFromSyncId( } bool AutofillProfileModelAssociator::IsAbortPending() { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); return abort_association_pending_; } diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator.h b/chrome/browser/sync/glue/autofill_profile_model_associator.h index e2abdaf..3286283 100644 --- a/chrome/browser/sync/glue/autofill_profile_model_associator.h +++ b/chrome/browser/sync/glue/autofill_profile_model_associator.h @@ -12,8 +12,8 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "chrome/browser/autofill/personal_data_manager.h" #include "chrome/browser/sync/engine/syncapi.h" #include "chrome/browser/sync/glue/model_associator.h" @@ -175,7 +175,7 @@ class AutofillProfileModelAssociator // Abort association pending flag and lock. If this is set to true // (via the AbortAssociation method), return from the // AssociateModels method as soon as possible. - Lock abort_association_pending_lock_; + base::Lock abort_association_pending_lock_; bool abort_association_pending_; int number_of_profiles_created_; diff --git a/chrome/browser/sync/glue/password_model_associator.cc b/chrome/browser/sync/glue/password_model_associator.cc index 3c9d01a..d6708b5 100644 --- a/chrome/browser/sync/glue/password_model_associator.cc +++ b/chrome/browser/sync/glue/password_model_associator.cc @@ -41,7 +41,7 @@ PasswordModelAssociator::~PasswordModelAssociator() {} bool PasswordModelAssociator::AssociateModels() { DCHECK(expected_loop_ == MessageLoop::current()); { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = false; } @@ -194,7 +194,7 @@ bool PasswordModelAssociator::SyncModelHasUserCreatedNodes(bool* has_nodes) { void PasswordModelAssociator::AbortAssociation() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); abort_association_pending_ = true; } @@ -210,7 +210,7 @@ bool PasswordModelAssociator::InitSyncNodeFromChromeId( } bool PasswordModelAssociator::IsAbortPending() { - AutoLock lock(abort_association_pending_lock_); + base::AutoLock lock(abort_association_pending_lock_); return abort_association_pending_; } diff --git a/chrome/browser/sync/glue/password_model_associator.h b/chrome/browser/sync/glue/password_model_associator.h index 15eb3724..cfe0dab 100644 --- a/chrome/browser/sync/glue/password_model_associator.h +++ b/chrome/browser/sync/glue/password_model_associator.h @@ -11,7 +11,7 @@ #include <vector> #include "base/basictypes.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/task.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/sync/glue/model_associator.h" @@ -132,7 +132,7 @@ class PasswordModelAssociator // Abort association pending flag and lock. If this is set to true // (via the AbortAssociation method), return from the // AssociateModels method as soon as possible. - Lock abort_association_pending_lock_; + base::Lock abort_association_pending_lock_; bool abort_association_pending_; MessageLoop* expected_loop_; diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index 62b9aae..3e600e1 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -156,7 +156,7 @@ std::string SyncBackendHost::RestoreEncryptionBootstrapToken() { } bool SyncBackendHost::IsNigoriEnabled() const { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); // Note that NIGORI is only ever added/removed from routing_info once, // during initialization / first configuration, so there is no real 'race' // possible here or possibility of stale return value. @@ -333,7 +333,7 @@ void SyncBackendHost::ConfigureDataTypes( bool deleted_type = false; { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); for (DataTypeController::TypeMap::const_iterator it = data_type_controllers.begin(); it != data_type_controllers.end(); ++it) { @@ -391,7 +391,7 @@ void SyncBackendHost::RequestNudge() { void SyncBackendHost::ActivateDataType( DataTypeController* data_type_controller, ChangeProcessor* change_processor) { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); // Ensure that the given data type is in the PASSIVE group. browser_sync::ModelSafeRoutingInfo::iterator i = @@ -411,7 +411,7 @@ void SyncBackendHost::ActivateDataType( void SyncBackendHost::DeactivateDataType( DataTypeController* data_type_controller, ChangeProcessor* change_processor) { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); registrar_.routing_info.erase(data_type_controller->type()); std::map<syncable::ModelType, ChangeProcessor*>::size_type erased = @@ -516,7 +516,7 @@ const SyncSessionSnapshot* SyncBackendHost::GetLastSessionSnapshot() const { } void SyncBackendHost::GetWorkers(std::vector<ModelSafeWorker*>* out) { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); out->clear(); for (WorkerMap::const_iterator it = registrar_.workers.begin(); it != registrar_.workers.end(); ++it) { @@ -525,7 +525,7 @@ void SyncBackendHost::GetWorkers(std::vector<ModelSafeWorker*>* out) { } void SyncBackendHost::GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { - AutoLock lock(registrar_lock_); + base::AutoLock lock(registrar_lock_); ModelSafeRoutingInfo copy(registrar_.routing_info); out->swap(copy); } @@ -771,7 +771,7 @@ void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop() { bool SyncBackendHost::Core::IsCurrentThreadSafeForModel( syncable::ModelType model_type) { - AutoLock lock(host_->registrar_lock_); + base::AutoLock lock(host_->registrar_lock_); browser_sync::ModelSafeRoutingInfo::const_iterator routing_it = host_->registrar_.routing_info.find(model_type); diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h index cd418aa..964f7a5 100644 --- a/chrome/browser/sync/glue/sync_backend_host.h +++ b/chrome/browser/sync/glue/sync_backend_host.h @@ -11,9 +11,9 @@ #include <vector> #include "base/file_path.h" -#include "base/lock.h" #include "base/message_loop.h" #include "base/ref_counted.h" +#include "base/synchronization/lock.h" #include "base/threading/thread.h" #include "base/timer.h" #include "base/utf_string_conversions.h" @@ -507,7 +507,7 @@ class SyncBackendHost : public browser_sync::ModelSafeWorkerRegistrar { // pointer value", and then invoke methods), because lifetimes are managed on // the UI thread. Of course, this comment only applies to ModelSafeWorker // impls that are themselves thread-safe, such as UIModelWorker. - mutable Lock registrar_lock_; + mutable base::Lock registrar_lock_; // The frontend which we serve (and are owned by). SyncFrontend* frontend_; diff --git a/chrome/browser/sync/syncable/directory_manager.cc b/chrome/browser/sync/syncable/directory_manager.cc index fbdeb46..989fd0e 100644 --- a/chrome/browser/sync/syncable/directory_manager.cc +++ b/chrome/browser/sync/syncable/directory_manager.cc @@ -44,7 +44,7 @@ DirectoryManager::DirectoryManager(const FilePath& path) } DirectoryManager::~DirectoryManager() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); DCHECK_EQ(managed_directory_, static_cast<Directory*>(NULL)) << "Dir " << managed_directory_->name() << " not closed!"; delete channel_; @@ -63,7 +63,7 @@ DirOpenResult DirectoryManager::OpenImpl(const std::string& name, bool* was_open) { bool opened = false; { - AutoLock lock(lock_); + base::AutoLock lock(lock_); // Check to see if it's already open. if (managed_directory_) { DCHECK_EQ(ComparePathNames(name, managed_directory_->name()), 0) @@ -79,7 +79,7 @@ DirOpenResult DirectoryManager::OpenImpl(const std::string& name, scoped_ptr<Directory> dir(new Directory); const DirOpenResult result = dir->Open(path, name); if (syncable::OPENED == result) { - AutoLock lock(lock_); + base::AutoLock lock(lock_); managed_directory_ = dir.release(); } return result; @@ -90,7 +90,7 @@ DirOpenResult DirectoryManager::OpenImpl(const std::string& name, void DirectoryManager::Close(const std::string& name) { // Erase from mounted and opened directory lists. { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (!managed_directory_ || ComparePathNames(name, managed_directory_->name()) != 0) { // It wasn't open. @@ -109,14 +109,14 @@ void DirectoryManager::Close(const std::string& name) { } void DirectoryManager::FinalSaveChangesForAll() { - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (managed_directory_) managed_directory_->SaveChanges(); } void DirectoryManager::GetOpenDirectories(DirNames* result) { result->clear(); - AutoLock lock(lock_); + base::AutoLock lock(lock_); if (managed_directory_) result->push_back(managed_directory_->name()); } diff --git a/chrome/browser/sync/syncable/directory_manager.h b/chrome/browser/sync/syncable/directory_manager.h index 0c0b55d..625d082 100644 --- a/chrome/browser/sync/syncable/directory_manager.h +++ b/chrome/browser/sync/syncable/directory_manager.h @@ -18,7 +18,7 @@ #include "base/basictypes.h" #include "base/file_path.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "chrome/browser/sync/syncable/dir_open_result.h" #include "chrome/browser/sync/syncable/path_name_cmp.h" #include "chrome/browser/sync/syncable/syncable.h" @@ -87,7 +87,7 @@ class DirectoryManager { const FilePath root_path_; // protects managed_directory_ - Lock lock_; + base::Lock lock_; Directory* managed_directory_; Channel* const channel_; diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc index 93ca8bb..83053fa 100644 --- a/chrome/browser/sync/syncable/syncable.cc +++ b/chrome/browser/sync/syncable/syncable.cc @@ -586,7 +586,7 @@ bool Directory::SaveChanges() { bool success = false; DCHECK(store_); - AutoLock scoped_lock(kernel_->save_changes_mutex); + base::AutoLock scoped_lock(kernel_->save_changes_mutex); // Snapshot and save. SaveChangesSnapshot snapshot; @@ -1141,7 +1141,7 @@ bool BaseTransaction::NotifyTransactionChangingAndEnding( { // Scoped_lock is only active through the calculate_changes and // transaction_ending events. - AutoLock scoped_lock(dirkernel_->changes_channel_mutex); + base::AutoLock scoped_lock(dirkernel_->changes_channel_mutex); // Tell listeners to calculate changes while we still have the mutex. DirectoryChangeEvent event = { DirectoryChangeEvent::CALCULATE_CHANGES, diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h index d3b7527..4e1b0b9 100644 --- a/chrome/browser/sync/syncable/syncable.h +++ b/chrome/browser/sync/syncable/syncable.h @@ -18,7 +18,7 @@ #include "base/basictypes.h" #include "base/file_path.h" #include "base/gtest_prod_util.h" -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "base/time.h" #include "chrome/browser/sync/protocol/sync.pb.h" #include "chrome/browser/sync/syncable/autofill_migration.h" @@ -807,7 +807,7 @@ class Directory { } }; public: - typedef EventChannel<DirectoryEventTraits, Lock> Channel; + typedef EventChannel<DirectoryEventTraits, base::Lock> Channel; typedef std::vector<int64> ChildHandles; // Returns the child meta handles for given parent id. @@ -960,7 +960,7 @@ class Directory { volatile base::subtle::AtomicWord refcount; // Implements ReadTransaction / WriteTransaction using a simple lock. - Lock transaction_mutex; + base::Lock transaction_mutex; // The name of this directory. std::string const name; @@ -972,7 +972,7 @@ class Directory { // // Never hold the mutex and do anything with the database or any // other buffered IO. Violating this rule will result in deadlock. - Lock mutex; + base::Lock mutex; MetahandlesIndex* metahandles_index; // Entries indexed by metahandle IdsIndex* ids_index; // Entries indexed by id ParentIdChildIndex* parent_id_child_index; @@ -1000,7 +1000,7 @@ class Directory { // releasing the transaction mutex. browser_sync::Channel<DirectoryChangeEvent> changes_channel; - Lock changes_channel_mutex; + base::Lock changes_channel_mutex; KernelShareInfoStatus info_status; // These 3 members are backed in the share_info table, and @@ -1016,7 +1016,7 @@ class Directory { // It doesn't make sense for two threads to run SaveChanges at the same // time; this mutex protects that activity. - Lock save_changes_mutex; + base::Lock save_changes_mutex; // The next metahandle is protected by kernel mutex. int64 next_metahandle; @@ -1036,7 +1036,7 @@ class ScopedKernelLock { explicit ScopedKernelLock(const Directory*); ~ScopedKernelLock() {} - AutoLock scoped_lock_; + base::AutoLock scoped_lock_; Directory* const dir_; DISALLOW_COPY_AND_ASSIGN(ScopedKernelLock); }; diff --git a/chrome/browser/sync/util/channel.h b/chrome/browser/sync/util/channel.h index 88ddfc4..839d653 100644 --- a/chrome/browser/sync/util/channel.h +++ b/chrome/browser/sync/util/channel.h @@ -50,8 +50,8 @@ // /////////////////////////////////////////////////////////////////////////////// -#include "base/lock.h" #include "base/observer_list.h" +#include "base/synchronization/lock.h" #include "base/threading/platform_thread.h" namespace browser_sync { @@ -98,7 +98,7 @@ class Channel { ChannelHookup<EventType>* AddObserver( ChannelEventHandler<EventType>* observer) { - AutoLock scoped_lock(event_handlers_mutex_); + base::AutoLock scoped_lock(event_handlers_mutex_); event_handlers_.AddObserver(observer); return new ChannelHookup<EventType>(this, observer); } @@ -117,7 +117,7 @@ class Channel { } void Notify(const EventType& event) { - AutoLock scoped_lock(event_handlers_mutex_); + base::AutoLock scoped_lock(event_handlers_mutex_); // This may result in an observer trying to remove itself, so keep track // of the thread we're locked on. @@ -135,7 +135,7 @@ class Channel { } private: - Lock event_handlers_mutex_; + base::Lock event_handlers_mutex_; base::PlatformThreadId locking_thread_; ObserverList<EventHandler> event_handlers_; }; diff --git a/chrome/browser/sync/util/extensions_activity_monitor.cc b/chrome/browser/sync/util/extensions_activity_monitor.cc index aad4ab6..8c7a52a 100644 --- a/chrome/browser/sync/util/extensions_activity_monitor.cc +++ b/chrome/browser/sync/util/extensions_activity_monitor.cc @@ -65,13 +65,13 @@ ExtensionsActivityMonitor::~ExtensionsActivityMonitor() { } void ExtensionsActivityMonitor::GetAndClearRecords(Records* buffer) { - AutoLock lock(records_lock_); + base::AutoLock lock(records_lock_); buffer->clear(); buffer->swap(records_); } void ExtensionsActivityMonitor::PutRecords(const Records& records) { - AutoLock lock(records_lock_); + base::AutoLock lock(records_lock_); 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; @@ -81,7 +81,7 @@ void ExtensionsActivityMonitor::PutRecords(const Records& records) { void ExtensionsActivityMonitor::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - AutoLock lock(records_lock_); + base::AutoLock lock(records_lock_); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const Extension* extension = Source<const Extension>(source).ptr(); const BookmarksFunction* f = Details<const BookmarksFunction>(details).ptr(); diff --git a/chrome/browser/sync/util/extensions_activity_monitor.h b/chrome/browser/sync/util/extensions_activity_monitor.h index f4d1037..f19090d 100644 --- a/chrome/browser/sync/util/extensions_activity_monitor.h +++ b/chrome/browser/sync/util/extensions_activity_monitor.h @@ -8,8 +8,8 @@ #include <map> -#include "base/lock.h" #include "base/message_loop.h" +#include "base/synchronization/lock.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" @@ -62,7 +62,7 @@ class ExtensionsActivityMonitor : public NotificationObserver { const NotificationDetails& details); private: Records records_; - mutable Lock records_lock_; + mutable base::Lock records_lock_; // Used only from UI loop. NotificationRegistrar registrar_; diff --git a/chrome/browser/sync/util/user_settings.cc b/chrome/browser/sync/util/user_settings.cc index 9f52088..d49a071 100644 --- a/chrome/browser/sync/util/user_settings.cc +++ b/chrome/browser/sync/util/user_settings.cc @@ -79,7 +79,7 @@ UserSettings::UserSettings() : dbhandle_(NULL) { } string UserSettings::email() const { - AutoLock lock(mutex_); + base::AutoLock lock(mutex_); return email_; } @@ -421,7 +421,7 @@ bool UserSettings::VerifyAgainstStoredHash(const string& email, void UserSettings::SwitchUser(const string& username) { { - AutoLock lock(mutex_); + base::AutoLock lock(mutex_); email_ = username; } } diff --git a/chrome/browser/sync/util/user_settings.h b/chrome/browser/sync/util/user_settings.h index 5545c8c..546c8b0 100644 --- a/chrome/browser/sync/util/user_settings.h +++ b/chrome/browser/sync/util/user_settings.h @@ -9,7 +9,7 @@ #include <map> #include <string> -#include "base/lock.h" +#include "base/synchronization/lock.h" #include "build/build_config.h" extern "C" struct sqlite3; @@ -79,7 +79,7 @@ class UserSettings { struct ScopedDBHandle { explicit ScopedDBHandle(UserSettings* settings); inline sqlite3* get() const { return *handle_; } - AutoLock mutex_lock_; + base::AutoLock mutex_lock_; sqlite3** const handle_; }; @@ -90,11 +90,11 @@ class UserSettings { private: std::string email_; - mutable Lock mutex_; // protects email_. + mutable base::Lock mutex_; // protects email_. // We keep a single dbhandle. sqlite3* dbhandle_; - Lock dbhandle_mutex_; + base::Lock dbhandle_mutex_; // TODO(sync): Use in-memory cache for service auth tokens on posix. // Have someone competent in Windows switch it over to not use Sqlite in the |