blink: Use a real cc instance in SimTests.

The SimCompositor was mocking out all compositing with its own
implementation of WebLayerTreeView that only overrode a few
setter/getters and provided methods for tests to query state of the
"compositor" as well as a way to do a synchronous BeginMainFrame.

This makes SimCompositor own a RenderWidgetCompositor instead of
implementing WebLayerTreeView, making SimTests run a real composite
step instead of faking it out, and querying state from a real
compositor.

This uncovered that scrollbars are painting on throttled child frames
even though layout has not been done, which is pointless work and/or
problematic.

Platform::IsThreadedAnimationEnabled() was returning true in unit
tests with a synchronous compositor, and thus where threaded animations
do not in fact run. The RenderWidgetCompositor and SimCompositor used
to work around this by returning a null AnimationHost in this scenario.
Instead of production code having to deal with a null AnimationHost,
which is not clear about intent at all, we should make
IsThreadedAnimationEnabled() accurate.

A few changes were needed to make this happen:
1. An accessor on the compositor to tell if a main frame has been
requested.
2. An accessor on the compositor to tell if commits are deferred.
3. Scrollbars stop painting when their frame is throttled.
4. SimCompositor becomes a RenderWidgetCompositorDelegate, to make
a LayerTreeFrameSink and respond to BeginMainFrame.
5. SimCompositor::MainFrame() now asks the actual compositor to do
a synchronous Composite. It does so to the LayerTreeHost directly
in order to specify the "now" TickTicks.
6. Platform::IsThreadedCompositingEnabled() is dead, so goodbye.
7. Platform::IsThreadedAnimationEnabled() returns true, but is
overriden when appropriate in tests to be false (when synchronous
compositing is being used).
8. RenderWidgetCompositorFactory allows a test to specify a
delegate so that SimCompositor can be the delegate.

[email protected], [email protected]
TBR=piman

Bug: 838693
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I3486abd740874cb2403b5b54e596ddffd8a00bd0
Reviewed-on: https://chromium-review.googlesource.com/1125149
Commit-Queue: danakj <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: David Bokan <[email protected]>
Reviewed-by: enne <[email protected]>
Cr-Commit-Position: refs/heads/master@{#572613}
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index f0b613a..6c12d8f 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -254,10 +254,11 @@
   GetCompositorImplThreadTaskRunner() override;
   blink::scheduler::WebThreadScheduler* GetWebMainThreadScheduler() override;
   cc::TaskGraphRunner* GetTaskGraphRunner() override;
-  bool IsThreadedAnimationEnabled() override;
   bool IsScrollAnimatorEnabled() override;
   std::unique_ptr<cc::UkmRecorderFactory> CreateUkmRecorderFactory() override;
 
+  bool IsThreadedAnimationEnabled();
+
   // blink::scheduler::WebThreadScheduler::RAILModeObserver implementation.
   void OnRAILModeChanged(v8::RAILMode rail_mode) override;