Cherry-pick: aw: Improve idle task scheduling

Clean cherry-pick of chromium crrev.com/r288285

BUG: 16550863

Original description:

Three related changes:
* Only run idle tasks in the queue, not newly added ones.
* Move g_request_pending logic to SharedRendererState. This
  allows pending tasks to be cancelled correctly.
* Wait for kModeProcess to happen first before trying to
  request another to avoid a queue of pending tasks.

Change-Id: If50da7ff6af6251654bc985f5cd2b78bf4f390b6
5 files changed