Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1147)

Unified Diff: mojo/edk/system/raw_channel.cc

Issue 1337953004: base::Lock -> Mutex in RawChannel. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/raw_channel.h ('k') | mojo/edk/system/raw_channel_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/raw_channel.cc
diff --git a/mojo/edk/system/raw_channel.cc b/mojo/edk/system/raw_channel.cc
index ac9f3ffc32a603119d5d2d0fb21173fac00a8960..20f74d28de86d1a2c320663ed2c2f1cbea1afd48 100644
--- a/mojo/edk/system/raw_channel.cc
+++ b/mojo/edk/system/raw_channel.cc
@@ -163,7 +163,7 @@ RawChannel::~RawChannel() {
DCHECK(!read_buffer_);
DCHECK(!write_buffer_);
- // No need to take the |write_lock_| here -- if there are still weak pointers
+ // No need to take |write_mutex_| here -- if there are still weak pointers
// outstanding, then we're hosed anyway (since we wouldn't be able to
// invalidate them cleanly, since we might not be on the I/O thread).
DCHECK(!weak_ptr_factory_.HasWeakPtrs());
@@ -203,7 +203,7 @@ void RawChannel::Init(Delegate* delegate) {
void RawChannel::Shutdown() {
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
- base::AutoLock locker(write_lock_);
+ MutexLocker locker(&write_mutex_);
LOG_IF(WARNING, !write_buffer_->message_queue_.IsEmpty())
<< "Shutting down RawChannel with write buffer nonempty";
@@ -224,7 +224,7 @@ void RawChannel::Shutdown() {
bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) {
DCHECK(message);
- base::AutoLock locker(write_lock_);
+ MutexLocker locker(&write_mutex_);
if (write_stopped_)
return false;
@@ -258,7 +258,7 @@ bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) {
// Reminder: This must be thread-safe.
bool RawChannel::IsWriteBufferEmpty() {
- base::AutoLock locker(write_lock_);
+ MutexLocker locker(&write_mutex_);
return write_buffer_->message_queue_.IsEmpty();
}
@@ -412,7 +412,7 @@ void RawChannel::OnWriteCompleted(IOResult io_result,
bool did_fail = false;
{
- base::AutoLock locker(write_lock_);
+ MutexLocker locker(&write_mutex_);
DCHECK_EQ(write_stopped_, write_buffer_->message_queue_.IsEmpty());
if (write_stopped_) {
@@ -431,7 +431,7 @@ void RawChannel::OnWriteCompleted(IOResult io_result,
}
void RawChannel::EnqueueMessageNoLock(scoped_ptr<MessageInTransit> message) {
- write_lock_.AssertAcquired();
+ write_mutex_.AssertHeld();
write_buffer_->message_queue_.AddMessage(message.Pass());
}
@@ -463,7 +463,7 @@ RawChannel::Delegate::Error RawChannel::ReadIOResultToError(
void RawChannel::CallOnError(Delegate::Error error) {
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
- // TODO(vtl): Add a "write_lock_.AssertNotAcquired()"?
+ // TODO(vtl): Add a "write_mutex_.AssertNotHeld()"?
if (delegate_) {
delegate_->OnError(error);
return; // |this| may have been destroyed in |OnError()|.
@@ -473,7 +473,7 @@ void RawChannel::CallOnError(Delegate::Error error) {
bool RawChannel::OnWriteCompletedNoLock(IOResult io_result,
size_t platform_handles_written,
size_t bytes_written) {
- write_lock_.AssertAcquired();
+ write_mutex_.AssertHeld();
DCHECK(!write_stopped_);
DCHECK(!write_buffer_->message_queue_.IsEmpty());
« no previous file with comments | « mojo/edk/system/raw_channel.h ('k') | mojo/edk/system/raw_channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698