summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-18 13:38:36 +0000
committerskyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-18 13:39:30 +0000
commit04c5900d8a63f9297ab1240052701b94f294e975 (patch)
treecbf2d38bc3777f054cf841bc3cd4de9f3b6db2db
parent1228c324bca3e264d8118e8057ddb0f4a04b3d9d (diff)
downloadchromium_src-04c5900d8a63f9297ab1240052701b94f294e975.zip
chromium_src-04c5900d8a63f9297ab1240052701b94f294e975.tar.gz
chromium_src-04c5900d8a63f9297ab1240052701b94f294e975.tar.bz2
Rename Animate as Begin(Main)Frame
Rename Animate as Begin(Main)Frame to harmonize the terminology used by different parts of the system. The monotonic start time of the last frame that is passed into this function is also renamed for consistency. No functional changes. Original patch by Simon Pick (picksi@chromium.org). BUG=346230 Review URL: https://codereview.chromium.org/429743003 Cr-Commit-Position: refs/heads/master@{#290248} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290248 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--android_webview/browser/hardware_renderer.h2
-rw-r--r--cc/layers/heads_up_display_layer_impl.cc3
-rw-r--r--cc/layers/picture_layer_impl.cc3
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc46
-rw-r--r--cc/resources/tile_manager_perftest.cc8
-rw-r--r--cc/test/begin_frame_args_test.cc12
-rw-r--r--cc/test/begin_frame_args_test.h1
-rw-r--r--cc/test/fake_layer_tree_host_client.h2
-rw-r--r--cc/test/fake_layer_tree_host_impl.cc19
-rw-r--r--cc/test/fake_layer_tree_host_impl.h6
-rw-r--r--cc/test/layer_tree_test.cc4
-rw-r--r--cc/test/layer_tree_test.h2
-rw-r--r--cc/trees/layer_tree_host.cc12
-rw-r--r--cc/trees/layer_tree_host.h4
-rw-r--r--cc/trees/layer_tree_host_client.h3
-rw-r--r--cc/trees/layer_tree_host_impl.cc36
-rw-r--r--cc/trees/layer_tree_host_impl.h8
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc5
-rw-r--r--cc/trees/layer_tree_host_perftest.cc12
-rw-r--r--cc/trees/layer_tree_host_unittest.cc10
-rw-r--r--cc/trees/layer_tree_host_unittest_animation.cc54
-rw-r--r--cc/trees/layer_tree_host_unittest_no_message_loop.cc2
-rw-r--r--cc/trees/layer_tree_impl.cc4
-rw-r--r--cc/trees/layer_tree_impl.h2
-rw-r--r--cc/trees/single_thread_proxy.cc4
-rw-r--r--cc/trees/thread_proxy.cc15
-rw-r--r--cc/trees/thread_proxy.h2
-rw-r--r--content/browser/renderer_host/compositor_impl_android.h2
-rw-r--r--content/renderer/gpu/render_widget_compositor.cc15
-rw-r--r--content/renderer/gpu/render_widget_compositor.h3
-rw-r--r--content/test/web_layer_tree_view_impl_for_testing.h2
-rw-r--r--mojo/examples/compositor_app/compositor_host.cc5
-rw-r--r--mojo/examples/compositor_app/compositor_host.h2
-rw-r--r--ui/compositor/compositor.cc14
-rw-r--r--ui/compositor/compositor.h2
35 files changed, 181 insertions, 145 deletions
diff --git a/android_webview/browser/hardware_renderer.h b/android_webview/browser/hardware_renderer.h
index f87890b..c4d3449 100644
--- a/android_webview/browser/hardware_renderer.h
+++ b/android_webview/browser/hardware_renderer.h
@@ -41,7 +41,7 @@ class HardwareRenderer : public cc::LayerTreeHostClient,
// cc::LayerTreeHostClient overrides.
virtual void WillBeginMainFrame(int frame_id) OVERRIDE {}
virtual void DidBeginMainFrame() OVERRIDE;
- virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {}
+ virtual void BeginMainFrame(const cc::BeginFrameArgs& args) OVERRIDE {}
virtual void Layout() OVERRIDE {}
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) OVERRIDE {}
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc
index 0ccd4ed..c46c1be 100644
--- a/cc/layers/heads_up_display_layer_impl.cc
+++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -13,6 +13,7 @@
#include "cc/debug/debug_colors.h"
#include "cc/debug/frame_rate_counter.h"
#include "cc/debug/paint_time_counter.h"
+#include "cc/output/begin_frame_args.h"
#include "cc/output/renderer.h"
#include "cc/quads/texture_draw_quad.h"
#include "cc/resources/memory_history.h"
@@ -192,7 +193,7 @@ void HeadsUpDisplayLayerImpl::UpdateHudContents() {
const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state();
// Don't update numbers every frame so text is readable.
- base::TimeTicks now = layer_tree_impl()->CurrentFrameTimeTicks();
+ base::TimeTicks now = layer_tree_impl()->CurrentBeginFrameArgs().frame_time;
if (base::TimeDelta(now - time_of_last_graph_update_).InSecondsF() > 0.25f) {
time_of_last_graph_update_ = now;
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 49ad601..ede7da0 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -15,6 +15,7 @@
#include "cc/debug/micro_benchmark_impl.h"
#include "cc/debug/traced_value.h"
#include "cc/layers/append_quads_data.h"
+#include "cc/output/begin_frame_args.h"
#include "cc/quads/checkerboard_draw_quad.h"
#include "cc/quads/debug_border_draw_quad.h"
#include "cc/quads/picture_draw_quad.h"
@@ -458,7 +459,7 @@ void PictureLayerImpl::UpdateTilePriorities(
TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities");
double current_frame_time_in_seconds =
- (layer_tree_impl()->CurrentFrameTimeTicks() -
+ (layer_tree_impl()->CurrentBeginFrameArgs().frame_time -
base::TimeTicks()).InSecondsF();
bool tiling_needs_update = false;
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 5eae6a6..4da402a 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -13,6 +13,7 @@
#include "cc/layers/append_quads_data.h"
#include "cc/layers/picture_layer.h"
#include "cc/quads/draw_quad.h"
+#include "cc/test/begin_frame_args_test.h"
#include "cc/test/fake_content_layer_client.h"
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_impl.h"
@@ -306,7 +307,8 @@ TEST_F(PictureLayerImplTest, CloneNoInvalidation) {
TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
gfx::Size tile_size(100, 100);
gfx::Size layer_bounds(400, 400);
@@ -322,7 +324,8 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
SetupDrawPropertiesAndUpdateTiles(active_layer_, 1.f, 1.f, 1.f, 1.f, false);
time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
// Update tiles with viewport for tile priority as (0, 0, 100, 100) and the
// identify transform for tile priority.
@@ -363,7 +366,8 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
// rotated. The actual viewport for tile priority used by PictureLayerImpl
// should be (200, 200, 100, 100) applied with the said transform.
time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
viewport_rect_for_tile_priority = gfx::Rect(200, 200, 100, 100);
transform_for_tile_priority.Translate(100, 100);
@@ -407,7 +411,8 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) {
TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
gfx::Size tile_size(100, 100);
gfx::Size layer_bounds(400, 400);
@@ -451,7 +456,8 @@ TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
// Expand viewport and set it as invalid for prioritizing tiles.
// Should not update tile viewport.
time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
resourceless_software_draw = true;
viewport = gfx::ScaleToEnclosingRect(viewport, 2);
transform.Translate(1.f, 1.f);
@@ -475,7 +481,8 @@ TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
// Keep expanded viewport but mark it valid. Should update tile viewport.
time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
resourceless_software_draw = false;
host_impl_.SetExternalDrawConstraints(transform,
viewport,
@@ -2673,7 +2680,8 @@ TEST_F(NoLowResPictureLayerImplTest, NothingRequiredIfActiveMissingTiles) {
TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
gfx::Size tile_size(100, 100);
gfx::Size layer_bounds(400, 400);
@@ -2717,7 +2725,8 @@ TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
// Expand viewport and set it as invalid for prioritizing tiles.
// Should not update tile viewport.
time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
resourceless_software_draw = true;
viewport = gfx::ScaleToEnclosingRect(viewport, 2);
transform.Translate(1.f, 1.f);
@@ -2741,7 +2750,8 @@ TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
// Keep expanded viewport but mark it valid. Should update tile viewport.
time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
resourceless_software_draw = false;
host_impl_.SetExternalDrawConstraints(transform,
viewport,
@@ -3164,7 +3174,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
OccludedTilesSkippedDuringRasterization) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
gfx::Size tile_size(102, 102);
gfx::Size layer_bounds(1000, 1000);
@@ -3209,7 +3220,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
layer1->SetPosition(occluding_layer_position);
time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
host_impl_.pending_tree()->UpdateDrawProperties();
unoccluded_tile_count = 0;
@@ -3232,7 +3244,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
layer1->SetPosition(gfx::Point(0, 0));
time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
host_impl_.pending_tree()->UpdateDrawProperties();
unoccluded_tile_count = 0;
@@ -3256,7 +3269,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
OccludedTilesNotMarkedAsRequired) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
gfx::Size tile_size(102, 102);
gfx::Size layer_bounds(1000, 1000);
@@ -3306,7 +3320,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
layer1->SetPosition(occluding_layer_position);
time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
host_impl_.pending_tree()->UpdateDrawProperties();
for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
@@ -3344,7 +3359,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
layer1->SetPosition(gfx::PointF(0, 0));
time_ticks += base::TimeDelta::FromMilliseconds(200);
- host_impl_.SetCurrentFrameTimeTicks(time_ticks);
+ host_impl_.SetCurrentBeginFrameArgs(
+ CreateBeginFrameArgsForTesting(time_ticks));
host_impl_.pending_tree()->UpdateDrawProperties();
for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc
index 211ff01..7518d8f 100644
--- a/cc/resources/tile_manager_perftest.cc
+++ b/cc/resources/tile_manager_perftest.cc
@@ -6,6 +6,7 @@
#include "cc/debug/lap_timer.h"
#include "cc/resources/tile.h"
#include "cc/resources/tile_priority.h"
+#include "cc/test/begin_frame_args_test.h"
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
@@ -22,6 +23,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_test.h"
+#include "ui/gfx/frame_time.h"
+
namespace cc {
namespace {
@@ -390,7 +393,8 @@ class TileManagerPerfTest : public testing::Test {
CreateLayers(layer_count, approximate_tile_count_per_layer);
timer_.Reset();
do {
- host_impl_.UpdateCurrentFrameTime();
+ BeginFrameArgs args = CreateBeginFrameArgsForTesting();
+ host_impl_.UpdateCurrentBeginFrameArgs(args);
for (unsigned i = 0; i < layers.size(); ++i)
layers[i]->UpdateTiles(NULL);
@@ -398,7 +402,7 @@ class TileManagerPerfTest : public testing::Test {
tile_manager()->ManageTiles(global_state);
tile_manager()->UpdateVisibleTiles();
timer_.NextLap();
- host_impl_.ResetCurrentFrameTimeForNextFrame();
+ host_impl_.ResetCurrentBeginFrameArgsForNextFrame();
} while (!timer_.HasTimeLimitExpired());
perf_test::PrintResult(
diff --git a/cc/test/begin_frame_args_test.cc b/cc/test/begin_frame_args_test.cc
index 00952e2..83051b2 100644
--- a/cc/test/begin_frame_args_test.cc
+++ b/cc/test/begin_frame_args_test.cc
@@ -11,10 +11,14 @@
namespace cc {
BeginFrameArgs CreateBeginFrameArgsForTesting() {
- base::TimeTicks now = gfx::FrameTime::Now();
- return BeginFrameArgs::Create(now,
- now + (BeginFrameArgs::DefaultInterval() / 2),
- BeginFrameArgs::DefaultInterval());
+ return CreateBeginFrameArgsForTesting(gfx::FrameTime::Now());
+}
+
+BeginFrameArgs CreateBeginFrameArgsForTesting(base::TimeTicks frame_time) {
+ return BeginFrameArgs::Create(
+ frame_time,
+ frame_time + (BeginFrameArgs::DefaultInterval() / 2),
+ BeginFrameArgs::DefaultInterval());
}
BeginFrameArgs CreateBeginFrameArgsForTesting(int64 frame_time,
diff --git a/cc/test/begin_frame_args_test.h b/cc/test/begin_frame_args_test.h
index e0fe9c0..0ab1daf 100644
--- a/cc/test/begin_frame_args_test.h
+++ b/cc/test/begin_frame_args_test.h
@@ -15,6 +15,7 @@ namespace cc {
// Functions for quickly creating BeginFrameArgs
BeginFrameArgs CreateBeginFrameArgsForTesting();
+BeginFrameArgs CreateBeginFrameArgsForTesting(base::TimeTicks frame_time);
BeginFrameArgs CreateBeginFrameArgsForTesting(int64 frame_time,
int64 deadline,
int64 interval);
diff --git a/cc/test/fake_layer_tree_host_client.h b/cc/test/fake_layer_tree_host_client.h
index f928453..802aec9 100644
--- a/cc/test/fake_layer_tree_host_client.h
+++ b/cc/test/fake_layer_tree_host_client.h
@@ -29,7 +29,7 @@ class FakeLayerTreeHostClient : public LayerTreeHostClient,
// LayerTreeHostClient implementation.
virtual void WillBeginMainFrame(int frame_id) OVERRIDE {}
virtual void DidBeginMainFrame() OVERRIDE {}
- virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {}
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {}
virtual void Layout() OVERRIDE {}
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) OVERRIDE {}
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc
index 0505bbd..3c4e125 100644
--- a/cc/test/fake_layer_tree_host_impl.cc
+++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "cc/test/begin_frame_args_test.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/test_shared_bitmap_manager.h"
#include "cc/trees/layer_tree_impl.h"
@@ -22,7 +23,7 @@ FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy,
// Avoid using Now() as the frame time in unit tests.
base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1);
- SetCurrentFrameTimeTicks(time_ticks);
+ SetCurrentBeginFrameArgs(CreateBeginFrameArgsForTesting(time_ticks));
}
FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
@@ -39,7 +40,7 @@ FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
// Avoid using Now() as the frame time in unit tests.
base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1);
- SetCurrentFrameTimeTicks(time_ticks);
+ SetCurrentBeginFrameArgs(CreateBeginFrameArgsForTesting(time_ticks));
}
FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() {}
@@ -51,15 +52,15 @@ void FakeLayerTreeHostImpl::CreatePendingTree() {
1.f, 1.f / arbitrary_large_page_scale, arbitrary_large_page_scale);
}
-base::TimeTicks FakeLayerTreeHostImpl::CurrentFrameTimeTicks() {
- if (current_frame_time_ticks_.is_null())
- return LayerTreeHostImpl::CurrentFrameTimeTicks();
- return current_frame_time_ticks_;
+BeginFrameArgs FakeLayerTreeHostImpl::CurrentBeginFrameArgs() const {
+ if (!current_begin_frame_args_.IsValid())
+ return LayerTreeHostImpl::CurrentBeginFrameArgs();
+ return current_begin_frame_args_;
}
-void FakeLayerTreeHostImpl::SetCurrentFrameTimeTicks(
- base::TimeTicks current_frame_time_ticks) {
- current_frame_time_ticks_ = current_frame_time_ticks;
+void FakeLayerTreeHostImpl::SetCurrentBeginFrameArgs(
+ const BeginFrameArgs& args) {
+ current_begin_frame_args_ = args;
}
int FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(LayerImpl* layer) {
diff --git a/cc/test/fake_layer_tree_host_impl.h b/cc/test/fake_layer_tree_host_impl.h
index 0d0014c..6d31c51 100644
--- a/cc/test/fake_layer_tree_host_impl.h
+++ b/cc/test/fake_layer_tree_host_impl.h
@@ -28,8 +28,8 @@ class FakeLayerTreeHostImpl : public LayerTreeHostImpl {
virtual void CreatePendingTree() OVERRIDE;
- virtual base::TimeTicks CurrentFrameTimeTicks() OVERRIDE;
- void SetCurrentFrameTimeTicks(base::TimeTicks current_frame_time_ticks);
+ virtual BeginFrameArgs CurrentBeginFrameArgs() const OVERRIDE;
+ void SetCurrentBeginFrameArgs(const BeginFrameArgs& args);
void UpdateNumChildrenAndDrawPropertiesForActiveTree();
static void UpdateNumChildrenAndDrawProperties(LayerTreeImpl* layerTree);
static int RecursiveUpdateNumChildren(LayerImpl* layer);
@@ -38,7 +38,7 @@ class FakeLayerTreeHostImpl : public LayerTreeHostImpl {
using LayerTreeHostImpl::manage_tiles_needed;
private:
- base::TimeTicks current_frame_time_ticks_;
+ BeginFrameArgs current_begin_frame_args_;
FakeLayerTreeHostImplClient client_;
FakeRenderingStatsInstrumentation stats_instrumentation_;
};
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 0be1ed1..4493671 100644
--- a/cc/test/layer_tree_test.cc
+++ b/cc/test/layer_tree_test.cc
@@ -276,8 +276,8 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient,
test_hooks_->DidBeginMainFrame();
}
- virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE {
- test_hooks_->Animate(monotonic_time);
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
+ test_hooks_->BeginMainFrame(args);
}
virtual void Layout() OVERRIDE { test_hooks_->Layout(); }
diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h
index 8f38dda..8e469c4 100644
--- a/cc/test/layer_tree_test.h
+++ b/cc/test/layer_tree_test.h
@@ -60,7 +60,7 @@ class TestHooks : public AnimationDelegate {
base::TimeTicks monotonic_time) {}
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float scale) {}
- virtual void Animate(base::TimeTicks monotonic_time) {}
+ virtual void BeginMainFrame(const BeginFrameArgs& args) {}
virtual void WillBeginMainFrame() {}
virtual void DidBeginMainFrame() {}
virtual void Layout() {}
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 9eb6e0e..a539d13 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -97,7 +97,7 @@ LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client,
const LayerTreeSettings& settings)
: micro_benchmark_controller_(this),
next_ui_resource_id_(1),
- animating_(false),
+ inside_begin_main_frame_(false),
needs_full_tree_sync_(true),
client_(client),
source_frame_number_(0),
@@ -239,10 +239,10 @@ void LayerTreeHost::DidBeginMainFrame() {
client_->DidBeginMainFrame();
}
-void LayerTreeHost::UpdateClientAnimations(base::TimeTicks frame_begin_time) {
- animating_ = true;
- client_->Animate(frame_begin_time);
- animating_ = false;
+void LayerTreeHost::BeginMainFrame(const BeginFrameArgs& args) {
+ inside_begin_main_frame_ = true;
+ client_->BeginMainFrame(args);
+ inside_begin_main_frame_ = false;
}
void LayerTreeHost::DidStopFlinging() {
@@ -1093,7 +1093,7 @@ void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) {
}
void LayerTreeHost::StartRateLimiter() {
- if (animating_)
+ if (inside_begin_main_frame_)
return;
if (!rate_limit_timer_.IsRunning()) {
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 0ae1c5a..f1e343f 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -104,7 +104,7 @@ class CC_EXPORT LayerTreeHost {
client_->WillBeginMainFrame(source_frame_number_);
}
void DidBeginMainFrame();
- void UpdateClientAnimations(base::TimeTicks monotonic_frame_begin_time);
+ void BeginMainFrame(const BeginFrameArgs& args);
void AnimateLayers(base::TimeTicks monotonic_frame_begin_time);
void DidStopFlinging();
void Layout();
@@ -361,7 +361,7 @@ class CC_EXPORT LayerTreeHost {
void NotifySwapPromiseMonitorsOfSetNeedsCommit();
- bool animating_;
+ bool inside_begin_main_frame_;
bool needs_full_tree_sync_;
base::CancelableClosure prepaint_callback_;
diff --git a/cc/trees/layer_tree_host_client.h b/cc/trees/layer_tree_host_client.h
index 74dcbc0..5d51faf 100644
--- a/cc/trees/layer_tree_host_client.h
+++ b/cc/trees/layer_tree_host_client.h
@@ -17,14 +17,15 @@ namespace cc {
class ContextProvider;
class InputHandlerClient;
class OutputSurface;
+struct BeginFrameArgs;
class LayerTreeHostClient {
public:
virtual void WillBeginMainFrame(int frame_id) = 0;
// Marks finishing compositing-related tasks on the main thread. In threaded
// mode, this corresponds to DidCommit().
+ virtual void BeginMainFrame(const BeginFrameArgs& args) = 0;
virtual void DidBeginMainFrame() = 0;
- virtual void Animate(base::TimeTicks frame_begin_time) = 0;
virtual void Layout() = 0;
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) = 0;
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 705598b..f04a96c 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -161,7 +161,7 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient {
}
layer_tree_host_impl_->Animate(
- layer_tree_host_impl_->CurrentFrameTimeTicks());
+ layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time);
layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true);
bool start_ready_animations = true;
layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
@@ -171,7 +171,7 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient {
layer_tree_host_impl_->ManageTiles();
}
- layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame();
+ layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
}
void SetActive(bool active) {
@@ -1677,7 +1677,7 @@ void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) {
void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) {
// Sample the frame time now. This time will be used for updating animations
// when we draw.
- UpdateCurrentFrameTime();
+ UpdateCurrentBeginFrameArgs(args);
// Cache the begin impl frame interval
begin_impl_frame_interval_ = args.interval;
}
@@ -2396,9 +2396,9 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
new_target.SetToMax(gfx::Vector2dF());
new_target.SetToMin(layer_impl->MaxScrollOffset());
- curve->UpdateTarget(
- animation->TrimTimeToCurrentIteration(CurrentFrameTimeTicks()),
- new_target);
+ curve->UpdateTarget(animation->TrimTimeToCurrentIteration(
+ CurrentBeginFrameArgs().frame_time),
+ new_target);
return ScrollStarted;
}
@@ -3171,22 +3171,28 @@ void LayerTreeHostImpl::SetTreePriority(TreePriority priority) {
DidModifyTilePriorities();
}
-void LayerTreeHostImpl::UpdateCurrentFrameTime() {
- DCHECK(current_frame_timeticks_.is_null());
- current_frame_timeticks_ = gfx::FrameTime::Now();
+void LayerTreeHostImpl::UpdateCurrentBeginFrameArgs(
+ const BeginFrameArgs& args) {
+ DCHECK(!current_begin_frame_args_.IsValid());
+ current_begin_frame_args_ = args;
+ // TODO(skyostil): Stop overriding the frame time once the usage of frame
+ // timing is unified.
+ current_begin_frame_args_.frame_time = gfx::FrameTime::Now();
}
-void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() {
- current_frame_timeticks_ = base::TimeTicks();
+void LayerTreeHostImpl::ResetCurrentBeginFrameArgsForNextFrame() {
+ current_begin_frame_args_ = BeginFrameArgs();
}
-base::TimeTicks LayerTreeHostImpl::CurrentFrameTimeTicks() {
+BeginFrameArgs LayerTreeHostImpl::CurrentBeginFrameArgs() const {
// Try to use the current frame time to keep animations non-jittery. But if
// we're not in a frame (because this is during an input event or a delayed
// task), fall back to physical time. This should still be monotonic.
- if (!current_frame_timeticks_.is_null())
- return current_frame_timeticks_;
- return gfx::FrameTime::Now();
+ if (current_begin_frame_args_.IsValid())
+ return current_begin_frame_args_;
+ return BeginFrameArgs::Create(gfx::FrameTime::Now(),
+ base::TimeTicks(),
+ BeginFrameArgs::DefaultInterval());
}
scoped_refptr<base::debug::ConvertableToTraceFormat>
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 8787478..f97490e 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -427,9 +427,9 @@ class CC_EXPORT LayerTreeHostImpl
void SetTreePriority(TreePriority priority);
- void UpdateCurrentFrameTime();
- void ResetCurrentFrameTimeForNextFrame();
- virtual base::TimeTicks CurrentFrameTimeTicks();
+ void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args);
+ void ResetCurrentBeginFrameArgsForNextFrame();
+ virtual BeginFrameArgs CurrentBeginFrameArgs() const;
// Expected time between two begin impl frame calls.
base::TimeDelta begin_impl_frame_interval() const {
@@ -696,7 +696,7 @@ class CC_EXPORT LayerTreeHostImpl
gfx::Rect viewport_damage_rect_;
- base::TimeTicks current_frame_timeticks_;
+ BeginFrameArgs current_begin_frame_args_;
// Expected time between two begin impl frame calls.
base::TimeDelta begin_impl_frame_interval_;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 167b65a..1322f83 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -38,6 +38,7 @@
#include "cc/quads/tile_draw_quad.h"
#include "cc/resources/layer_tiling_data.h"
#include "cc/test/animation_test_common.h"
+#include "cc/test/begin_frame_args_test.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
@@ -1330,8 +1331,8 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
manager,
0) {}
- virtual base::TimeTicks CurrentFrameTimeTicks() OVERRIDE {
- return fake_current_physical_time_;
+ virtual BeginFrameArgs CurrentBeginFrameArgs() const OVERRIDE {
+ return CreateBeginFrameArgsForTesting(fake_current_physical_time_);
}
void SetCurrentPhysicalTimeTicksForTest(base::TimeTicks fake_now) {
diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc
index 70b2a64..cd1ba44 100644
--- a/cc/trees/layer_tree_host_perftest.cc
+++ b/cc/trees/layer_tree_host_perftest.cc
@@ -39,7 +39,7 @@ class LayerTreeHostPerfTest : public LayerTreeTest {
kTimeCheckInterval),
commit_timer_(0, base::TimeDelta(), 1),
full_damage_each_frame_(false),
- animation_driven_drawing_(false),
+ begin_frame_driven_drawing_(false),
measure_commit_cost_(false) {
fake_content_layer_client_.set_paint_all_opaque(true);
}
@@ -53,8 +53,8 @@ class LayerTreeHostPerfTest : public LayerTreeTest {
PostSetNeedsCommitToMainThread();
}
- virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE {
- if (animation_driven_drawing_ && !TestEnded()) {
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
+ if (begin_frame_driven_drawing_ && !TestEnded()) {
layer_tree_host()->SetNeedsAnimate();
layer_tree_host()->SetNextCommitForcesRedraw();
}
@@ -79,7 +79,7 @@ class LayerTreeHostPerfTest : public LayerTreeTest {
CleanUpAndEndTest(impl);
return;
}
- if (!animation_driven_drawing_)
+ if (!begin_frame_driven_drawing_)
impl->SetNeedsRedraw();
if (full_damage_each_frame_)
impl->SetFullRootLayerDamage();
@@ -108,7 +108,7 @@ class LayerTreeHostPerfTest : public LayerTreeTest {
std::string test_name_;
FakeContentLayerClient fake_content_layer_client_;
bool full_damage_each_frame_;
- bool animation_driven_drawing_;
+ bool begin_frame_driven_drawing_;
bool measure_commit_cost_;
};
@@ -324,7 +324,7 @@ TEST_F(BrowserCompositorInvalidateLayerTreePerfTest, DenseBrowserUI) {
// Simulates a page with several large, transformed and animated layers.
TEST_F(LayerTreeHostPerfTestJsonReader, HeavyPageThreadedImplSide) {
- animation_driven_drawing_ = true;
+ begin_frame_driven_drawing_ = true;
measure_commit_cost_ = true;
SetTestName("heavy_page");
ReadTestFile("heavy_layer_tree");
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index a17c80b..8dda035 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -747,7 +747,7 @@ class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails
if (frame_count_with_pending_tree_ == 1) {
EXPECT_EQ(first_frame_time_.ToInternalValue(), 0);
- first_frame_time_ = impl->CurrentFrameTimeTicks();
+ first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time;
} else if (frame_count_with_pending_tree_ == 2) {
impl->BlockNotifyReadyToActivateForTesting(false);
}
@@ -757,7 +757,7 @@ class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails
if (frame_count_with_pending_tree_ > 1) {
EXPECT_NE(first_frame_time_.ToInternalValue(), 0);
EXPECT_NE(first_frame_time_.ToInternalValue(),
- impl->CurrentFrameTimeTicks().ToInternalValue());
+ impl->CurrentBeginFrameArgs().frame_time.ToInternalValue());
EndTest();
return;
}
@@ -796,7 +796,7 @@ class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest {
virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
frame_++;
if (frame_ == 1) {
- first_frame_time_ = impl->CurrentFrameTimeTicks();
+ first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time;
impl->SetNeedsRedraw();
// Since we might use a low-resolution clock on Windows, we need to
@@ -807,7 +807,7 @@ class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest {
return;
}
- EXPECT_NE(first_frame_time_, impl->CurrentFrameTimeTicks());
+ EXPECT_NE(first_frame_time_, impl->CurrentBeginFrameArgs().frame_time);
EndTest();
}
@@ -4987,7 +4987,7 @@ class LayerTreeHostTestContinuousPainting : public LayerTreeHostTest {
milliseconds_per_frame));
}
- virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE {
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
child_layer_->SetNeedsDisplay();
}
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index 4706dad..69e1e72 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -39,8 +39,8 @@ class LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested
PostSetNeedsCommitToMainThread();
}
- virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE {
- // We skip the first commit becasue its the commit that populates the
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
+ // We skip the first commit because its the commit that populates the
// impl thread with a tree. After the second commit, the test is done.
if (num_commits_ != 1)
return;
@@ -84,16 +84,16 @@ class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback
: public LayerTreeHostAnimationTest {
public:
LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback()
- : num_animates_(0) {}
+ : num_begin_frames_(0) {}
virtual void BeginTest() OVERRIDE {
PostSetNeedsCommitToMainThread();
}
- virtual void Animate(base::TimeTicks) OVERRIDE {
- if (!num_animates_) {
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
+ if (!num_begin_frames_) {
layer_tree_host()->SetNeedsAnimate();
- num_animates_++;
+ num_begin_frames_++;
return;
}
EndTest();
@@ -102,7 +102,7 @@ class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback
virtual void AfterTest() OVERRIDE {}
private:
- int num_animates_;
+ int num_begin_frames_;
};
MULTI_THREAD_TEST_F(
@@ -115,9 +115,7 @@ class LayerTreeHostAnimationTestAddAnimation
: public LayerTreeHostAnimationTest {
public:
LayerTreeHostAnimationTestAddAnimation()
- : num_animates_(0),
- received_animation_started_notification_(false) {
- }
+ : num_begin_frames_(0), received_animation_started_notification_(false) {}
virtual void BeginTest() OVERRIDE {
PostAddInstantAnimationToMainThread(layer_tree_host()->root_layer());
@@ -126,11 +124,11 @@ class LayerTreeHostAnimationTestAddAnimation
virtual void UpdateAnimationState(
LayerTreeHostImpl* host_impl,
bool has_unfinished_animation) OVERRIDE {
- if (!num_animates_) {
+ if (!num_begin_frames_) {
// The animation had zero duration so LayerTreeHostImpl should no
// longer need to animate its layers.
EXPECT_FALSE(has_unfinished_animation);
- num_animates_++;
+ num_begin_frames_++;
return;
}
@@ -153,7 +151,7 @@ class LayerTreeHostAnimationTestAddAnimation
Animation::TargetProperty target_property) OVERRIDE {
received_animation_started_notification_ = true;
start_time_ = monotonic_time;
- if (num_animates_) {
+ if (num_begin_frames_) {
EXPECT_LT(base::TimeTicks(), start_time_);
LayerAnimationController* controller =
@@ -170,7 +168,7 @@ class LayerTreeHostAnimationTestAddAnimation
virtual void AfterTest() OVERRIDE {}
private:
- int num_animates_;
+ int num_begin_frames_;
bool received_animation_started_notification_;
base::TimeTicks start_time_;
};
@@ -262,7 +260,7 @@ class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded
: public LayerTreeHostAnimationTest {
public:
LayerTreeHostAnimationTestTickAnimationWhileBackgrounded()
- : num_animates_(0) {}
+ : num_begin_frames_(0) {}
virtual void BeginTest() OVERRIDE {
PostAddLongAnimationToMainThread(layer_tree_host()->root_layer());
@@ -276,13 +274,13 @@ class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded
base::TimeTicks monotonic_time) OVERRIDE {
// Verify that the host can draw, it's just not visible.
EXPECT_TRUE(host_impl->CanDraw());
- if (num_animates_ < 2) {
- if (!num_animates_) {
+ if (num_begin_frames_ < 2) {
+ if (!num_begin_frames_) {
// We have a long animation running. It should continue to tick even
// if we are not visible.
PostSetVisibleToMainThread(false);
}
- num_animates_++;
+ num_begin_frames_++;
return;
}
EndTest();
@@ -291,7 +289,7 @@ class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded
virtual void AfterTest() OVERRIDE {}
private:
- int num_animates_;
+ int num_begin_frames_;
};
SINGLE_AND_MULTI_THREAD_TEST_F(
@@ -726,12 +724,12 @@ class LayerTreeHostAnimationTestCancelAnimateCommit
: public LayerTreeHostAnimationTest {
public:
LayerTreeHostAnimationTestCancelAnimateCommit()
- : num_animate_calls_(0), num_commit_calls_(0), num_draw_calls_(0) {}
+ : num_begin_frames_(0), num_commit_calls_(0), num_draw_calls_(0) {}
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual void Animate(base::TimeTicks) OVERRIDE {
- num_animate_calls_++;
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
+ num_begin_frames_++;
// No-op animate will cancel the commit.
if (layer_tree_host()->source_frame_number() == 1) {
EndTest();
@@ -753,13 +751,13 @@ class LayerTreeHostAnimationTestCancelAnimateCommit
}
virtual void AfterTest() OVERRIDE {
- EXPECT_EQ(2, num_animate_calls_);
+ EXPECT_EQ(2, num_begin_frames_);
EXPECT_EQ(1, num_commit_calls_);
EXPECT_EQ(1, num_draw_calls_);
}
private:
- int num_animate_calls_;
+ int num_begin_frames_;
int num_commit_calls_;
int num_draw_calls_;
FakeContentLayerClient client_;
@@ -776,7 +774,7 @@ class LayerTreeHostAnimationTestForceRedraw
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual void Animate(base::TimeTicks) OVERRIDE {
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
if (++num_animate_ < 2)
layer_tree_host()->SetNeedsAnimate();
}
@@ -812,7 +810,7 @@ class LayerTreeHostAnimationTestAnimateAfterSetNeedsCommit
virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual void Animate(base::TimeTicks) OVERRIDE {
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
if (++num_animate_ <= 2) {
layer_tree_host()->SetNeedsCommit();
layer_tree_host()->SetNeedsAnimate();
@@ -1092,8 +1090,8 @@ class LayerTreeHostAnimationTestFrozenAnimationTickTime
PostAddAnimationToMainThread(layer_tree_host()->root_layer());
}
- virtual void Animate(base::TimeTicks monotonic_time) OVERRIDE {
- last_main_thread_tick_time_ = monotonic_time;
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
+ last_main_thread_tick_time_ = args.frame_time;
}
virtual void AnimateLayers(LayerTreeHostImpl* host_impl,
diff --git a/cc/trees/layer_tree_host_unittest_no_message_loop.cc b/cc/trees/layer_tree_host_unittest_no_message_loop.cc
index 1a24ba5..cd8e8a1 100644
--- a/cc/trees/layer_tree_host_unittest_no_message_loop.cc
+++ b/cc/trees/layer_tree_host_unittest_no_message_loop.cc
@@ -54,8 +54,8 @@ class LayerTreeHostNoMessageLoopTest
// LayerTreeHostClient overrides.
virtual void WillBeginMainFrame(int frame_id) OVERRIDE {}
+ virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {}
virtual void DidBeginMainFrame() OVERRIDE {}
- virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {}
virtual void Layout() OVERRIDE {}
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) OVERRIDE {}
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 759b80ef..f442ca2 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -744,8 +744,8 @@ bool LayerTreeImpl::PinchGestureActive() const {
return layer_tree_host_impl_->pinch_gesture_active();
}
-base::TimeTicks LayerTreeImpl::CurrentFrameTimeTicks() const {
- return layer_tree_host_impl_->CurrentFrameTimeTicks();
+BeginFrameArgs LayerTreeImpl::CurrentBeginFrameArgs() const {
+ return layer_tree_host_impl_->CurrentBeginFrameArgs();
}
base::TimeDelta LayerTreeImpl::begin_impl_frame_interval() const {
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
index fa6d63a..95cf7b1 100644
--- a/cc/trees/layer_tree_impl.h
+++ b/cc/trees/layer_tree_impl.h
@@ -90,7 +90,7 @@ class CC_EXPORT LayerTreeImpl {
LayerImpl* FindRecycleTreeLayerById(int id);
int MaxTextureSize() const;
bool PinchGestureActive() const;
- base::TimeTicks CurrentFrameTimeTicks() const;
+ BeginFrameArgs CurrentBeginFrameArgs() const;
base::TimeDelta begin_impl_frame_interval() const;
void SetNeedsCommit();
gfx::Rect DeviceViewport() const;
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index f400733..ab77579 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -430,7 +430,7 @@ bool SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time,
}
layer_tree_host_impl_->Animate(
- layer_tree_host_impl_->CurrentFrameTimeTicks());
+ layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time);
UpdateBackgroundAnimateTicking();
if (!layer_tree_host_impl_->IsContextLost()) {
@@ -443,7 +443,7 @@ bool SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time,
bool start_ready_animations = true;
layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
- layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame();
+ layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
}
if (lost_output_surface) {
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index a4a630e..2e41ea7 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -694,8 +694,8 @@ void ThreadProxy::ScheduledActionSendBeginMainFrame() {
scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state(
new BeginMainFrameAndCommitState);
begin_main_frame_state->begin_frame_id = begin_frame_id;
- begin_main_frame_state->monotonic_frame_begin_time =
- impl().layer_tree_host_impl->CurrentFrameTimeTicks();
+ begin_main_frame_state->begin_frame_args =
+ impl().layer_tree_host_impl->CurrentBeginFrameArgs();
begin_main_frame_state->scroll_info =
impl().layer_tree_host_impl->ProcessScrollDeltas();
@@ -782,12 +782,11 @@ void ThreadProxy::BeginMainFrame(
layer_tree_host()->WillBeginMainFrame();
- layer_tree_host()->UpdateClientAnimations(
- begin_main_frame_state->monotonic_frame_begin_time);
+ layer_tree_host()->BeginMainFrame(begin_main_frame_state->begin_frame_args);
layer_tree_host()->AnimateLayers(
- begin_main_frame_state->monotonic_frame_begin_time);
+ begin_main_frame_state->begin_frame_args.frame_time);
blocked_main().last_monotonic_frame_begin_time =
- begin_main_frame_state->monotonic_frame_begin_time;
+ begin_main_frame_state->begin_frame_args.frame_time;
// Unlink any backings that the impl thread has evicted, so that we know to
// re-paint them in UpdateLayers.
@@ -959,7 +958,7 @@ void ThreadProxy::ScheduledActionAnimate() {
if (!impl().animations_frozen_until_next_draw) {
impl().animation_time =
- impl().layer_tree_host_impl->CurrentFrameTimeTicks();
+ impl().layer_tree_host_impl->CurrentBeginFrameArgs().frame_time;
}
impl().layer_tree_host_impl->Animate(impl().animation_time);
impl().did_commit_after_animating = false;
@@ -1169,7 +1168,7 @@ base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() {
}
void ThreadProxy::DidBeginImplFrameDeadline() {
- impl().layer_tree_host_impl->ResetCurrentFrameTimeForNextFrame();
+ impl().layer_tree_host_impl->ResetCurrentBeginFrameArgsForNextFrame();
}
void ThreadProxy::ReadyToFinalizeTextureUpdates() {
diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h
index 1621ebc..ff7325c 100644
--- a/cc/trees/thread_proxy.h
+++ b/cc/trees/thread_proxy.h
@@ -49,7 +49,7 @@ class CC_EXPORT ThreadProxy : public Proxy,
~BeginMainFrameAndCommitState();
unsigned int begin_frame_id;
- base::TimeTicks monotonic_frame_begin_time;
+ BeginFrameArgs begin_frame_args;
scoped_ptr<ScrollAndScaleSet> scroll_info;
size_t memory_allocation_limit_bytes;
int memory_allocation_priority_cutoff;
diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h
index 9b75bd9..e24d581 100644
--- a/content/browser/renderer_host/compositor_impl_android.h
+++ b/content/browser/renderer_host/compositor_impl_android.h
@@ -69,7 +69,7 @@ class CONTENT_EXPORT CompositorImpl
// LayerTreeHostClient implementation.
virtual void WillBeginMainFrame(int frame_id) OVERRIDE {}
virtual void DidBeginMainFrame() OVERRIDE {}
- virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {}
+ virtual void BeginMainFrame(const cc::BeginFrameArgs& args) OVERRIDE {}
virtual void Layout() OVERRIDE;
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) OVERRIDE {}
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc
index 23230ee..d21b85b 100644
--- a/content/renderer/gpu/render_widget_compositor.cc
+++ b/content/renderer/gpu/render_widget_compositor.cc
@@ -22,6 +22,7 @@
#include "cc/debug/micro_benchmark.h"
#include "cc/input/layer_selection_bound.h"
#include "cc/layers/layer.h"
+#include "cc/output/begin_frame_args.h"
#include "cc/output/copy_output_request.h"
#include "cc/output/copy_output_result.h"
#include "cc/resources/single_release_callback.h"
@@ -55,10 +56,11 @@ namespace cc {
class Layer;
}
+using blink::WebBeginFrameArgs;
using blink::WebFloatPoint;
+using blink::WebRect;
using blink::WebSelectionBound;
using blink::WebSize;
-using blink::WebRect;
namespace content {
namespace {
@@ -437,10 +439,6 @@ bool RenderWidgetCompositor::BeginMainFrameRequested() const {
return layer_tree_host_->BeginMainFrameRequested();
}
-void RenderWidgetCompositor::UpdateAnimations(base::TimeTicks time) {
- layer_tree_host_->UpdateClientAnimations(time);
-}
-
void RenderWidgetCompositor::SetNeedsDisplayOnAllLayers() {
layer_tree_host_->SetNeedsDisplayOnAllLayers();
}
@@ -758,9 +756,10 @@ void RenderWidgetCompositor::DidBeginMainFrame() {
widget_->InstrumentDidBeginFrame();
}
-void RenderWidgetCompositor::Animate(base::TimeTicks frame_begin_time) {
- widget_->webwidget()->animate(
- (frame_begin_time - base::TimeTicks()).InSecondsF());
+void RenderWidgetCompositor::BeginMainFrame(const cc::BeginFrameArgs& args) {
+ double frame_time = (args.frame_time - base::TimeTicks()).InSecondsF();
+ WebBeginFrameArgs web_begin_frame_args = WebBeginFrameArgs(frame_time);
+ widget_->webwidget()->beginFrame(web_begin_frame_args);
}
void RenderWidgetCompositor::Layout() {
diff --git a/content/renderer/gpu/render_widget_compositor.h b/content/renderer/gpu/render_widget_compositor.h
index e0541ec..95f9179 100644
--- a/content/renderer/gpu/render_widget_compositor.h
+++ b/content/renderer/gpu/render_widget_compositor.h
@@ -46,7 +46,6 @@ class RenderWidgetCompositor : public blink::WebLayerTreeView,
const base::WeakPtr<cc::InputHandler>& GetInputHandler();
void SetSuppressScheduleComposite(bool suppress);
bool BeginMainFrameRequested() const;
- void UpdateAnimations(base::TimeTicks time);
void SetNeedsDisplayOnAllLayers();
void SetRasterizeOnlyVisibleContent();
void UpdateTopControlsState(cc::TopControlsState constraints,
@@ -129,7 +128,7 @@ class RenderWidgetCompositor : public blink::WebLayerTreeView,
// cc::LayerTreeHostClient implementation.
virtual void WillBeginMainFrame(int frame_id) OVERRIDE;
virtual void DidBeginMainFrame() OVERRIDE;
- virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE;
+ virtual void BeginMainFrame(const cc::BeginFrameArgs& args) OVERRIDE;
virtual void Layout() OVERRIDE;
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) OVERRIDE;
diff --git a/content/test/web_layer_tree_view_impl_for_testing.h b/content/test/web_layer_tree_view_impl_for_testing.h
index 13d6ee4..26a6260 100644
--- a/content/test/web_layer_tree_view_impl_for_testing.h
+++ b/content/test/web_layer_tree_view_impl_for_testing.h
@@ -67,7 +67,7 @@ class WebLayerTreeViewImplForTesting
// cc::LayerTreeHostClient implementation.
virtual void WillBeginMainFrame(int frame_id) OVERRIDE {}
virtual void DidBeginMainFrame() OVERRIDE {}
- virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE {}
+ virtual void BeginMainFrame(const cc::BeginFrameArgs& args) OVERRIDE {}
virtual void Layout() OVERRIDE;
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) OVERRIDE;
diff --git a/mojo/examples/compositor_app/compositor_host.cc b/mojo/examples/compositor_app/compositor_host.cc
index 1c47cdb..0cc1aea 100644
--- a/mojo/examples/compositor_app/compositor_host.cc
+++ b/mojo/examples/compositor_app/compositor_host.cc
@@ -6,6 +6,7 @@
#include "cc/layers/layer.h"
#include "cc/layers/solid_color_layer.h"
+#include "cc/output/begin_frame_args.h"
#include "cc/output/context_provider.h"
#include "cc/output/output_surface.h"
#include "cc/trees/layer_tree_host.h"
@@ -58,10 +59,10 @@ void CompositorHost::SetupScene() {
void CompositorHost::WillBeginMainFrame(int frame_id) {}
void CompositorHost::DidBeginMainFrame() {}
-void CompositorHost::Animate(base::TimeTicks frame_begin_time) {
+void CompositorHost::BeginMainFrame(const cc::BeginFrameArgs& args) {
// TODO(jamesr): Should use cc's animation system.
static const double kDegreesPerSecond = 70.0;
- double time_in_seconds = (frame_begin_time - base::TimeTicks()).InSecondsF();
+ double time_in_seconds = (args.frame_time - base::TimeTicks()).InSecondsF();
double child_rotation_degrees = kDegreesPerSecond * time_in_seconds;
gfx::Transform child_transform;
child_transform.Translate(200, 200);
diff --git a/mojo/examples/compositor_app/compositor_host.h b/mojo/examples/compositor_app/compositor_host.h
index ea49e28..2576fdd 100644
--- a/mojo/examples/compositor_app/compositor_host.h
+++ b/mojo/examples/compositor_app/compositor_host.h
@@ -31,7 +31,7 @@ class CompositorHost : public cc::LayerTreeHostClient {
// cc::LayerTreeHostClient implementation.
virtual void WillBeginMainFrame(int frame_id) OVERRIDE;
virtual void DidBeginMainFrame() OVERRIDE;
- virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE;
+ virtual void BeginMainFrame(const cc::BeginFrameArgs& args) OVERRIDE;
virtual void Layout() OVERRIDE;
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) OVERRIDE;
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index fce83d6..34dca93 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -18,6 +18,7 @@
#include "cc/base/switches.h"
#include "cc/input/input_handler.h"
#include "cc/layers/layer.h"
+#include "cc/output/begin_frame_args.h"
#include "cc/output/context_provider.h"
#include "cc/trees/layer_tree_host.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -224,10 +225,13 @@ void Compositor::Draw() {
if (!IsLocked()) {
// TODO(nduca): Temporary while compositor calls
// compositeImmediately() directly.
- base::TimeTicks now = gfx::FrameTime::Now();
- Animate(now);
+ cc::BeginFrameArgs args =
+ cc::BeginFrameArgs::Create(gfx::FrameTime::Now(),
+ base::TimeTicks(),
+ cc::BeginFrameArgs::DefaultInterval());
+ BeginMainFrame(args);
Layout();
- host_->Composite(now);
+ host_->Composite(args.frame_time);
}
if (swap_state_ == SWAP_NONE)
NotifyEnd();
@@ -316,10 +320,10 @@ bool Compositor::HasAnimationObserver(CompositorAnimationObserver* observer) {
return animation_observer_list_.HasObserver(observer);
}
-void Compositor::Animate(base::TimeTicks frame_begin_time) {
+void Compositor::BeginMainFrame(const cc::BeginFrameArgs& args) {
FOR_EACH_OBSERVER(CompositorAnimationObserver,
animation_observer_list_,
- OnAnimationStep(frame_begin_time));
+ OnAnimationStep(args.frame_time));
if (animation_observer_list_.might_have_observers())
host_->SetNeedsAnimate();
}
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index bfc0ce2..4cabee0 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -227,7 +227,7 @@ class COMPOSITOR_EXPORT Compositor
// LayerTreeHostClient implementation.
virtual void WillBeginMainFrame(int frame_id) OVERRIDE {}
virtual void DidBeginMainFrame() OVERRIDE {}
- virtual void Animate(base::TimeTicks frame_begin_time) OVERRIDE;
+ virtual void BeginMainFrame(const cc::BeginFrameArgs& args) OVERRIDE;
virtual void Layout() OVERRIDE;
virtual void ApplyScrollAndScale(const gfx::Vector2d& scroll_delta,
float page_scale) OVERRIDE {}