Chromium Code Reviews| Index: mojo/public/cpp/bindings/binding.h |
| diff --git a/mojo/public/cpp/bindings/binding.h b/mojo/public/cpp/bindings/binding.h |
| index 8c9ee2f0c5292c9eaa0d5f534cc3352d0eed9aee..2ae539c51c44245056643344d8d3459494d09cb7 100644 |
| --- a/mojo/public/cpp/bindings/binding.h |
| +++ b/mojo/public/cpp/bindings/binding.h |
| @@ -21,6 +21,7 @@ |
| namespace mojo { |
| class AssociatedGroup; |
| +class MessageReceiver; |
| // Represents the binding of an interface implementation to a message pipe. |
| // When the |Binding| object is destroyed, the binding between the message pipe |
| @@ -152,6 +153,13 @@ class Binding { |
| Bind(request.PassMessagePipe(), std::move(runner)); |
| } |
| + // Adds a message filter to be notified of each incoming message and |
| + // optionally prevent it from being dispatched. Filters cannot be removed. |
|
yzshen1
2016/08/24 20:47:55
Returning false not just prevents the message from
Ken Rockot(use gerrit already)
2016/08/24 20:56:38
Done
|
| + void AddFilter(std::unique_ptr<MessageReceiver> filter) { |
| + DCHECK(is_bound()); |
| + internal_state_.AddFilter(std::move(filter)); |
| + } |
| + |
| // Whether there are any associated interfaces running on the pipe currently. |
| bool HasAssociatedInterfaces() const { |
| return internal_state_.HasAssociatedInterfaces(); |