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

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

Issue 795593004: Update mojo sdk to rev cc531b32182099a5a034a99daff35ed5d38a61c8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More workarounds for MSVC Created 6 years 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
Index: mojo/edk/system/raw_channel.cc
diff --git a/mojo/edk/system/raw_channel.cc b/mojo/edk/system/raw_channel.cc
index 433116680d0d3672f315473f779eaa8bf78cade1..aa9c95f98f33b9168c19c0a53554acb9c2d6dedf 100644
--- a/mojo/edk/system/raw_channel.cc
+++ b/mojo/edk/system/raw_channel.cc
@@ -76,19 +76,25 @@ void RawChannel::WriteBuffer::GetPlatformHandlesToSend(
void** serialization_data) {
DCHECK(HavePlatformHandlesToSend());
- TransportData* transport_data = message_queue_.front()->transport_data();
+ MessageInTransit* message = message_queue_.front();
+ TransportData* transport_data = message->transport_data();
embedder::PlatformHandleVector* all_platform_handles =
transport_data->platform_handles();
*num_platform_handles =
all_platform_handles->size() - platform_handles_offset_;
*platform_handles = &(*all_platform_handles)[platform_handles_offset_];
- size_t serialization_data_offset =
- transport_data->platform_handle_table_offset();
- DCHECK_GT(serialization_data_offset, 0u);
- serialization_data_offset +=
- platform_handles_offset_ * serialized_platform_handle_size_;
- *serialization_data =
- static_cast<char*>(transport_data->buffer()) + serialization_data_offset;
+
+ if (serialized_platform_handle_size_ > 0) {
+ size_t serialization_data_offset =
+ transport_data->platform_handle_table_offset();
+ DCHECK_GT(serialization_data_offset, 0u);
+ serialization_data_offset +=
+ platform_handles_offset_ * serialized_platform_handle_size_;
+ *serialization_data = static_cast<char*>(transport_data->buffer()) +
+ serialization_data_offset;
+ } else {
+ *serialization_data = nullptr;
+ }
}
void RawChannel::WriteBuffer::GetBuffers(std::vector<Buffer>* buffers) const {
« no previous file with comments | « mojo/edk/system/multiprocess_message_pipe_unittest.cc ('k') | mojo/edk/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698