| Index: mojo/public/cpp/bindings/lib/connector.cc
|
| diff --git a/mojo/public/cpp/bindings/lib/connector.cc b/mojo/public/cpp/bindings/lib/connector.cc
|
| index 9f1037ceae81b09ef3948d6532b7f1cec9a524ff..a4c1c34558bfcbddbc614b0eb5fb7d4d26f7fac8 100644
|
| --- a/mojo/public/cpp/bindings/lib/connector.cc
|
| +++ b/mojo/public/cpp/bindings/lib/connector.cc
|
| @@ -87,9 +87,13 @@ ScopedMessagePipeHandle Connector::PassMessagePipe() {
|
| return std::move(message_pipe_);
|
| }
|
|
|
| -void Connector::RaiseError() {
|
| +void Connector::RaiseError(Error error) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| + // If this was a message validation error, notify the system of a bad message.
|
| + if (error.type() == Error::Type::BAD_MESSAGE)
|
| + error.message().NotifyBadMessage(error.details());
|
| +
|
| HandleError(true, true);
|
| }
|
|
|
| @@ -135,14 +139,16 @@ void Connector::ResumeIncomingMethodCallProcessing() {
|
| WaitToReadMore();
|
| }
|
|
|
| -bool Connector::Accept(Message* message) {
|
| +bool Connector::Accept(Message* message, Error* error) {
|
| DCHECK(lock_ || thread_checker_.CalledOnValidThread());
|
|
|
| // It shouldn't hurt even if |error_| may be changed by a different thread at
|
| // the same time. The outcome is that we may write into |message_pipe_| after
|
| // encountering an error, which should be fine.
|
| - if (error_)
|
| + if (error_) {
|
| + *error = Error(Error::Type::SEND_FAILED);
|
| return false;
|
| + }
|
|
|
| MayAutoLock locker(lock_.get());
|
|
|
| @@ -179,6 +185,7 @@ bool Connector::Accept(Message* message) {
|
| default:
|
| // This particular write was rejected, presumably because of bad input.
|
| // The pipe is not necessarily in a bad state.
|
| + *error = Error(Error::Type::SEND_FAILED);
|
| return false;
|
| }
|
| return true;
|
| @@ -266,9 +273,11 @@ bool Connector::ReadSingleMessage(MojoResult* read_result) {
|
| const MojoResult rv = ReadMessage(message_pipe_.get(), &message);
|
| *read_result = rv;
|
|
|
| - if (rv == MOJO_RESULT_OK) {
|
| - receiver_result =
|
| - incoming_receiver_ && incoming_receiver_->Accept(&message);
|
| + if (rv == MOJO_RESULT_OK && incoming_receiver_) {
|
| + Error error(Error::Type::NONE);
|
| + receiver_result = incoming_receiver_->Accept(&message, &error);
|
| + if (!receiver_result && error.type() == Error::Type::BAD_MESSAGE)
|
| + error.message().NotifyBadMessage(error.details());
|
| }
|
|
|
| if (!weak_self)
|
|
|