Index: third_party/mojo/src/mojo/edk/system/channel.cc |
diff --git a/third_party/mojo/src/mojo/edk/system/channel.cc b/third_party/mojo/src/mojo/edk/system/channel.cc |
index 601ddb0699d4dd1283fc7ff4367baa53358f3f12..470956f780e8791e00de59f5a05d5d5f2c74cb2d 100644 |
--- a/third_party/mojo/src/mojo/edk/system/channel.cc |
+++ b/third_party/mojo/src/mojo/edk/system/channel.cc |
@@ -39,7 +39,7 @@ |
DCHECK(creation_thread_checker_.CalledOnValidThread()); |
DCHECK(raw_channel); |
- // No need to take |mutex_|, since this must be called before this object |
+ // No need to take |lock_|, since this must be called before this object |
// becomes thread-safe. |
DCHECK(!is_running_); |
raw_channel_ = raw_channel.Pass(); |
@@ -50,7 +50,7 @@ |
void Channel::SetChannelManager(ChannelManager* channel_manager) { |
DCHECK(channel_manager); |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
DCHECK(!is_shutting_down_); |
DCHECK(!channel_manager_); |
channel_manager_ = channel_manager; |
@@ -61,7 +61,7 @@ |
IdToEndpointMap to_destroy; |
{ |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
if (!is_running_) |
return; |
@@ -91,7 +91,7 @@ |
} |
void Channel::WillShutdownSoon() { |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
is_shutting_down_ = true; |
channel_manager_ = nullptr; |
} |
@@ -109,7 +109,7 @@ |
DCHECK(endpoint); |
{ |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
DLOG_IF(WARNING, is_shutting_down_) |
<< "SetBootstrapEndpoint() while shutting down"; |
@@ -125,7 +125,7 @@ |
} |
bool Channel::WriteMessage(scoped_ptr<MessageInTransit> message) { |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
if (!is_running_) { |
// TODO(vtl): I think this is probably not an error condition, but I should |
// think about it (and the shutdown sequence) more carefully. |
@@ -138,7 +138,7 @@ |
} |
bool Channel::IsWriteBufferEmpty() { |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
if (!is_running_) |
return true; |
return raw_channel_->IsWriteBufferEmpty(); |
@@ -154,7 +154,7 @@ |
return; // Nothing to do. |
{ |
- MutexLocker locker_(&mutex_); |
+ base::AutoLock locker_(lock_); |
if (!is_running_) |
return; |
@@ -247,7 +247,7 @@ |
DVLOG_IF(2, !local_id.is_valid() || !local_id.is_remote()) |
<< "Attempt to get incoming endpoint for invalid ID " << local_id; |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
auto it = incoming_endpoints_.find(local_id); |
if (it == incoming_endpoints_.end()) { |
@@ -264,9 +264,6 @@ |
} |
size_t Channel::GetSerializedPlatformHandleSize() const { |
- // TODO(vtl): Having to lock |mutex_| here is a bit unfortunate. Maybe we |
- // should get the size in |Init()| and cache it? |
- MutexLocker locker(&mutex_); |
return raw_channel_->GetSerializedPlatformHandleSize(); |
} |
@@ -306,7 +303,7 @@ |
DVLOG(1) << "RawChannel read error (shutdown)"; |
break; |
case ERROR_READ_BROKEN: { |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
LOG_IF(ERROR, !is_shutting_down_) |
<< "RawChannel read error (connection broken)"; |
break; |
@@ -343,7 +340,7 @@ |
scoped_refptr<ChannelEndpoint> endpoint; |
{ |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
// Since we own |raw_channel_|, and this method and |Shutdown()| should only |
// be called from the creation thread, |raw_channel_| should never be null |
@@ -462,7 +459,7 @@ |
bool success = true; |
{ |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
if (local_id_to_endpoint_map_.find(local_id) == |
local_id_to_endpoint_map_.end()) { |
@@ -493,7 +490,7 @@ |
scoped_refptr<ChannelEndpoint> endpoint; |
{ |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
IdToEndpointMap::iterator it = local_id_to_endpoint_map_.find(local_id); |
if (it == local_id_to_endpoint_map_.end()) { |
@@ -529,7 +526,7 @@ |
bool Channel::OnRemoveEndpointAck(ChannelEndpointId local_id) { |
DCHECK(creation_thread_checker_.CalledOnValidThread()); |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
IdToEndpointMap::iterator it = local_id_to_endpoint_map_.find(local_id); |
if (it == local_id_to_endpoint_map_.end()) { |
@@ -572,7 +569,7 @@ |
ChannelEndpointId local_id; |
ChannelEndpointId remote_id; |
{ |
- MutexLocker locker(&mutex_); |
+ base::AutoLock locker(lock_); |
DLOG_IF(WARNING, is_shutting_down_) |
<< "AttachAndRunEndpoint() while shutting down"; |