-
rockot authored
Changes the Watcher C API as described in this post: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-mojo/UcA97R4IznI Makes watchers a first-class non-transferable handle type in Mojo, allows multiple distinct events to be watched by a single watcher, and requires watchers to be explicitly armed before a notification will fire. Also now allows for cancellation (and watcher closure) from within notification callbacks, simplifying cancellation logic and avoiding any possibility of EDK deadlocks caused by cancellations, during watch notification. Updates the Watcher class in mojo/public/cpp/system to reflect the new model, adding an explicit ArmingPolicy to allow users to select manual or automatic arming. Also renames it to SimpleWatcher to adequately convey that this is only a simplified helper class that does not utilize the full power of watchers. Automatic arming provides imperfect edge-triggered behavior, which is still an improvement over the old behavior in many cases. Manual arming is used in the bindings Connector to ensure that all messages are flushed from a pipe before control returns from a handle-ready notification, and is also now used for Watchers which watch a data pipe handle. Other users of the Watcher C API (namely Blink's MojoWatcher and content's MessagePort) have also been adapted to the new API. BUG=693595,700171 Review-Url: https://codereview.chromium.org/2725133002 Cr-Commit-Position: refs/heads/master@{#457269}
9eadabae