Avoid deadlock with the UI thread and NPAPI in more cases

By doing the following:
1) Avoid deferring commits until draw if not drawing soon.
2) Don't send BeginMainFrame if swap throttling will block commit.

As a side-effect, some of the changes will also help release
the main thread sooner in some cases where we were holding on to
it for too long.

Additional scheduler deadlock tests added to verify existing
and future operation.

This should also enable us to more easily avoid unconditionally
setting active_tree_needs_first_draw_ to false in
SchedulerStateMachine::UpdateStateOnInvalidateOutputSurface
in followup patches if we want to.

BUG=479671, 477082

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

Cr-Commit-Position: refs/heads/master@{#330808}
6 files changed