mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1713148 - Part 1: Expose UserMessageEvent to WillBeRoutedExternally, r=handyman
This is used because, unlike in Mojo, we cannot get from the IPC::Message object to its enclosing UserMessageEvent object to attach more ports to it, and this extra parameter makes that easy to do. Differential Revision: https://phabricator.services.mozilla.com/D116668
This commit is contained in:
parent
96dd5437ae
commit
0bfe790a38
@ -171,7 +171,7 @@ void UserMessageEvent::ReservePorts(size_t num_ports) {
|
||||
|
||||
bool UserMessageEvent::NotifyWillBeRoutedExternally() {
|
||||
DCHECK(message_);
|
||||
return message_->WillBeRoutedExternally();
|
||||
return message_->WillBeRoutedExternally(*this);
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -12,7 +12,7 @@ UserMessage::UserMessage(const TypeInfo* type_info) : type_info_(type_info) {}
|
||||
|
||||
UserMessage::~UserMessage() = default;
|
||||
|
||||
bool UserMessage::WillBeRoutedExternally() { return true; }
|
||||
bool UserMessage::WillBeRoutedExternally(UserMessageEvent&) { return true; }
|
||||
|
||||
size_t UserMessage::GetSizeIfSerialized() const { return 0; }
|
||||
|
||||
|
@ -11,6 +11,8 @@ namespace mojo {
|
||||
namespace core {
|
||||
namespace ports {
|
||||
|
||||
class UserMessageEvent;
|
||||
|
||||
// Base type to use for any embedder-defined user message implementation. This
|
||||
// class is intentionally empty.
|
||||
//
|
||||
@ -36,10 +38,14 @@ class UserMessage {
|
||||
// Invoked immediately before the system asks the embedder to forward this
|
||||
// message to an external node.
|
||||
//
|
||||
// The UserMessageEvent is passed in to allow ports and other such values to
|
||||
// be attached to the message before it is sent externally, in case late
|
||||
// serialization is performed.
|
||||
//
|
||||
// Returns |true| if the message is OK to route externally, or |false|
|
||||
// otherwise. Returning |false| implies an unrecoverable condition, and the
|
||||
// message event will be destroyed without further routing.
|
||||
virtual bool WillBeRoutedExternally();
|
||||
virtual bool WillBeRoutedExternally(UserMessageEvent& event);
|
||||
|
||||
// Returns the size in bytes of this message iff it's serialized. Zero
|
||||
// otherwise.
|
||||
|
Loading…
Reference in New Issue
Block a user