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

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

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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
Index: mojo/edk/system/message_in_transit.cc
diff --git a/third_party/mojo/src/mojo/edk/system/message_in_transit.cc b/mojo/edk/system/message_in_transit.cc
similarity index 89%
copy from third_party/mojo/src/mojo/edk/system/message_in_transit.cc
copy to mojo/edk/system/message_in_transit.cc
index 7ac54e1afdfe82f7d7795802184074ad7b631962..9505486957d7debf234406f84ae27036cfce2b9c 100644
--- a/third_party/mojo/src/mojo/edk/system/message_in_transit.cc
+++ b/mojo/edk/system/message_in_transit.cc
@@ -69,13 +69,12 @@ bool MessageInTransit::View::IsValid(size_t serialized_platform_handle_size,
}
MessageInTransit::MessageInTransit(Type type,
- Subtype subtype,
uint32_t num_bytes,
const void* bytes)
: main_buffer_size_(RoundUpMessageAlignment(sizeof(Header) + num_bytes)),
main_buffer_(static_cast<char*>(
base::AlignedAlloc(main_buffer_size_, kMessageAlignment))) {
- ConstructorHelper(type, subtype, num_bytes);
+ ConstructorHelper(type, num_bytes);
if (bytes) {
memcpy(MessageInTransit::bytes(), bytes, num_bytes);
memset(static_cast<char*>(MessageInTransit::bytes()) + num_bytes, 0,
@@ -86,13 +85,12 @@ MessageInTransit::MessageInTransit(Type type,
}
MessageInTransit::MessageInTransit(Type type,
- Subtype subtype,
uint32_t num_bytes,
UserPointer<const void> bytes)
: main_buffer_size_(RoundUpMessageAlignment(sizeof(Header) + num_bytes)),
main_buffer_(static_cast<char*>(
base::AlignedAlloc(main_buffer_size_, kMessageAlignment))) {
- ConstructorHelper(type, subtype, num_bytes);
+ ConstructorHelper(type, num_bytes);
bytes.GetArray(MessageInTransit::bytes(), num_bytes);
memset(static_cast<char*>(MessageInTransit::bytes()) + num_bytes, 0,
main_buffer_size_ - sizeof(Header) - num_bytes);
@@ -116,7 +114,13 @@ MessageInTransit::~MessageInTransit() {
if (!(*dispatchers_)[i])
continue;
- DCHECK((*dispatchers_)[i]->HasOneRef());
+
+
+
+
+
+ //TODO(jam): why?
+ /// DCHECK((*dispatchers_)[i]->HasOneRef());
(*dispatchers_)[i]->Close();
}
}
@@ -151,8 +155,15 @@ void MessageInTransit::SetDispatchers(
dispatchers_ = dispatchers.Pass();
#ifndef NDEBUG
- for (size_t i = 0; i < dispatchers_->size(); i++)
- DCHECK(!(*dispatchers_)[i] || (*dispatchers_)[i]->HasOneRef());
+ //for (size_t i = 0; i < dispatchers_->size(); i++)
+
+
+
+
+ // JAM: fires in process receiving MP. is this because it's posting task to
+ // do rawchannel::init onio?
+
+ //DCHECK(!(*dispatchers_)[i] || (*dispatchers_)[i]->HasOneRef());
#endif
}
@@ -166,29 +177,24 @@ void MessageInTransit::SetTransportData(
UpdateTotalSize();
}
-void MessageInTransit::SerializeAndCloseDispatchers(Channel* channel) {
- DCHECK(channel);
+void MessageInTransit::SerializeAndCloseDispatchers() {
DCHECK(!transport_data_);
if (!dispatchers_ || !dispatchers_->size())
return;
- transport_data_.reset(new TransportData(dispatchers_.Pass(), channel));
+ transport_data_.reset(new TransportData(dispatchers_.Pass()));
// Update the sizes in the message header.
UpdateTotalSize();
}
void MessageInTransit::ConstructorHelper(Type type,
- Subtype subtype,
uint32_t num_bytes) {
DCHECK_LE(num_bytes, GetConfiguration().max_message_num_bytes);
// |total_size| is updated below, from the other values.
header()->type = type;
- header()->subtype = subtype;
- header()->source_id = ChannelEndpointId();
- header()->destination_id = ChannelEndpointId();
header()->num_bytes = num_bytes;
header()->unused = 0;
// Note: If dispatchers are subsequently attached, then |total_size| will have

Powered by Google App Engine
This is Rietveld 408576698