Index: ipc/ipc_message_pipe_reader.cc |
diff --git a/ipc/ipc_message_pipe_reader.cc b/ipc/ipc_message_pipe_reader.cc |
index 8e00d5c7b272e1a4a9795ce8802844f4d3d12601..a20489bb41107cac098cdcdfc464c590c13c21b8 100644 |
--- a/ipc/ipc_message_pipe_reader.cc |
+++ b/ipc/ipc_message_pipe_reader.cc |
@@ -21,36 +21,6 @@ |
namespace IPC { |
namespace internal { |
-namespace { |
- |
-// Used by Send() to capture a serialized Channel::Receive message. |
-class MessageSerializer : public mojo::MessageReceiverWithResponder { |
- public: |
- MessageSerializer() {} |
- ~MessageSerializer() override {} |
- |
- mojo::Message* message() { return &message_; } |
- |
- private: |
- // mojo::MessageReceiverWithResponder |
- bool Accept(mojo::Message* message) override { |
- message_ = std::move(*message); |
- return true; |
- } |
- |
- bool AcceptWithResponder(mojo::Message* message, |
- mojo::MessageReceiver* responder) override { |
- NOTREACHED(); |
- return false; |
- } |
- |
- mojo::Message message_; |
- |
- DISALLOW_COPY_AND_ASSIGN(MessageSerializer); |
-}; |
- |
-} // namespace |
- |
MessagePipeReader::MessagePipeReader( |
mojo::MessagePipeHandle pipe, |
mojom::ChannelAssociatedPtr sender, |
@@ -58,9 +28,7 @@ MessagePipeReader::MessagePipeReader( |
MessagePipeReader::Delegate* delegate) |
: delegate_(delegate), |
sender_(std::move(sender)), |
- binding_(this, std::move(receiver)), |
- sender_interface_id_(sender_.interface_id()), |
- sender_pipe_(pipe) { |
+ binding_(this, std::move(receiver)) { |
sender_.set_connection_error_handler( |
base::Bind(&MessagePipeReader::OnPipeError, base::Unretained(this), |
MOJO_RESULT_FAILED_PRECONDITION)); |
@@ -97,20 +65,13 @@ bool MessagePipeReader::Send(std::unique_ptr<Message> message) { |
reinterpret_cast<const uint8_t*>(message->data()) + message->size(), |
data.data()); |
- MessageSerializer serializer; |
- mojom::ChannelProxy proxy(&serializer); |
- proxy.Receive(data, std::move(handles)); |
- mojo::Message* mojo_message = serializer.message(); |
- |
- size_t num_handles = mojo_message->handles()->size(); |
- DCHECK_LE(num_handles, std::numeric_limits<uint32_t>::max()); |
+ if (!sender_) |
+ return false; |
- mojo_message->set_interface_id(sender_interface_id_); |
- result = mojo::WriteMessageNew(sender_pipe_, mojo_message->TakeMojoMessage(), |
- MOJO_WRITE_MESSAGE_FLAG_NONE); |
+ sender_->Receive(data, std::move(handles)); |
DVLOG(4) << "Send " << message->type() << ": " << message->size(); |
- return result == MOJO_RESULT_OK; |
+ return true; |
} |
void MessagePipeReader::GetRemoteInterface( |