libchromeos: Remove leaked tasks from GlibMessageLoop destructor.

The GlibMessageLoop implementation uses the default context to help
integrate with source that access both the glib main loop directly and
via the chromeos::MessageLoop interface. This means that tasks scheduled
with one GlibMessageLoop instance will run even from another instance of
the same class in the same thread. To prevent leaking callbacks between
GlibMessageLoop instances, such as the ones created for unittests, this
patch removes and logs all the leaked pending callbacks when the
instance is destroyed.

BUG=chromium:499886
TEST=Ran update_engine tests that leaked callbacks and saw the warnings.

Change-Id: I94ac97da1e342a3aa58400de5b2d5cf05463aa32
Reviewed-on: https://chromium-review.googlesource.com/281445
Tested-by: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
1 file changed