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

Unified Diff: mojo/system/raw_channel.h

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 | « no previous file | mojo/system/raw_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/raw_channel.h
diff --git a/mojo/system/raw_channel.h b/mojo/system/raw_channel.h
index 9ebd679af22f48354f898b83d05980a6c2cd75fa..8021e2fbd3071799fca075944e63262c7df3f24b 100644
--- a/mojo/system/raw_channel.h
+++ b/mojo/system/raw_channel.h
@@ -185,14 +185,29 @@ class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
RawChannel();
+ // Must be called on the I/O thread WITHOUT |write_lock_| held.
+ void OnReadCompleted(bool result, size_t bytes_read);
+ // Must be called on the I/O thread WITHOUT |write_lock_| held.
+ void OnWriteCompleted(bool result,
+ size_t platform_handles_written,
+ size_t bytes_written);
+
base::MessageLoopForIO* message_loop_for_io() { return message_loop_for_io_; }
base::Lock& write_lock() { return write_lock_; }
- // Only accessed on the I/O thread.
- ReadBuffer* read_buffer();
+ // Should only be called on the I/O thread.
+ ReadBuffer* read_buffer() { return read_buffer_.get(); }
+
+ // Only called under |write_lock_|.
+ WriteBuffer* write_buffer_no_lock() {
+ write_lock_.AssertAcquired();
+ return write_buffer_.get();
+ }
- // Only accessed under |write_lock_|.
- WriteBuffer* write_buffer_no_lock();
+ // Adds |message| to the write message queue. Implementation subclasses may
+ // override this to add any additional "control" messages needed. This is
+ // called (on any thread) with |write_lock_| held.
+ virtual void EnqueueMessageNoLock(scoped_ptr<MessageInTransit> message);
// Reads into |read_buffer()|.
// This class guarantees that:
@@ -249,13 +264,6 @@ class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
scoped_ptr<ReadBuffer> read_buffer,
scoped_ptr<WriteBuffer> write_buffer) = 0;
- // Must be called on the I/O thread WITHOUT |write_lock_| held.
- void OnReadCompleted(bool result, size_t bytes_read);
- // Must be called on the I/O thread WITHOUT |write_lock_| held.
- void OnWriteCompleted(bool result,
- size_t platform_handles_written,
- size_t bytes_written);
-
private:
// Calls |delegate_->OnFatalError(fatal_error)|. Must be called on the I/O
// thread WITHOUT |write_lock_| held.
« no previous file with comments | « no previous file | mojo/system/raw_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698