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

Unified Diff: mojo/system/raw_channel.cc

Issue 297683012: Mojo: Add a RawChannel::EnqueueMessage() that can be overridden by subclasses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/system/raw_channel.h ('k') | mojo/system/raw_channel_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/raw_channel.cc
diff --git a/mojo/system/raw_channel.cc b/mojo/system/raw_channel.cc
index f7c74ae882a8410ca7731cd2281f1dc6439fc7c5..6fffa86a0a9baef7c8d5a80a4cb94d5408a0f5e3 100644
--- a/mojo/system/raw_channel.cc
+++ b/mojo/system/raw_channel.cc
@@ -219,11 +219,11 @@ bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) {
return false;
if (!write_buffer_->message_queue_.empty()) {
- write_buffer_->message_queue_.push_back(message.release());
+ EnqueueMessageNoLock(message.Pass());
return true;
}
- write_buffer_->message_queue_.push_front(message.release());
+ EnqueueMessageNoLock(message.Pass());
DCHECK_EQ(write_buffer_->data_offset_, 0u);
size_t platform_handles_written = 0;
@@ -254,16 +254,6 @@ bool RawChannel::IsWriteBufferEmpty() {
return write_buffer_->message_queue_.empty();
}
-RawChannel::ReadBuffer* RawChannel::read_buffer() {
- DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
- return read_buffer_.get();
-}
-
-RawChannel::WriteBuffer* RawChannel::write_buffer_no_lock() {
- write_lock_.AssertAcquired();
- return write_buffer_.get();
-}
-
void RawChannel::OnReadCompleted(bool result, size_t bytes_read) {
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
@@ -423,6 +413,11 @@ void RawChannel::OnWriteCompleted(bool result,
CallOnFatalError(Delegate::FATAL_ERROR_FAILED_WRITE);
}
+void RawChannel::EnqueueMessageNoLock(scoped_ptr<MessageInTransit> message) {
+ write_lock_.AssertAcquired();
+ write_buffer_->message_queue_.push_back(message.release());
+}
+
void RawChannel::CallOnFatalError(Delegate::FatalError fatal_error) {
DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
// TODO(vtl): Add a "write_lock_.AssertNotAcquired()"?
« no previous file with comments | « mojo/system/raw_channel.h ('k') | mojo/system/raw_channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698