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

Unified Diff: mojo/edk/system/ports/node.h

Issue 2466993004: Remove use of std::function from Mojo internals (Closed)
Patch Set: . Created 4 years, 1 month 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/ports/message_queue.cc ('k') | mojo/edk/system/ports/node.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/ports/node.h
diff --git a/mojo/edk/system/ports/node.h b/mojo/edk/system/ports/node.h
index 65252a3af716e044589b7bf83fb392cf17f8f2a5..5a20e1b8aba08287cb8179f1c32d524a04078009 100644
--- a/mojo/edk/system/ports/node.h
+++ b/mojo/edk/system/ports/node.h
@@ -44,6 +44,7 @@ struct PortStatus {
bool peer_closed;
};
+class MessageFilter;
class NodeDelegate;
class Node {
@@ -107,15 +108,15 @@ class Node {
// indicate that this port's peer has closed. In such cases GetMessage may
// be called until it yields a null message, indicating that no more messages
// may be read from the port.
- int GetMessage(const PortRef& port_ref, ScopedMessage* message);
-
- // Like GetMessage, but the caller may optionally supply a selector function
- // that decides whether or not to return the message. If |selector| is a
- // nullptr, then GetMessageIf acts just like GetMessage. The |selector| may
- // not call any Node methods.
- int GetMessageIf(const PortRef& port_ref,
- std::function<bool(const Message&)> selector,
- ScopedMessage* message);
+ //
+ // If |filter| is non-null, the next available message is returned only if it
+ // is matched by the filter. If the provided filter does not match the next
+ // available message, GetMessage() behaves as if there is no message
+ // available. Ownership of |filter| is not taken, and it must outlive the
+ // extent of this call.
+ int GetMessage(const PortRef& port_ref,
+ ScopedMessage* message,
+ MessageFilter* filter);
// Sends a message from the specified port to its peer. Note that the message
// notification may arrive synchronously (via PortStatusChanged() on the
« no previous file with comments | « mojo/edk/system/ports/message_queue.cc ('k') | mojo/edk/system/ports/node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698