Don't schedule more invokeFunctors than necessary.
commit81c62e2d9601d38c44f71857dfabc31e2726cd70
authorhush <hush@chromium.org>
Sat, 13 Dec 2014 03:42:33 +0000 (12 19:42 -0800)
committerCommit bot <commit-bot@chromium.org>
Sat, 13 Dec 2014 03:42:52 +0000 (13 03:42 +0000)
tree710fad84dadf04e9943b125a3513f76f192d22f8
parent031afab6415d691dd3f734861978f17b9df585f5
Don't schedule more invokeFunctors than necessary.

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.

BUG=442013

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

Cr-Commit-Position: refs/heads/master@{#308241}
android_webview/browser/shared_renderer_state.cc