Mojo: Cancel WaitingCallbacks when their HandleWrappers are closed.
commita9e9f87c058a47db6c5709b38aae09acd56b11cc
authorsammc <sammc@chromium.org>
Mon, 15 Sep 2014 01:21:58 +0000 (14 18:21 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 15 Sep 2014 01:25:28 +0000 (15 01:25 +0000)
tree0e864a98497d3355044f8b8770cfede1c9de5269
parent9573ca904f9d465a6be78629cc04a0aac52a36fb
Mojo: Cancel WaitingCallbacks when their HandleWrappers are closed.

Currently, if a JS connector is left to be garbage collected, the handle
and the WaitingCallback both become ready to be collected at the same
time. If the handle is collected first, this results in an asynchronous
wait on a closed handle. With this change, WaitingCallback registers
itself as an observer to be notified when the handle it's watching is
closing and cancels the wait if the handle closes while the wait is in
progress.

BUG=406487

Review URL: https://codereview.chromium.org/534953002

Cr-Commit-Position: refs/heads/master@{#294775}
mojo/apps/js/test/BUILD.gn
mojo/apps/js/test/handle_unittest.cc [new file with mode: 0644]
mojo/bindings/js/BUILD.gn
mojo/bindings/js/handle.cc
mojo/bindings/js/handle.h
mojo/bindings/js/handle_close_observer.h [new file with mode: 0644]
mojo/bindings/js/support.cc
mojo/bindings/js/waiting_callback.cc
mojo/bindings/js/waiting_callback.h
mojo/mojo_apps.gypi
mojo/mojo_base.gyp