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

Unified Diff: mojo/system/raw_channel_posix.cc

Issue 172953003: Mojo: Make MessageInTransit more opaque. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 10 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/message_in_transit.cc ('k') | mojo/system/raw_channel_posix_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/system/raw_channel_posix.cc
diff --git a/mojo/system/raw_channel_posix.cc b/mojo/system/raw_channel_posix.cc
index 15d3e4e0d060fed39590078866fdb49d147c6a6c..b395a599490afde35fe7d5dd1d232bc4549ab639 100644
--- a/mojo/system/raw_channel_posix.cc
+++ b/mojo/system/raw_channel_posix.cc
@@ -258,8 +258,7 @@ void RawChannelPosix::OnFileCanReadWithoutBlocking(int fd) {
DCHECK_EQ(reinterpret_cast<size_t>(message) %
MessageInTransit::kMessageAlignment, 0u);
// If we have the header, not the whole message....
- if (read_buffer_num_valid_bytes_ <
- message->size_with_header_and_padding())
+ if (read_buffer_num_valid_bytes_ < message->main_buffer_size())
break;
// Dispatch the message.
@@ -272,8 +271,8 @@ void RawChannelPosix::OnFileCanReadWithoutBlocking(int fd) {
did_dispatch_message = true;
// Update our state.
- read_buffer_start += message->size_with_header_and_padding();
- read_buffer_num_valid_bytes_ -= message->size_with_header_and_padding();
+ read_buffer_start += message->main_buffer_size();
+ read_buffer_num_valid_bytes_ -= message->main_buffer_size();
}
// If we dispatched any messages, stop reading for now (and let the message
@@ -353,12 +352,12 @@ bool RawChannelPosix::WriteFrontMessageNoLock() {
DCHECK(!write_message_queue_.empty());
MessageInTransit* message = write_message_queue_.front();
- DCHECK_LT(write_message_offset_, message->size_with_header_and_padding());
- size_t bytes_to_write =
- message->size_with_header_and_padding() - write_message_offset_;
+ DCHECK_LT(write_message_offset_, message->main_buffer_size());
+ size_t bytes_to_write = message->main_buffer_size() - write_message_offset_;
ssize_t bytes_written = HANDLE_EINTR(
write(fd_.get().fd,
- reinterpret_cast<char*>(message) + write_message_offset_,
+ static_cast<const char*>(message->main_buffer()) +
+ write_message_offset_,
bytes_to_write));
if (bytes_written < 0) {
if (errno != EAGAIN && errno != EWOULDBLOCK) {
« no previous file with comments | « mojo/system/message_in_transit.cc ('k') | mojo/system/raw_channel_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698