Cherry-pick: Don't schedule more invokeFunctors than necessary.

Cherry-pick with conflicts of
crrev.com/81c62e2d9601d38c44f71857dfabc31e2726cd70

BUG: 18706908

Original description:

The problematic sequence of events is as follows:
1. ShouldRequestOnNonUiThread, which posts a closure
(request_draw_gl_closure_) to UI thread
2. That closure gets run on UI thread, and it schedules the invokeFunctor
with Android framework
3. Before the corresponding invokeFunctor actually happens on RT (which
is DrawGL process mode),  ShouldRequestOnUiTdread is called on the UI
thread. At this point, pending_non_ui_ is not null, we cancel the
callback, which does nothing, because WebView has already scheduled an
invokeFunctor with the Android framework in Step 2. Then we schedule
another invokeFunctor immediately on the UI thread. So there are 2
invokeFunctors queued in Android framework in this case.

This CL tries keep track of whether or not we've
queued an invokeFunctor in Android framework already.

Change-Id: I0a084d92ea74412c3938645d63170604e6352318
2 files changed