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

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

Issue 2043713004: Mojo: Add NotifyBadMessage API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no bindings Created 4 years, 6 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/edk/system/core.h ('k') | mojo/edk/system/message_for_transit.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/core.cc
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc
index ef10e9c29d1465d18985ca84fc9210002cbf51fe..d8d861aee90a390bbe738b2a0b01fc599f6d7ac2 100644
--- a/mojo/edk/system/core.cc
+++ b/mojo/edk/system/core.cc
@@ -30,6 +30,7 @@
#include "mojo/edk/system/message_for_transit.h"
#include "mojo/edk/system/message_pipe_dispatcher.h"
#include "mojo/edk/system/platform_handle_dispatcher.h"
+#include "mojo/edk/system/ports/name.h"
#include "mojo/edk/system/ports/node.h"
#include "mojo/edk/system/remote_message_pipe_bootstrap.h"
#include "mojo/edk/system/request_context.h"
@@ -169,10 +170,12 @@ scoped_refptr<Dispatcher> Core::GetDispatcher(MojoHandle handle) {
void Core::AddChild(base::ProcessHandle process_handle,
ScopedPlatformHandle platform_handle,
- const std::string& child_token) {
+ const std::string& child_token,
+ const ProcessErrorCallback& process_error_callback) {
GetNodeController()->ConnectToChild(process_handle,
std::move(platform_handle),
- child_token);
+ child_token,
+ process_error_callback);
}
void Core::ChildLaunchFailed(const std::string& child_token) {
@@ -752,6 +755,24 @@ MojoResult Core::FuseMessagePipes(MojoHandle handle0, MojoHandle handle1) {
return MOJO_RESULT_OK;
}
+MojoResult Core::NotifyBadMessage(MojoMessageHandle message,
+ const char* error,
+ size_t error_num_bytes) {
+ if (!message)
+ return MOJO_RESULT_INVALID_ARGUMENT;
+
+ const PortsMessage& ports_message =
+ reinterpret_cast<MessageForTransit*>(message)->ports_message();
+ if (ports_message.source_node() == ports::kInvalidNodeName) {
+ DVLOG(1) << "Received invalid message from unknown node.";
+ return MOJO_RESULT_OK;
+ }
+
+ GetNodeController()->NotifyBadMessageFrom(
+ ports_message.source_node(), std::string(error, error_num_bytes));
+ return MOJO_RESULT_OK;
+}
+
MojoResult Core::CreateDataPipe(
const MojoCreateDataPipeOptions* options,
MojoHandle* data_pipe_producer_handle,
« no previous file with comments | « mojo/edk/system/core.h ('k') | mojo/edk/system/message_for_transit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698