diff options
Diffstat (limited to 'cc')
33 files changed, 341 insertions, 326 deletions
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 5fa40dd..b10112a 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -619,7 +619,7 @@ void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { void Layer::SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset) { DCHECK(IsPropertyChangeAllowed()); - // This function only gets called during a begin frame, so there + // This function only gets called during a BeginMainFrame, so there // is no need to call SetNeedsUpdate here. DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); if (scroll_offset_ == scroll_offset) @@ -881,8 +881,8 @@ void Layer::PushPropertiesTo(LayerImpl* layer) { } // Adjust the scroll delta to be just the scrolls that have happened since - // the begin frame was sent. This happens for impl-side painting - // in LayerImpl::ApplyScrollDeltasSinceBeginFrame in a separate tree walk. + // the BeginMainFrame was sent. This happens for impl-side painting + // in LayerImpl::ApplyScrollDeltasSinceBeginMainFrame in a separate tree walk. if (layer->layer_tree_impl()->settings().impl_side_painting) { layer->SetScrollOffset(scroll_offset_); } else { diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 14f3e2a..ede4719 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -385,7 +385,7 @@ void LayerImpl::ApplySentScrollDeltasFromAbortedCommit() { sent_scroll_delta_ = gfx::Vector2d(); } -void LayerImpl::ApplyScrollDeltasSinceBeginFrame() { +void LayerImpl::ApplyScrollDeltasSinceBeginMainFrame() { // Only the pending tree can have missing scrolls. DCHECK(layer_tree_impl()->IsPendingTree()); if (!scrollable()) diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index 4bd91da..9d3951b 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h @@ -382,7 +382,7 @@ class CC_EXPORT LayerImpl : LayerAnimationValueObserver { } void ApplySentScrollDeltasFromAbortedCommit(); - void ApplyScrollDeltasSinceBeginFrame(); + void ApplyScrollDeltasSinceBeginMainFrame(); void SetShouldScrollOnMainThread(bool should_scroll_on_main_thread) { should_scroll_on_main_thread_ = should_scroll_on_main_thread; diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index bcebeab..774173a 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -48,10 +48,10 @@ OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider) device_scale_factor_(-1), max_frames_pending_(0), pending_swap_buffers_(0), - needs_begin_frame_(false), - client_ready_for_begin_frame_(true), + needs_begin_impl_frame_(false), + client_ready_for_begin_impl_frame_(true), client_(NULL), - check_for_retroactive_begin_frame_pending_(false), + check_for_retroactive_begin_impl_frame_pending_(false), external_stencil_test_enabled_(false), weak_ptr_factory_(this), gpu_latency_history_(kGpuLatencyHistorySize) {} @@ -64,10 +64,10 @@ OutputSurface::OutputSurface( device_scale_factor_(-1), max_frames_pending_(0), pending_swap_buffers_(0), - needs_begin_frame_(false), - client_ready_for_begin_frame_(true), + needs_begin_impl_frame_(false), + client_ready_for_begin_impl_frame_(true), client_(NULL), - check_for_retroactive_begin_frame_pending_(false), + check_for_retroactive_begin_impl_frame_pending_(false), external_stencil_test_enabled_(false), weak_ptr_factory_(this), gpu_latency_history_(kGpuLatencyHistorySize) {} @@ -82,15 +82,15 @@ OutputSurface::OutputSurface( device_scale_factor_(-1), max_frames_pending_(0), pending_swap_buffers_(0), - needs_begin_frame_(false), - client_ready_for_begin_frame_(true), + needs_begin_impl_frame_(false), + client_ready_for_begin_impl_frame_(true), client_(NULL), - check_for_retroactive_begin_frame_pending_(false), + check_for_retroactive_begin_impl_frame_pending_(false), external_stencil_test_enabled_(false), weak_ptr_factory_(this), gpu_latency_history_(kGpuLatencyHistorySize) {} -void OutputSurface::InitializeBeginFrameEmulation( +void OutputSurface::InitializeBeginImplFrameEmulation( base::SingleThreadTaskRunner* task_runner, bool throttle_frame_production, base::TimeDelta interval) { @@ -133,9 +133,9 @@ void OutputSurface::FrameRateControllerTick(bool throttled, const BeginFrameArgs& args) { DCHECK(frame_rate_controller_); if (throttled) - skipped_begin_frame_args_ = args; + skipped_begin_impl_frame_args_ = args; else - BeginFrame(args); + BeginImplFrame(args); } // Forwarded to OutputSurfaceClient @@ -144,62 +144,64 @@ void OutputSurface::SetNeedsRedrawRect(gfx::Rect damage_rect) { client_->SetNeedsRedrawRect(damage_rect); } -void OutputSurface::SetNeedsBeginFrame(bool enable) { - TRACE_EVENT1("cc", "OutputSurface::SetNeedsBeginFrame", "enable", enable); - needs_begin_frame_ = enable; - client_ready_for_begin_frame_ = true; +void OutputSurface::SetNeedsBeginImplFrame(bool enable) { + TRACE_EVENT1("cc", "OutputSurface::SetNeedsBeginImplFrame", "enable", enable); + needs_begin_impl_frame_ = enable; + client_ready_for_begin_impl_frame_ = true; if (frame_rate_controller_) { BeginFrameArgs skipped = frame_rate_controller_->SetActive(enable); if (skipped.IsValid()) - skipped_begin_frame_args_ = skipped; + skipped_begin_impl_frame_args_ = skipped; } - if (needs_begin_frame_) - PostCheckForRetroactiveBeginFrame(); + if (needs_begin_impl_frame_) + PostCheckForRetroactiveBeginImplFrame(); } -void OutputSurface::BeginFrame(const BeginFrameArgs& args) { - TRACE_EVENT2("cc", "OutputSurface::BeginFrame", - "client_ready_for_begin_frame_", client_ready_for_begin_frame_, +void OutputSurface::BeginImplFrame(const BeginFrameArgs& args) { + TRACE_EVENT2("cc", "OutputSurface::BeginImplFrame", + "client_ready_for_begin_impl_frame_", + client_ready_for_begin_impl_frame_, "pending_swap_buffers_", pending_swap_buffers_); - if (!needs_begin_frame_ || !client_ready_for_begin_frame_ || + if (!needs_begin_impl_frame_ || !client_ready_for_begin_impl_frame_ || (pending_swap_buffers_ >= max_frames_pending_ && max_frames_pending_ > 0)) { - skipped_begin_frame_args_ = args; + skipped_begin_impl_frame_args_ = args; } else { - client_ready_for_begin_frame_ = false; - client_->BeginFrame(args); - // args might be an alias for skipped_begin_frame_args_. - // Do not reset it before calling BeginFrame! - skipped_begin_frame_args_ = BeginFrameArgs(); + client_ready_for_begin_impl_frame_ = false; + client_->BeginImplFrame(args); + // args might be an alias for skipped_begin_impl_frame_args_. + // Do not reset it before calling BeginImplFrame! + skipped_begin_impl_frame_args_ = BeginFrameArgs(); } } -base::TimeTicks OutputSurface::RetroactiveBeginFrameDeadline() { +base::TimeTicks OutputSurface::RetroactiveBeginImplFrameDeadline() { // TODO(brianderson): Remove the alternative deadline once we have better // deadline estimations. base::TimeTicks alternative_deadline = - skipped_begin_frame_args_.frame_time + + skipped_begin_impl_frame_args_.frame_time + BeginFrameArgs::DefaultRetroactiveBeginFramePeriod(); - return std::max(skipped_begin_frame_args_.deadline, alternative_deadline); + return std::max(skipped_begin_impl_frame_args_.deadline, + alternative_deadline); } -void OutputSurface::PostCheckForRetroactiveBeginFrame() { - if (!skipped_begin_frame_args_.IsValid() || - check_for_retroactive_begin_frame_pending_) +void OutputSurface::PostCheckForRetroactiveBeginImplFrame() { + if (!skipped_begin_impl_frame_args_.IsValid() || + check_for_retroactive_begin_impl_frame_pending_) return; base::MessageLoop::current()->PostTask( FROM_HERE, - base::Bind(&OutputSurface::CheckForRetroactiveBeginFrame, + base::Bind(&OutputSurface::CheckForRetroactiveBeginImplFrame, weak_ptr_factory_.GetWeakPtr())); - check_for_retroactive_begin_frame_pending_ = true; + check_for_retroactive_begin_impl_frame_pending_ = true; } -void OutputSurface::CheckForRetroactiveBeginFrame() { - TRACE_EVENT0("cc", "OutputSurface::CheckForRetroactiveBeginFrame"); - check_for_retroactive_begin_frame_pending_ = false; - if (base::TimeTicks::Now() < RetroactiveBeginFrameDeadline()) - BeginFrame(skipped_begin_frame_args_); +void OutputSurface::CheckForRetroactiveBeginImplFrame() { + TRACE_EVENT0("cc", "OutputSurface::CheckForRetroactiveBeginImplFrame"); + check_for_retroactive_begin_impl_frame_pending_ = false; + if (base::TimeTicks::Now() < RetroactiveBeginImplFrameDeadline()) + BeginImplFrame(skipped_begin_impl_frame_args_); } void OutputSurface::DidSwapBuffers() { @@ -208,7 +210,7 @@ void OutputSurface::DidSwapBuffers() { "pending_swap_buffers_", pending_swap_buffers_); if (frame_rate_controller_) frame_rate_controller_->DidSwapBuffers(); - PostCheckForRetroactiveBeginFrame(); + PostCheckForRetroactiveBeginImplFrame(); } void OutputSurface::OnSwapBuffersComplete() { @@ -218,7 +220,7 @@ void OutputSurface::OnSwapBuffersComplete() { client_->OnSwapBuffersComplete(); if (frame_rate_controller_) frame_rate_controller_->DidSwapBuffersComplete(); - PostCheckForRetroactiveBeginFrame(); + PostCheckForRetroactiveBeginImplFrame(); } void OutputSurface::ReclaimResources(const CompositorFrameAck* ack) { @@ -227,9 +229,9 @@ void OutputSurface::ReclaimResources(const CompositorFrameAck* ack) { void OutputSurface::DidLoseOutputSurface() { TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); - client_ready_for_begin_frame_ = true; + client_ready_for_begin_impl_frame_ = true; pending_swap_buffers_ = 0; - skipped_begin_frame_args_ = BeginFrameArgs(); + skipped_begin_impl_frame_args_ = BeginFrameArgs(); if (frame_rate_controller_) frame_rate_controller_->SetActive(false); pending_gpu_latency_query_ids_.clear(); diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index 97e5744..83ee5fd 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -68,7 +68,7 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { int max_frames_pending; bool deferred_gl_initialization; bool draw_and_swap_full_viewport_every_frame; - // This doesn't handle the <webview> case, but once BeginFrame is + // This doesn't handle the <webview> case, but once BeginImplFrame is // supported natively, we shouldn't need adjust_deadline_for_parent. bool adjust_deadline_for_parent; // Whether this output surface renders to the default OpenGL zero @@ -104,7 +104,7 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { // thread. virtual bool BindToClient(OutputSurfaceClient* client); - void InitializeBeginFrameEmulation( + void InitializeBeginImplFrameEmulation( base::SingleThreadTaskRunner* task_runner, bool throttle_frame_production, base::TimeDelta interval); @@ -128,10 +128,10 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { // processing should be stopped, or lowered in priority. virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} - // Requests a BeginFrame notification from the output surface. The + // Requests a BeginImplFrame notification from the output surface. The // notification will be delivered by calling - // OutputSurfaceClient::BeginFrame until the callback is disabled. - virtual void SetNeedsBeginFrame(bool enable); + // OutputSurfaceClient::BeginImplFrame until the callback is disabled. + virtual void SetNeedsBeginImplFrame(bool enable); bool HasClient() { return !!client_; } @@ -160,7 +160,7 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { float device_scale_factor_; // The FrameRateController is deprecated. - // Platforms should move to native BeginFrames instead. + // Platforms should move to native BeginImplFrames instead. void OnVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval); virtual void FrameRateControllerTick(bool throttled, @@ -168,17 +168,17 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { scoped_ptr<FrameRateController> frame_rate_controller_; int max_frames_pending_; int pending_swap_buffers_; - bool needs_begin_frame_; - bool client_ready_for_begin_frame_; + bool needs_begin_impl_frame_; + bool client_ready_for_begin_impl_frame_; - // This stores a BeginFrame that we couldn't process immediately, but might - // process retroactively in the near future. - BeginFrameArgs skipped_begin_frame_args_; + // This stores a BeginImplFrame that we couldn't process immediately, + // but might process retroactively in the near future. + BeginFrameArgs skipped_begin_impl_frame_args_; // Forwarded to OutputSurfaceClient but threaded through OutputSurface // first so OutputSurface has a chance to update the FrameRateController void SetNeedsRedrawRect(gfx::Rect damage_rect); - void BeginFrame(const BeginFrameArgs& args); + void BeginImplFrame(const BeginFrameArgs& args); void DidSwapBuffers(); void OnSwapBuffersComplete(); void ReclaimResources(const CompositorFrameAck* ack); @@ -190,9 +190,9 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { bool valid_for_tile_management); // virtual for testing. - virtual base::TimeTicks RetroactiveBeginFrameDeadline(); - virtual void PostCheckForRetroactiveBeginFrame(); - void CheckForRetroactiveBeginFrame(); + virtual base::TimeTicks RetroactiveBeginImplFrameDeadline(); + virtual void PostCheckForRetroactiveBeginImplFrame(); + void CheckForRetroactiveBeginImplFrame(); private: OutputSurfaceClient* client_; @@ -204,9 +204,9 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { bool discard_backbuffer_when_not_visible); void UpdateAndMeasureGpuLatency(); - // check_for_retroactive_begin_frame_pending_ is used to avoid posting - // redundant checks for a retroactive BeginFrame. - bool check_for_retroactive_begin_frame_pending_; + // check_for_retroactive_begin_impl_frame_pending_ is used to avoid posting + // redundant checks for a retroactive BeginImplFrame. + bool check_for_retroactive_begin_impl_frame_pending_; bool external_stencil_test_enabled_; diff --git a/cc/output/output_surface_client.h b/cc/output/output_surface_client.h index c0e2e45..192400c 100644 --- a/cc/output/output_surface_client.h +++ b/cc/output/output_surface_client.h @@ -31,7 +31,7 @@ class CC_EXPORT OutputSurfaceClient { scoped_refptr<ContextProvider> offscreen_context_provider) = 0; virtual void ReleaseGL() = 0; virtual void SetNeedsRedrawRect(gfx::Rect damage_rect) = 0; - virtual void BeginFrame(const BeginFrameArgs& args) = 0; + virtual void BeginImplFrame(const BeginFrameArgs& args) = 0; virtual void OnSwapBuffersComplete() = 0; virtual void ReclaimResources(const CompositorFrameAck* ack) = 0; virtual void DidLoseOutputSurface() = 0; diff --git a/cc/output/output_surface_unittest.cc b/cc/output/output_surface_unittest.cc index 91e7c39..bf18ada 100644 --- a/cc/output/output_surface_unittest.cc +++ b/cc/output/output_surface_unittest.cc @@ -23,19 +23,19 @@ class TestOutputSurface : public OutputSurface { public: explicit TestOutputSurface(scoped_refptr<ContextProvider> context_provider) : OutputSurface(context_provider), - retroactive_begin_frame_deadline_enabled_(false), + retroactive_begin_impl_frame_deadline_enabled_(false), override_retroactive_period_(false) {} explicit TestOutputSurface( scoped_ptr<cc::SoftwareOutputDevice> software_device) : OutputSurface(software_device.Pass()), - retroactive_begin_frame_deadline_enabled_(false), + retroactive_begin_impl_frame_deadline_enabled_(false), override_retroactive_period_(false) {} TestOutputSurface(scoped_refptr<ContextProvider> context_provider, scoped_ptr<cc::SoftwareOutputDevice> software_device) : OutputSurface(context_provider, software_device.Pass()), - retroactive_begin_frame_deadline_enabled_(false), + retroactive_begin_impl_frame_deadline_enabled_(false), override_retroactive_period_(false) {} bool InitializeNewContext3d( @@ -51,8 +51,8 @@ class TestOutputSurface : public OutputSurface { OnVSyncParametersChanged(timebase, interval); } - void BeginFrameForTesting() { - OutputSurface::BeginFrame(BeginFrameArgs::CreateExpiredForTesting()); + void BeginImplFrameForTesting() { + OutputSurface::BeginImplFrame(BeginFrameArgs::CreateExpiredForTesting()); } void DidSwapBuffersForTesting() { @@ -67,33 +67,34 @@ class TestOutputSurface : public OutputSurface { OnSwapBuffersComplete(); } - void EnableRetroactiveBeginFrameDeadline(bool enable, - bool override_retroactive_period, - base::TimeDelta period_override) { - retroactive_begin_frame_deadline_enabled_ = enable; + void EnableRetroactiveBeginImplFrameDeadline( + bool enable, + bool override_retroactive_period, + base::TimeDelta period_override) { + retroactive_begin_impl_frame_deadline_enabled_ = enable; override_retroactive_period_ = override_retroactive_period; retroactive_period_override_ = period_override; } protected: - virtual void PostCheckForRetroactiveBeginFrame() OVERRIDE { + virtual void PostCheckForRetroactiveBeginImplFrame() OVERRIDE { // For testing purposes, we check immediately rather than posting a task. - CheckForRetroactiveBeginFrame(); + CheckForRetroactiveBeginImplFrame(); } - virtual base::TimeTicks RetroactiveBeginFrameDeadline() OVERRIDE { - if (retroactive_begin_frame_deadline_enabled_) { + virtual base::TimeTicks RetroactiveBeginImplFrameDeadline() OVERRIDE { + if (retroactive_begin_impl_frame_deadline_enabled_) { if (override_retroactive_period_) { - return skipped_begin_frame_args_.frame_time + + return skipped_begin_impl_frame_args_.frame_time + retroactive_period_override_; } else { - return OutputSurface::RetroactiveBeginFrameDeadline(); + return OutputSurface::RetroactiveBeginImplFrameDeadline(); } } return base::TimeTicks(); } - bool retroactive_begin_frame_deadline_enabled_; + bool retroactive_begin_impl_frame_deadline_enabled_; bool override_retroactive_period_; base::TimeDelta retroactive_period_override_; }; @@ -218,7 +219,7 @@ TEST_F(OutputSurfaceTestInitializeNewContext3d, ClientDeferredInitializeFails) { InitializeNewContextExpectFail(); } -TEST(OutputSurfaceTest, BeginFrameEmulation) { +TEST(OutputSurfaceTest, BeginImplFrameEmulation) { TestOutputSurface output_surface(TestContextProvider::Create()); EXPECT_FALSE(output_surface.HasClient()); @@ -227,84 +228,86 @@ TEST(OutputSurfaceTest, BeginFrameEmulation) { EXPECT_TRUE(output_surface.HasClient()); EXPECT_FALSE(client.deferred_initialize_called()); - // Initialize BeginFrame emulation + // Initialize BeginImplFrame emulation scoped_refptr<base::TestSimpleTaskRunner> task_runner = new base::TestSimpleTaskRunner; bool throttle_frame_production = true; const base::TimeDelta display_refresh_interval = BeginFrameArgs::DefaultInterval(); - output_surface.InitializeBeginFrameEmulation( + output_surface.InitializeBeginImplFrameEmulation( task_runner.get(), throttle_frame_production, display_refresh_interval); output_surface.SetMaxFramesPending(2); - output_surface.EnableRetroactiveBeginFrameDeadline( + output_surface.EnableRetroactiveBeginImplFrameDeadline( false, false, base::TimeDelta()); - // We should start off with 0 BeginFrames - EXPECT_EQ(client.begin_frame_count(), 0); + // We should start off with 0 BeginImplFrames + EXPECT_EQ(client.begin_impl_frame_count(), 0); EXPECT_EQ(output_surface.pending_swap_buffers(), 0); - // We should not have a pending task until a BeginFrame has been requested. + // We should not have a pending task until a BeginImplFrame has been + // requested. EXPECT_FALSE(task_runner->HasPendingTask()); - output_surface.SetNeedsBeginFrame(true); + output_surface.SetNeedsBeginImplFrame(true); EXPECT_TRUE(task_runner->HasPendingTask()); - // BeginFrame should be called on the first tick. + // BeginImplFrame should be called on the first tick. task_runner->RunPendingTasks(); - EXPECT_EQ(client.begin_frame_count(), 1); + EXPECT_EQ(client.begin_impl_frame_count(), 1); EXPECT_EQ(output_surface.pending_swap_buffers(), 0); - // BeginFrame should not be called when there is a pending BeginFrame. + // BeginImplFrame should not be called when there is a pending BeginImplFrame. task_runner->RunPendingTasks(); - EXPECT_EQ(client.begin_frame_count(), 1); + EXPECT_EQ(client.begin_impl_frame_count(), 1); EXPECT_EQ(output_surface.pending_swap_buffers(), 0); - // SetNeedsBeginFrame should clear the pending BeginFrame after + // SetNeedsBeginImplFrame should clear the pending BeginImplFrame after // a SwapBuffers. output_surface.DidSwapBuffersForTesting(); - output_surface.SetNeedsBeginFrame(true); - EXPECT_EQ(client.begin_frame_count(), 1); + output_surface.SetNeedsBeginImplFrame(true); + EXPECT_EQ(client.begin_impl_frame_count(), 1); EXPECT_EQ(output_surface.pending_swap_buffers(), 1); task_runner->RunPendingTasks(); - EXPECT_EQ(client.begin_frame_count(), 2); + EXPECT_EQ(client.begin_impl_frame_count(), 2); EXPECT_EQ(output_surface.pending_swap_buffers(), 1); - // BeginFrame should be throttled by pending swap buffers. + // BeginImplFrame should be throttled by pending swap buffers. output_surface.DidSwapBuffersForTesting(); - output_surface.SetNeedsBeginFrame(true); - EXPECT_EQ(client.begin_frame_count(), 2); + output_surface.SetNeedsBeginImplFrame(true); + EXPECT_EQ(client.begin_impl_frame_count(), 2); EXPECT_EQ(output_surface.pending_swap_buffers(), 2); task_runner->RunPendingTasks(); - EXPECT_EQ(client.begin_frame_count(), 2); + EXPECT_EQ(client.begin_impl_frame_count(), 2); EXPECT_EQ(output_surface.pending_swap_buffers(), 2); - // SwapAck should decrement pending swap buffers and unblock BeginFrame again. + // SwapAck should decrement pending swap buffers and unblock BeginImplFrame + // again. output_surface.OnSwapBuffersCompleteForTesting(); - EXPECT_EQ(client.begin_frame_count(), 2); + EXPECT_EQ(client.begin_impl_frame_count(), 2); EXPECT_EQ(output_surface.pending_swap_buffers(), 1); task_runner->RunPendingTasks(); - EXPECT_EQ(client.begin_frame_count(), 3); + EXPECT_EQ(client.begin_impl_frame_count(), 3); EXPECT_EQ(output_surface.pending_swap_buffers(), 1); - // Calling SetNeedsBeginFrame again indicates a swap did not occur but - // the client still wants another BeginFrame. - output_surface.SetNeedsBeginFrame(true); + // Calling SetNeedsBeginImplFrame again indicates a swap did not occur but + // the client still wants another BeginImplFrame. + output_surface.SetNeedsBeginImplFrame(true); task_runner->RunPendingTasks(); - EXPECT_EQ(client.begin_frame_count(), 4); + EXPECT_EQ(client.begin_impl_frame_count(), 4); EXPECT_EQ(output_surface.pending_swap_buffers(), 1); - // Disabling SetNeedsBeginFrame should prevent further BeginFrames. - output_surface.SetNeedsBeginFrame(false); + // Disabling SetNeedsBeginImplFrame should prevent further BeginImplFrames. + output_surface.SetNeedsBeginImplFrame(false); task_runner->RunPendingTasks(); EXPECT_FALSE(task_runner->HasPendingTask()); - EXPECT_EQ(client.begin_frame_count(), 4); + EXPECT_EQ(client.begin_impl_frame_count(), 4); EXPECT_EQ(output_surface.pending_swap_buffers(), 1); } -TEST(OutputSurfaceTest, OptimisticAndRetroactiveBeginFrames) { +TEST(OutputSurfaceTest, OptimisticAndRetroactiveBeginImplFrames) { TestOutputSurface output_surface(TestContextProvider::Create()); EXPECT_FALSE(output_surface.HasClient()); @@ -314,47 +317,48 @@ TEST(OutputSurfaceTest, OptimisticAndRetroactiveBeginFrames) { EXPECT_FALSE(client.deferred_initialize_called()); output_surface.SetMaxFramesPending(2); - output_surface.EnableRetroactiveBeginFrameDeadline( + output_surface.EnableRetroactiveBeginImplFrameDeadline( true, false, base::TimeDelta()); - // Optimistically injected BeginFrames should be throttled if - // SetNeedsBeginFrame is false... - output_surface.SetNeedsBeginFrame(false); - output_surface.BeginFrameForTesting(); - EXPECT_EQ(client.begin_frame_count(), 0); - // ...and retroactively triggered by a SetNeedsBeginFrame. - output_surface.SetNeedsBeginFrame(true); - EXPECT_EQ(client.begin_frame_count(), 1); - - // Optimistically injected BeginFrames should be throttled by pending - // BeginFrames... - output_surface.BeginFrameForTesting(); - EXPECT_EQ(client.begin_frame_count(), 1); - // ...and retroactively triggered by a SetNeedsBeginFrame. - output_surface.SetNeedsBeginFrame(true); - EXPECT_EQ(client.begin_frame_count(), 2); + // Optimistically injected BeginImplFrames should be throttled if + // SetNeedsBeginImplFrame is false... + output_surface.SetNeedsBeginImplFrame(false); + output_surface.BeginImplFrameForTesting(); + EXPECT_EQ(client.begin_impl_frame_count(), 0); + // ...and retroactively triggered by a SetNeedsBeginImplFrame. + output_surface.SetNeedsBeginImplFrame(true); + EXPECT_EQ(client.begin_impl_frame_count(), 1); + + // Optimistically injected BeginImplFrames should be throttled by pending + // BeginImplFrames... + output_surface.BeginImplFrameForTesting(); + EXPECT_EQ(client.begin_impl_frame_count(), 1); + // ...and retroactively triggered by a SetNeedsBeginImplFrame. + output_surface.SetNeedsBeginImplFrame(true); + EXPECT_EQ(client.begin_impl_frame_count(), 2); // ...or retroactively triggered by a Swap. - output_surface.BeginFrameForTesting(); - EXPECT_EQ(client.begin_frame_count(), 2); + output_surface.BeginImplFrameForTesting(); + EXPECT_EQ(client.begin_impl_frame_count(), 2); output_surface.DidSwapBuffersForTesting(); - output_surface.SetNeedsBeginFrame(true); - EXPECT_EQ(client.begin_frame_count(), 3); + output_surface.SetNeedsBeginImplFrame(true); + EXPECT_EQ(client.begin_impl_frame_count(), 3); EXPECT_EQ(output_surface.pending_swap_buffers(), 1); - // Optimistically injected BeginFrames should be by throttled by pending + // Optimistically injected BeginImplFrames should be by throttled by pending // swap buffers... output_surface.DidSwapBuffersForTesting(); - output_surface.SetNeedsBeginFrame(true); - EXPECT_EQ(client.begin_frame_count(), 3); + output_surface.SetNeedsBeginImplFrame(true); + EXPECT_EQ(client.begin_impl_frame_count(), 3); EXPECT_EQ(output_surface.pending_swap_buffers(), 2); - output_surface.BeginFrameForTesting(); - EXPECT_EQ(client.begin_frame_count(), 3); + output_surface.BeginImplFrameForTesting(); + EXPECT_EQ(client.begin_impl_frame_count(), 3); // ...and retroactively triggered by OnSwapBuffersComplete output_surface.OnSwapBuffersCompleteForTesting(); - EXPECT_EQ(client.begin_frame_count(), 4); + EXPECT_EQ(client.begin_impl_frame_count(), 4); } -TEST(OutputSurfaceTest, RetroactiveBeginFrameDoesNotDoubleTickWhenEmulating) { +TEST(OutputSurfaceTest, + RetroactiveBeginImplFrameDoesNotDoubleTickWhenEmulating) { scoped_refptr<TestContextProvider> context_provider = TestContextProvider::Create(); @@ -368,13 +372,13 @@ TEST(OutputSurfaceTest, RetroactiveBeginFrameDoesNotDoubleTickWhenEmulating) { base::TimeDelta big_interval = base::TimeDelta::FromSeconds(10); - // Initialize BeginFrame emulation + // Initialize BeginImplFrame emulation scoped_refptr<base::TestSimpleTaskRunner> task_runner = new base::TestSimpleTaskRunner; bool throttle_frame_production = true; const base::TimeDelta display_refresh_interval = big_interval; - output_surface.InitializeBeginFrameEmulation( + output_surface.InitializeBeginImplFrameEmulation( task_runner.get(), throttle_frame_production, display_refresh_interval); @@ -385,28 +389,31 @@ TEST(OutputSurfaceTest, RetroactiveBeginFrameDoesNotDoubleTickWhenEmulating) { base::TimeTicks::Now() - base::TimeDelta::FromSeconds(1), big_interval); output_surface.SetMaxFramesPending(2); - output_surface.EnableRetroactiveBeginFrameDeadline(true, true, big_interval); + output_surface.EnableRetroactiveBeginImplFrameDeadline( + true, true, big_interval); - // We should start off with 0 BeginFrames - EXPECT_EQ(client.begin_frame_count(), 0); + // We should start off with 0 BeginImplFrames + EXPECT_EQ(client.begin_impl_frame_count(), 0); EXPECT_EQ(output_surface.pending_swap_buffers(), 0); - // The first SetNeedsBeginFrame(true) should start a retroactive BeginFrame. + // The first SetNeedsBeginImplFrame(true) should start a retroactive + // BeginImplFrame. EXPECT_FALSE(task_runner->HasPendingTask()); - output_surface.SetNeedsBeginFrame(true); + output_surface.SetNeedsBeginImplFrame(true); EXPECT_TRUE(task_runner->HasPendingTask()); EXPECT_GT(task_runner->NextPendingTaskDelay(), big_interval / 2); - EXPECT_EQ(client.begin_frame_count(), 1); + EXPECT_EQ(client.begin_impl_frame_count(), 1); - output_surface.SetNeedsBeginFrame(false); + output_surface.SetNeedsBeginImplFrame(false); EXPECT_TRUE(task_runner->HasPendingTask()); - EXPECT_EQ(client.begin_frame_count(), 1); + EXPECT_EQ(client.begin_impl_frame_count(), 1); - // The second SetNeedBeginFrame(true) should not retroactively start a - // BeginFrame if the timestamp would be the same as the previous BeginFrame. - output_surface.SetNeedsBeginFrame(true); + // The second SetNeedBeginImplFrame(true) should not retroactively start a + // BeginImplFrame if the timestamp would be the same as the previous + // BeginImplFrame. + output_surface.SetNeedsBeginImplFrame(true); EXPECT_TRUE(task_runner->HasPendingTask()); - EXPECT_EQ(client.begin_frame_count(), 1); + EXPECT_EQ(client.begin_impl_frame_count(), 1); } TEST(OutputSurfaceTest, MemoryAllocation) { diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc index 227d5ed..0e86382 100644 --- a/cc/scheduler/scheduler_state_machine.cc +++ b/cc/scheduler/scheduler_state_machine.cc @@ -823,7 +823,7 @@ bool SchedulerStateMachine::BeginImplFrameNeededToDraw() const { // These are cases where we are very likely to draw soon, but might not // actually have a new frame to draw when we receive the next BeginImplFrame. // Proactively requesting the BeginImplFrame helps hide the round trip latency -// of the SetNeedsBeginFrame request that has to go to the Browser. +// of the SetNeedsBeginImplFrame request that has to go to the Browser. bool SchedulerStateMachine::ProactiveBeginImplFrameWanted() const { // The output surface is the provider of BeginImplFrames, // so we are not going to get them even if we ask for them. @@ -850,9 +850,10 @@ bool SchedulerStateMachine::ProactiveBeginImplFrameWanted() const { return true; // If we just swapped, it's likely that we are going to produce another - // frame soon. This helps avoid negative glitches in our SetNeedsBeginFrame - // requests, which may propagate to the BeginImplFrame provider and get - // sampled at an inopportune time, delaying the next BeginImplFrame. + // frame soon. This helps avoid negative glitches in our + // SetNeedsBeginImplFrame requests, which may propagate to the BeginImplFrame + // provider and get sampled at an inopportune time, delaying the next + // BeginImplFrame. if (last_frame_number_swap_performed_ == current_frame_number_) return true; diff --git a/cc/test/fake_layer_tree_host_client.h b/cc/test/fake_layer_tree_host_client.h index 0a8470a..a1e1708 100644 --- a/cc/test/fake_layer_tree_host_client.h +++ b/cc/test/fake_layer_tree_host_client.h @@ -24,8 +24,8 @@ class FakeLayerTreeHostClient : public LayerTreeHostClient { explicit FakeLayerTreeHostClient(RendererOptions options); virtual ~FakeLayerTreeHostClient(); - virtual void WillBeginFrame() OVERRIDE {} - virtual void DidBeginFrame() OVERRIDE {} + virtual void WillBeginMainFrame() OVERRIDE {} + virtual void DidBeginMainFrame() OVERRIDE {} virtual void Animate(double frame_begin_time) OVERRIDE {} virtual void Layout() OVERRIDE {} virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, diff --git a/cc/test/fake_layer_tree_host_impl_client.h b/cc/test/fake_layer_tree_host_impl_client.h index b0e3a15..12e8fb7 100644 --- a/cc/test/fake_layer_tree_host_impl_client.h +++ b/cc/test/fake_layer_tree_host_impl_client.h @@ -15,7 +15,7 @@ class FakeLayerTreeHostImplClient : public LayerTreeHostImplClient { // LayerTreeHostImplClient implementation. virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE {} virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} - virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) + virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE {} virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE {} virtual void NotifyReadyToActivate() OVERRIDE {} diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc index ae5bd22..a2d67f7 100644 --- a/cc/test/fake_output_surface.cc +++ b/cc/test/fake_output_surface.cc @@ -19,7 +19,7 @@ FakeOutputSurface::FakeOutputSurface( : OutputSurface(context_provider), client_(NULL), num_sent_frames_(0), - needs_begin_frame_(false), + needs_begin_impl_frame_(false), forced_draw_to_software_device_(false), has_external_stencil_test_(false), fake_weak_ptr_factory_(this) { @@ -84,22 +84,22 @@ void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) { } } -void FakeOutputSurface::SetNeedsBeginFrame(bool enable) { - needs_begin_frame_ = enable; - OutputSurface::SetNeedsBeginFrame(enable); +void FakeOutputSurface::SetNeedsBeginImplFrame(bool enable) { + needs_begin_impl_frame_ = enable; + OutputSurface::SetNeedsBeginImplFrame(enable); - // If there is not BeginFrame emulation from the FrameRateController, - // then we just post a BeginFrame to emulate it as part of the test. + // If there is not BeginImplFrame emulation from the FrameRateController, + // then we just post a BeginImplFrame to emulate it as part of the test. if (enable && !frame_rate_controller_) { base::MessageLoop::current()->PostDelayedTask( - FROM_HERE, base::Bind(&FakeOutputSurface::OnBeginFrame, + FROM_HERE, base::Bind(&FakeOutputSurface::OnBeginImplFrame, fake_weak_ptr_factory_.GetWeakPtr()), base::TimeDelta::FromMilliseconds(16)); } } -void FakeOutputSurface::OnBeginFrame() { - OutputSurface::BeginFrame(BeginFrameArgs::CreateForTesting()); +void FakeOutputSurface::OnBeginImplFrame() { + OutputSurface::BeginImplFrame(BeginFrameArgs::CreateForTesting()); } diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h index a93b4f3..0540f13 100644 --- a/cc/test/fake_output_surface.h +++ b/cc/test/fake_output_surface.h @@ -94,9 +94,9 @@ class FakeOutputSurface : public OutputSurface { virtual void SwapBuffers(CompositorFrame* frame) OVERRIDE; - virtual void SetNeedsBeginFrame(bool enable) OVERRIDE; - bool needs_begin_frame() const { - return needs_begin_frame_; + virtual void SetNeedsBeginImplFrame(bool enable) OVERRIDE; + bool needs_begin_impl_frame() const { + return needs_begin_impl_frame_; } void set_forced_draw_to_software_device(bool forced) { @@ -140,12 +140,12 @@ class FakeOutputSurface : public OutputSurface { scoped_ptr<SoftwareOutputDevice> software_device, bool delegated_rendering); - void OnBeginFrame(); + void OnBeginImplFrame(); OutputSurfaceClient* client_; CompositorFrame last_sent_frame_; size_t num_sent_frames_; - bool needs_begin_frame_; + bool needs_begin_impl_frame_; bool forced_draw_to_software_device_; bool has_external_stencil_test_; TransferableResourceArray resources_held_by_parent_; diff --git a/cc/test/fake_output_surface_client.cc b/cc/test/fake_output_surface_client.cc index 2ce6cf0..8417974 100644 --- a/cc/test/fake_output_surface_client.cc +++ b/cc/test/fake_output_surface_client.cc @@ -12,8 +12,8 @@ bool FakeOutputSurfaceClient::DeferredInitialize( return deferred_initialize_result_; } -void FakeOutputSurfaceClient::BeginFrame(const BeginFrameArgs& args) { - begin_frame_count_++; +void FakeOutputSurfaceClient::BeginImplFrame(const BeginFrameArgs& args) { + begin_impl_frame_count_++; } void FakeOutputSurfaceClient::DidLoseOutputSurface() { diff --git a/cc/test/fake_output_surface_client.h b/cc/test/fake_output_surface_client.h index 08511ad..bf127d1 100644 --- a/cc/test/fake_output_surface_client.h +++ b/cc/test/fake_output_surface_client.h @@ -13,7 +13,7 @@ namespace cc { class FakeOutputSurfaceClient : public OutputSurfaceClient { public: FakeOutputSurfaceClient() - : begin_frame_count_(0), + : begin_impl_frame_count_(0), deferred_initialize_result_(true), deferred_initialize_called_(false), did_lose_output_surface_called_(false), @@ -24,7 +24,7 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; virtual void ReleaseGL() OVERRIDE {} virtual void SetNeedsRedrawRect(gfx::Rect damage_rect) OVERRIDE {} - virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; + virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE; virtual void OnSwapBuffersComplete() OVERRIDE {} virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE {} virtual void DidLoseOutputSurface() OVERRIDE; @@ -37,8 +37,8 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { virtual void SetDiscardBackBufferWhenNotVisible(bool discard) OVERRIDE; virtual void SetTreeActivationCallback(const base::Closure&) OVERRIDE {} - int begin_frame_count() { - return begin_frame_count_; + int begin_impl_frame_count() { + return begin_impl_frame_count_; } void set_deferred_initialize_result(bool result) { @@ -60,7 +60,7 @@ class FakeOutputSurfaceClient : public OutputSurfaceClient { } private: - int begin_frame_count_; + int begin_impl_frame_count_; bool deferred_initialize_result_; bool deferred_initialize_called_; bool did_lose_output_surface_called_; diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index f5d7cf3a..d80c845 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -74,9 +74,9 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { block_notify_ready_to_activate_for_testing_(false), notify_ready_to_activate_was_blocked_(false) {} - virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE { + virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE { test_hooks_->WillBeginImplFrameOnThread(this, args); - LayerTreeHostImpl::BeginFrame(args); + LayerTreeHostImpl::BeginImplFrame(args); test_hooks_->DidBeginImplFrameOnThread(this, args); } @@ -251,9 +251,13 @@ class LayerTreeHostClientForTesting : public LayerTreeHostClient { } virtual ~LayerTreeHostClientForTesting() {} - virtual void WillBeginFrame() OVERRIDE { test_hooks_->WillBeginFrame(); } + virtual void WillBeginMainFrame() OVERRIDE { + test_hooks_->WillBeginMainFrame(); + } - virtual void DidBeginFrame() OVERRIDE { test_hooks_->DidBeginFrame(); } + virtual void DidBeginMainFrame() OVERRIDE { + test_hooks_->DidBeginMainFrame(); + } virtual void Animate(double monotonic_time) OVERRIDE { test_hooks_->Animate(base::TimeTicks::FromInternalValue( @@ -603,7 +607,7 @@ void LayerTreeTest::RunTest(bool threaded, delegating_renderer_ = delegating_renderer; - // Spend less time waiting for BeginFrame because the output is + // Spend less time waiting for BeginImplFrame because the output is // mocked out. settings_.refresh_rate = 200.0; if (impl_side_painting) { diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index 4fb5525..aa55837 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h @@ -57,8 +57,8 @@ class TestHooks : public AnimationDelegate { virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale) {} virtual void Animate(base::TimeTicks monotonic_time) {} - virtual void WillBeginFrame() {} - virtual void DidBeginFrame() {} + virtual void WillBeginMainFrame() {} + virtual void DidBeginMainFrame() {} virtual void Layout() {} virtual void DidInitializeOutputSurface(bool succeeded) {} virtual void DidFailToInitializeOutputSurface() {} diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc index 55ff562..8504c28 100644 --- a/cc/test/pixel_test.cc +++ b/cc/test/pixel_test.cc @@ -49,7 +49,7 @@ class PixelTest::PixelTestRendererClient } virtual void ReleaseGL() OVERRIDE {} virtual void SetNeedsRedrawRect(gfx::Rect damage_rect) OVERRIDE {} - virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE {} + virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE {} virtual void OnSwapBuffersComplete() OVERRIDE {} virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE {} virtual void DidLoseOutputSurface() OVERRIDE {} diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index cc92fe3..dae845c 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -261,8 +261,8 @@ void LayerTreeHost::AcquireLayerTextures() { proxy_->AcquireLayerTextures(); } -void LayerTreeHost::DidBeginFrame() { - client_->DidBeginFrame(); +void LayerTreeHost::DidBeginMainFrame() { + client_->DidBeginMainFrame(); } void LayerTreeHost::UpdateClientAnimations(base::TimeTicks frame_begin_time) { diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index a042ee1..90c8c25 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h @@ -143,8 +143,8 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { } // LayerTreeHost interface to Proxy. - void WillBeginFrame() { client_->WillBeginFrame(); } - void DidBeginFrame(); + void WillBeginMainFrame() { client_->WillBeginMainFrame(); } + void DidBeginMainFrame(); void UpdateClientAnimations(base::TimeTicks monotonic_frame_begin_time); void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); void DidStopFlinging(); diff --git a/cc/trees/layer_tree_host_client.h b/cc/trees/layer_tree_host_client.h index 648ee85..bde12da 100644 --- a/cc/trees/layer_tree_host_client.h +++ b/cc/trees/layer_tree_host_client.h @@ -19,10 +19,10 @@ class OutputSurface; class LayerTreeHostClient { public: - virtual void WillBeginFrame() = 0; + virtual void WillBeginMainFrame() = 0; // Marks finishing compositing-related tasks on the main thread. In threaded // mode, this corresponds to DidCommit(). - virtual void DidBeginFrame() = 0; + virtual void DidBeginMainFrame() = 0; virtual void Animate(double frame_begin_time) = 0; virtual void Layout() = 0; virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 3b3746f1..d8b021a 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -280,7 +280,7 @@ void LayerTreeHostImpl::CommitComplete() { // Impl-side painting needs an update immediately post-commit to have the // opportunity to create tilings. Other paths can call UpdateDrawProperties // more lazily when needed prior to drawing. - pending_tree()->ApplyScrollDeltasSinceBeginFrame(); + pending_tree()->ApplyScrollDeltasSinceBeginMainFrame(); pending_tree_->set_needs_update_draw_properties(); pending_tree_->UpdateDrawProperties(); // Start working on newly created tiles immediately if needed. @@ -1208,8 +1208,8 @@ void LayerTreeHostImpl::SetNeedsRedrawRect(gfx::Rect damage_rect) { client_->SetNeedsRedrawRectOnImplThread(damage_rect); } -void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { - client_->BeginFrameOnImplThread(args); +void LayerTreeHostImpl::BeginImplFrame(const BeginFrameArgs& args) { + client_->BeginImplFrame(args); } void LayerTreeHostImpl::OnSwapBuffersComplete() { @@ -1396,9 +1396,9 @@ bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) { return true; } -void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { +void LayerTreeHostImpl::SetNeedsBeginImplFrame(bool enable) { if (output_surface_) - output_surface_->SetNeedsBeginFrame(enable); + output_surface_->SetNeedsBeginImplFrame(enable); } gfx::SizeF LayerTreeHostImpl::UnscaledScrollableViewportSize() const { @@ -1707,14 +1707,14 @@ bool LayerTreeHostImpl::InitializeRenderer( GetRendererCapabilities().using_map_image); } - // Setup BeginFrameEmulation if it's not supported natively - if (!settings_.begin_frame_scheduling_enabled) { + // Setup BeginImplFrameEmulation if it's not supported natively + if (!settings_.begin_impl_frame_scheduling_enabled) { const base::TimeDelta display_refresh_interval = base::TimeDelta::FromMicroseconds( base::Time::kMicrosecondsPerSecond / settings_.refresh_rate); - output_surface->InitializeBeginFrameEmulation( + output_surface->InitializeBeginImplFrameEmulation( proxy_->ImplThreadTaskRunner(), settings_.throttle_frame_production, display_refresh_interval); diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index a2991f2..eda2f25 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -59,7 +59,7 @@ class LayerTreeHostImplClient { public: virtual void DidLoseOutputSurfaceOnImplThread() = 0; virtual void OnSwapBuffersCompleteOnImplThread() = 0; - virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) = 0; + virtual void BeginImplFrame(const BeginFrameArgs& args) = 0; virtual void OnCanDrawStateChanged(bool can_draw) = 0; virtual void NotifyReadyToActivate() = 0; virtual void SetNeedsRedrawOnImplThread() = 0; @@ -221,7 +221,7 @@ class CC_EXPORT LayerTreeHostImpl scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; virtual void ReleaseGL() OVERRIDE; virtual void SetNeedsRedrawRect(gfx::Rect rect) OVERRIDE; - virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; + virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE; virtual void SetExternalDrawConstraints( const gfx::Transform& transform, gfx::Rect viewport, @@ -260,7 +260,7 @@ class CC_EXPORT LayerTreeHostImpl const RendererCapabilities& GetRendererCapabilities() const; virtual bool SwapBuffers(const FrameData& frame); - void SetNeedsBeginFrame(bool enable); + void SetNeedsBeginImplFrame(bool enable); void DidModifyTilePriorities(); void Readback(void* pixels, gfx::Rect rect_in_device_viewport); diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index dd76c06..d38f65e 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -104,8 +104,7 @@ class LayerTreeHostImplTest : public testing::Test, did_lose_output_surface_ = true; } virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} - virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) - OVERRIDE {} + virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE {} virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE { on_can_draw_state_changed_called_ = true; } diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 1029b2e..2331427 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -2482,15 +2482,16 @@ class LayerTreeHostTestLCDNotification : public LayerTreeHostTest { SINGLE_THREAD_TEST_F(LayerTreeHostTestLCDNotification); -// Verify that the BeginFrame notification is used to initiate rendering. -class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest { +// Verify that the BeginImplFrame notification is used to initiate rendering. +class LayerTreeHostTestBeginImplFrameNotification : public LayerTreeHostTest { public: virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { - settings->begin_frame_scheduling_enabled = true; + settings->begin_impl_frame_scheduling_enabled = true; } virtual void BeginTest() OVERRIDE { - // This will trigger a SetNeedsBeginFrame which will trigger a BeginFrame. + // This will trigger a SetNeedsBeginImplFrame which will trigger a + // BeginImplFrame. PostSetNeedsCommitToMainThread(); } @@ -2508,24 +2509,24 @@ class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest { base::TimeTicks frame_time_; }; -MULTI_THREAD_TEST_F(LayerTreeHostTestBeginFrameNotification); +MULTI_THREAD_TEST_F(LayerTreeHostTestBeginImplFrameNotification); -class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled +class LayerTreeHostTestBeginImplFrameNotificationShutdownWhileEnabled : public LayerTreeHostTest { public: virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { - settings->begin_frame_scheduling_enabled = true; + settings->begin_impl_frame_scheduling_enabled = true; settings->using_synchronous_renderer_compositor = true; } virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { - // The BeginFrame notification is turned off now but will get enabled + // The BeginImplFrame notification is turned off now but will get enabled // once we return. End test while it's enabled. ImplThreadTaskRunner()->PostTask( FROM_HERE, - base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, + base::Bind(&LayerTreeHostTestBeginImplFrameNotification::EndTest, base::Unretained(this))); } @@ -2533,7 +2534,7 @@ class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled }; MULTI_THREAD_TEST_F( - LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); + LayerTreeHostTestBeginImplFrameNotificationShutdownWhileEnabled); class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { protected: @@ -2541,7 +2542,7 @@ class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { : commit_count_(0), commit_complete_count_(0) {} virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { - settings->begin_frame_scheduling_enabled = true; + settings->begin_impl_frame_scheduling_enabled = true; } virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } @@ -4709,7 +4710,7 @@ MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport); class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest { public: LayerTreeHostTestAbortEvictedTextures() - : num_will_begin_frames_(0), num_impl_commits_(0) {} + : num_will_begin_main_frames_(0), num_impl_commits_(0) {} protected: virtual void SetupTree() OVERRIDE { @@ -4723,9 +4724,9 @@ class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest { virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } - virtual void WillBeginFrame() OVERRIDE { - num_will_begin_frames_++; - switch (num_will_begin_frames_) { + virtual void WillBeginMainFrame() OVERRIDE { + num_will_begin_main_frames_++; + switch (num_will_begin_main_frames_) { case 2: // Send a redraw to the compositor thread. This will (wrongly) be // ignored unless aborting resets the texture state. @@ -4755,12 +4756,12 @@ class LayerTreeHostTestAbortEvictedTextures : public LayerTreeHostTest { virtual void AfterTest() OVERRIDE { // Ensure that the commit was truly aborted. - EXPECT_EQ(2, num_will_begin_frames_); + EXPECT_EQ(2, num_will_begin_main_frames_); EXPECT_EQ(1, num_impl_commits_); } private: - int num_will_begin_frames_; + int num_will_begin_main_frames_; int num_impl_commits_; }; diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index 88630be..1142622 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc @@ -172,8 +172,8 @@ class LayerTreeHostScrollTestScrollAbortedCommit impl_scroll_(-3, 2), second_main_scroll_(14, -3), impl_scale_(2.f), - num_will_begin_frames_(0), - num_did_begin_frames_(0), + num_will_begin_main_frames_(0), + num_did_begin_main_frames_(0), num_will_commits_(0), num_did_commits_(0), num_impl_commits_(0), @@ -194,10 +194,10 @@ class LayerTreeHostScrollTestScrollAbortedCommit layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.01f, 100.f); } - virtual void WillBeginFrame() OVERRIDE { - num_will_begin_frames_++; + virtual void WillBeginMainFrame() OVERRIDE { + num_will_begin_main_frames_++; Layer* root_scroll_layer = layer_tree_host()->root_layer()->children()[0]; - switch (num_will_begin_frames_) { + switch (num_will_begin_main_frames_) { case 1: // This will not be aborted because of the initial prop changes. EXPECT_EQ(0, num_impl_scrolls_); @@ -239,7 +239,7 @@ class LayerTreeHostScrollTestScrollAbortedCommit } } - virtual void DidBeginFrame() OVERRIDE { num_did_begin_frames_++; } + virtual void DidBeginMainFrame() OVERRIDE { num_did_begin_main_frames_++; } virtual void WillCommit() OVERRIDE { num_will_commits_++; } @@ -317,8 +317,8 @@ class LayerTreeHostScrollTestScrollAbortedCommit virtual void AfterTest() OVERRIDE { EXPECT_EQ(3, num_impl_scrolls_); // Verify that the embedder sees aborted commits as real commits. - EXPECT_EQ(4, num_will_begin_frames_); - EXPECT_EQ(4, num_did_begin_frames_); + EXPECT_EQ(4, num_will_begin_main_frames_); + EXPECT_EQ(4, num_did_begin_main_frames_); EXPECT_EQ(4, num_will_commits_); EXPECT_EQ(4, num_did_commits_); // ...but the compositor thread only sees two real ones. @@ -330,8 +330,8 @@ class LayerTreeHostScrollTestScrollAbortedCommit gfx::Vector2d impl_scroll_; gfx::Vector2d second_main_scroll_; float impl_scale_; - int num_will_begin_frames_; - int num_did_begin_frames_; + int num_will_begin_main_frames_; + int num_did_begin_main_frames_; int num_will_commits_; int num_did_commits_; int num_impl_commits_; diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 3e3d64c..5220312 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -271,17 +271,17 @@ void LayerTreeImpl::ApplySentScrollAndScaleDeltasFromAbortedCommit() { root_layer(), base::Bind(&ApplySentScrollDeltasFromAbortedCommitTo)); } -static void ApplyScrollDeltasSinceBeginFrameTo(LayerImpl* layer) { - layer->ApplyScrollDeltasSinceBeginFrame(); +static void ApplyScrollDeltasSinceBeginMainFrameTo(LayerImpl* layer) { + layer->ApplyScrollDeltasSinceBeginMainFrame(); } -void LayerTreeImpl::ApplyScrollDeltasSinceBeginFrame() { +void LayerTreeImpl::ApplyScrollDeltasSinceBeginMainFrame() { DCHECK(IsPendingTree()); if (!root_layer()) return; LayerTreeHostCommon::CallFunctionForSubtree( - root_layer(), base::Bind(&ApplyScrollDeltasSinceBeginFrameTo)); + root_layer(), base::Bind(&ApplyScrollDeltasSinceBeginMainFrameTo)); } void LayerTreeImpl::SetViewportLayersFromIds( diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index faf360f..76e6d53 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h @@ -123,7 +123,7 @@ class CC_EXPORT LayerTreeImpl { int outer_viewport_scroll_layer_id); void ClearViewportLayers(); void ApplySentScrollAndScaleDeltasFromAbortedCommit(); - void ApplyScrollDeltasSinceBeginFrame(); + void ApplyScrollDeltasSinceBeginMainFrame(); SkColor background_color() const { return background_color_; } void set_background_color(SkColor color) { background_color_ = color; } diff --git a/cc/trees/layer_tree_settings.cc b/cc/trees/layer_tree_settings.cc index b7aafbb..b089a09 100644 --- a/cc/trees/layer_tree_settings.cc +++ b/cc/trees/layer_tree_settings.cc @@ -16,7 +16,7 @@ LayerTreeSettings::LayerTreeSettings() : impl_side_painting(false), allow_antialiasing(true), throttle_frame_production(true), - begin_frame_scheduling_enabled(false), + begin_impl_frame_scheduling_enabled(false), deadline_scheduling_enabled(false), using_synchronous_renderer_compositor(false), per_tile_painting_enabled(false), diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h index ca063b8..fafeb4d 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h @@ -21,7 +21,7 @@ class CC_EXPORT LayerTreeSettings { bool impl_side_painting; bool allow_antialiasing; bool throttle_frame_production; - bool begin_frame_scheduling_enabled; + bool begin_impl_frame_scheduling_enabled; bool deadline_scheduling_enabled; bool using_synchronous_renderer_compositor; bool per_tile_painting_enabled; diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index 634c3bc..1c58086 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc @@ -455,7 +455,7 @@ bool SingleThreadProxy::CommitAndComposite( device_viewport_damage_rect, for_readback, frame); - layer_tree_host_->DidBeginFrame(); + layer_tree_host_->DidBeginMainFrame(); return result; } diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h index 474fb1f..14960b7 100644 --- a/cc/trees/single_thread_proxy.h +++ b/cc/trees/single_thread_proxy.h @@ -51,7 +51,7 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { // LayerTreeHostImplClient implementation virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE {} - virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) + virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE {} virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; virtual void NotifyReadyToActivate() OVERRIDE; diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index 2cec72b..b54078e 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -72,7 +72,7 @@ ThreadProxy::ThreadProxy( manage_tiles_pending_(false), commit_waits_for_activation_(false), inside_commit_(false), - begin_frame_sent_to_main_thread_completion_event_on_impl_thread_(NULL), + begin_main_frame_sent_completion_event_on_impl_thread_(NULL), readback_request_on_impl_thread_(NULL), commit_completion_event_on_impl_thread_(NULL), completion_event_for_commit_held_on_tree_activation_(NULL), @@ -80,8 +80,8 @@ ThreadProxy::ThreadProxy( next_frame_is_newly_committed_frame_on_impl_thread_(false), throttle_frame_production_( layer_tree_host->settings().throttle_frame_production), - begin_frame_scheduling_enabled_( - layer_tree_host->settings().begin_frame_scheduling_enabled), + begin_impl_frame_scheduling_enabled_( + layer_tree_host->settings().begin_impl_frame_scheduling_enabled), using_synchronous_renderer_compositor_( layer_tree_host->settings().using_synchronous_renderer_compositor), inside_draw_(false), @@ -90,7 +90,7 @@ ThreadProxy::ThreadProxy( input_throttled_until_commit_(false), renew_tree_priority_on_impl_thread_pending_(false), draw_duration_history_(kDurationHistorySize), - begin_frame_to_commit_duration_history_(kDurationHistorySize), + begin_main_frame_to_commit_duration_history_(kDurationHistorySize), commit_to_activate_duration_history_(kDurationHistorySize), weak_factory_on_impl_thread_(this), weak_factory_(this) { @@ -126,22 +126,22 @@ bool ThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { request.pixels = pixels; { DebugScopedSetMainThreadBlocked main_thread_blocked(this); - CompletionEvent begin_frame_sent_to_main_thread_completion; + CompletionEvent begin_main_frame_sent_completion; Proxy::ImplThreadTaskRunner() ->PostTask(FROM_HERE, base::Bind(&ThreadProxy::ForceCommitForReadbackOnImplThread, impl_thread_weak_ptr_, - &begin_frame_sent_to_main_thread_completion, + &begin_main_frame_sent_completion, &request)); - begin_frame_sent_to_main_thread_completion.Wait(); + begin_main_frame_sent_completion.Wait(); } in_composite_and_readback_ = true; // This is the forced commit. - // Note: The Impl thread also queues a separate BeginFrameOnMainThread on the + // Note: The Impl thread also queues a separate BeginMainFrame on the // main thread, which will be called after this CompositeAndReadback // completes, to replace the forced commit. - BeginFrameOnMainThread(scoped_ptr<BeginFrameAndCommitState>()); + BeginMainFrame(scoped_ptr<BeginMainFrameAndCommitState>()); in_composite_and_readback_ = false; // Composite and readback requires a second commit to undo any changes @@ -153,15 +153,15 @@ bool ThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { } void ThreadProxy::ForceCommitForReadbackOnImplThread( - CompletionEvent* begin_frame_sent_completion, + CompletionEvent* begin_main_frame_sent_completion, ReadbackRequest* request) { TRACE_EVENT0("cc", "ThreadProxy::ForceCommitForReadbackOnImplThread"); DCHECK(IsImplThread()); - DCHECK(!begin_frame_sent_to_main_thread_completion_event_on_impl_thread_); + DCHECK(!begin_main_frame_sent_completion_event_on_impl_thread_); DCHECK(!readback_request_on_impl_thread_); if (!layer_tree_host_impl_) { - begin_frame_sent_completion->Signal(); + begin_main_frame_sent_completion->Signal(); request->success = false; request->completion.Signal(); return; @@ -171,12 +171,12 @@ void ThreadProxy::ForceCommitForReadbackOnImplThread( scheduler_on_impl_thread_->SetNeedsForcedCommitForReadback(); if (scheduler_on_impl_thread_->CommitPending()) { - begin_frame_sent_completion->Signal(); + begin_main_frame_sent_completion->Signal(); return; } - begin_frame_sent_to_main_thread_completion_event_on_impl_thread_ = - begin_frame_sent_completion; + begin_main_frame_sent_completion_event_on_impl_thread_ = + begin_main_frame_sent_completion; } void ThreadProxy::FinishAllRendering() { @@ -387,13 +387,13 @@ void ThreadProxy::SetNeedsBeginImplFrame(bool enable) { DCHECK(IsImplThread()); TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginImplFrame", "enable", enable); - layer_tree_host_impl_->SetNeedsBeginFrame(enable); + layer_tree_host_impl_->SetNeedsBeginImplFrame(enable); UpdateBackgroundAnimateTicking(); } -void ThreadProxy::BeginFrameOnImplThread(const BeginFrameArgs& args) { +void ThreadProxy::BeginImplFrame(const BeginFrameArgs& args) { DCHECK(IsImplThread()); - TRACE_EVENT0("cc", "ThreadProxy::BeginFrameOnImplThread"); + TRACE_EVENT0("cc", "ThreadProxy::BeginImplFrame"); // Sample the frame time now. This time will be used for updating animations // when we draw. @@ -521,7 +521,7 @@ void ThreadProxy::SetDeferCommits(bool defer_commits) { if (!defer_commits_ && pending_deferred_commit_) Proxy::MainThreadTaskRunner()->PostTask( FROM_HERE, - base::Bind(&ThreadProxy::BeginFrameOnMainThread, + base::Bind(&ThreadProxy::BeginMainFrame, main_thread_weak_ptr_, base::Passed(&pending_deferred_commit_))); } @@ -685,52 +685,52 @@ void ThreadProxy::FinishAllRenderingOnImplThread(CompletionEvent* completion) { void ThreadProxy::ScheduledActionSendBeginMainFrame() { TRACE_EVENT0("cc", "ThreadProxy::ScheduledActionSendBeginMainFrame"); - scoped_ptr<BeginFrameAndCommitState> begin_frame_state( - new BeginFrameAndCommitState); - begin_frame_state->monotonic_frame_begin_time = + scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state( + new BeginMainFrameAndCommitState); + begin_main_frame_state->monotonic_frame_begin_time = layer_tree_host_impl_->CurrentPhysicalTimeTicks(); - begin_frame_state->scroll_info = + begin_main_frame_state->scroll_info = layer_tree_host_impl_->ProcessScrollDeltas(); if (!layer_tree_host_impl_->settings().impl_side_painting) { DCHECK_GT(layer_tree_host_impl_->memory_allocation_limit_bytes(), 0u); } - begin_frame_state->memory_allocation_limit_bytes = + begin_main_frame_state->memory_allocation_limit_bytes = layer_tree_host_impl_->memory_allocation_limit_bytes(); - begin_frame_state->memory_allocation_priority_cutoff = + begin_main_frame_state->memory_allocation_priority_cutoff = layer_tree_host_impl_->memory_allocation_priority_cutoff(); - begin_frame_state->evicted_ui_resources = + begin_main_frame_state->evicted_ui_resources = layer_tree_host_impl_->EvictedUIResourcesExist(); Proxy::MainThreadTaskRunner()->PostTask( FROM_HERE, - base::Bind(&ThreadProxy::BeginFrameOnMainThread, + base::Bind(&ThreadProxy::BeginMainFrame, main_thread_weak_ptr_, - base::Passed(&begin_frame_state))); + base::Passed(&begin_main_frame_state))); - if (begin_frame_sent_to_main_thread_completion_event_on_impl_thread_) { - begin_frame_sent_to_main_thread_completion_event_on_impl_thread_->Signal(); - begin_frame_sent_to_main_thread_completion_event_on_impl_thread_ = NULL; + if (begin_main_frame_sent_completion_event_on_impl_thread_) { + begin_main_frame_sent_completion_event_on_impl_thread_->Signal(); + begin_main_frame_sent_completion_event_on_impl_thread_ = NULL; } - begin_frame_sent_to_main_thread_time_ = base::TimeTicks::HighResNow(); + begin_main_frame_sent_time_ = base::TimeTicks::HighResNow(); } -void ThreadProxy::BeginFrameOnMainThread( - scoped_ptr<BeginFrameAndCommitState> begin_frame_state) { - TRACE_EVENT0("cc", "ThreadProxy::BeginFrameOnMainThread"); +void ThreadProxy::BeginMainFrame( + scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { + TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame"); DCHECK(IsMainThread()); if (!layer_tree_host_) return; if (defer_commits_) { - pending_deferred_commit_ = begin_frame_state.Pass(); + pending_deferred_commit_ = begin_main_frame_state.Pass(); layer_tree_host_->DidDeferCommit(); TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); return; } // Do not notify the impl thread of commit requests that occur during - // the apply/animate/layout part of the BeginFrameAndCommit process since + // the apply/animate/layout part of the BeginMainFrameAndCommit process since // those commit requests will get painted immediately. Once we have done // the paint, commit_requested_ will be set to false to allow new commit // requests to be scheduled. @@ -750,22 +750,22 @@ void ThreadProxy::BeginFrameOnMainThread( bool did_handle = false; Proxy::ImplThreadTaskRunner()->PostTask( FROM_HERE, - base::Bind(&ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread, + base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread, impl_thread_weak_ptr_, did_handle)); return; } - if (begin_frame_state) - layer_tree_host_->ApplyScrollAndScale(*begin_frame_state->scroll_info); + if (begin_main_frame_state) + layer_tree_host_->ApplyScrollAndScale(*begin_main_frame_state->scroll_info); - layer_tree_host_->WillBeginFrame(); + layer_tree_host_->WillBeginMainFrame(); - if (begin_frame_state) { + if (begin_main_frame_state) { layer_tree_host_->UpdateClientAnimations( - begin_frame_state->monotonic_frame_begin_time); + begin_main_frame_state->monotonic_frame_begin_time); layer_tree_host_->AnimateLayers( - begin_frame_state->monotonic_frame_begin_time); + begin_main_frame_state->monotonic_frame_begin_time); } // Unlink any backings that the impl thread has evicted, so that we know to @@ -774,18 +774,19 @@ void ThreadProxy::BeginFrameOnMainThread( layer_tree_host_->contents_texture_manager()-> UnlinkAndClearEvictedBackings(); - if (begin_frame_state) { + if (begin_main_frame_state) { layer_tree_host_->contents_texture_manager()->SetMaxMemoryLimitBytes( - begin_frame_state->memory_allocation_limit_bytes); + begin_main_frame_state->memory_allocation_limit_bytes); layer_tree_host_->contents_texture_manager()->SetExternalPriorityCutoff( - begin_frame_state->memory_allocation_priority_cutoff); + begin_main_frame_state->memory_allocation_priority_cutoff); } } // Recreate all UI resources if there were evicted UI resources when the impl // thread initiated the commit. - bool evicted_ui_resources = - begin_frame_state ? begin_frame_state->evicted_ui_resources : false; + bool evicted_ui_resources = begin_main_frame_state + ? begin_main_frame_state->evicted_ui_resources + : false; if (evicted_ui_resources) layer_tree_host_->RecreateUIResources(); @@ -818,7 +819,7 @@ void ThreadProxy::BeginFrameOnMainThread( bool did_handle = true; Proxy::ImplThreadTaskRunner()->PostTask( FROM_HERE, - base::Bind(&ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread, + base::Bind(&ThreadProxy::BeginMainFrameAbortedOnImplThread, impl_thread_weak_ptr_, did_handle)); @@ -826,7 +827,7 @@ void ThreadProxy::BeginFrameOnMainThread( // detected to be a no-op. From the perspective of an embedder, this commit // went through, and input should no longer be throttled, etc. layer_tree_host_->CommitComplete(); - layer_tree_host_->DidBeginFrame(); + layer_tree_host_->DidBeginMainFrame(); return; } @@ -854,7 +855,7 @@ void ThreadProxy::BeginFrameOnMainThread( // point of view, but asynchronously performed on the impl thread, // coordinated by the Scheduler. { - TRACE_EVENT0("cc", "ThreadProxy::BeginFrameOnMainThread::commit"); + TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrame::commit"); DebugScopedSetMainThreadBlocked main_thread_blocked(this); @@ -881,7 +882,7 @@ void ThreadProxy::BeginFrameOnMainThread( } layer_tree_host_->CommitComplete(); - layer_tree_host_->DidBeginFrame(); + layer_tree_host_->DidBeginMainFrame(); } void ThreadProxy::StartCommitOnImplThread( @@ -933,8 +934,8 @@ void ThreadProxy::StartCommitOnImplThread( scheduler_on_impl_thread_->AnticipatedDrawTime()); } -void ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread(bool did_handle) { - TRACE_EVENT0("cc", "ThreadProxy::BeginFrameAbortedByMainThreadOnImplThread"); +void ThreadProxy::BeginMainFrameAbortedOnImplThread(bool did_handle) { + TRACE_EVENT0("cc", "ThreadProxy::BeginMainFrameAbortedOnImplThread"); DCHECK(IsImplThread()); DCHECK(scheduler_on_impl_thread_); DCHECK(scheduler_on_impl_thread_->CommitPending()); @@ -992,8 +993,8 @@ void ThreadProxy::ScheduledActionCommit() { commit_waits_for_activation_ = false; commit_complete_time_ = base::TimeTicks::HighResNow(); - begin_frame_to_commit_duration_history_.InsertSample( - commit_complete_time_ - begin_frame_sent_to_main_thread_time_); + begin_main_frame_to_commit_duration_history_.InsertSample( + commit_complete_time_ - begin_main_frame_sent_time_); // SetVisible kicks off the next scheduler action, so this must be last. scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); @@ -1243,7 +1244,7 @@ base::TimeDelta ThreadProxy::DrawDurationEstimate() { } base::TimeDelta ThreadProxy::BeginMainFrameToCommitDurationEstimate() { - return begin_frame_to_commit_duration_history_.Percentile( + return begin_main_frame_to_commit_duration_history_.Percentile( kCommitAndActivationDurationEstimationPercentile); } @@ -1398,7 +1399,7 @@ void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { layer_tree_host_->DeleteContentsTexturesOnImplThread( layer_tree_host_impl_->resource_provider()); current_resource_update_controller_on_impl_thread_.reset(); - layer_tree_host_impl_->SetNeedsBeginFrame(false); + layer_tree_host_impl_->SetNeedsBeginImplFrame(false); scheduler_on_impl_thread_.reset(); layer_tree_host_impl_.reset(); weak_factory_on_impl_thread_.InvalidateWeakPtrs(); @@ -1409,12 +1410,12 @@ size_t ThreadProxy::MaxPartialTextureUpdates() const { return ResourceUpdateController::MaxPartialTextureUpdates(); } -ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState() +ThreadProxy::BeginMainFrameAndCommitState::BeginMainFrameAndCommitState() : memory_allocation_limit_bytes(0), memory_allocation_priority_cutoff(0), evicted_ui_resources(false) {} -ThreadProxy::BeginFrameAndCommitState::~BeginFrameAndCommitState() {} +ThreadProxy::BeginMainFrameAndCommitState::~BeginMainFrameAndCommitState() {} scoped_ptr<base::Value> ThreadProxy::AsValue() const { scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); diff --git a/cc/trees/thread_proxy.h b/cc/trees/thread_proxy.h index 6badb03..2a48e94 100644 --- a/cc/trees/thread_proxy.h +++ b/cc/trees/thread_proxy.h @@ -69,7 +69,7 @@ class ThreadProxy : public Proxy, // LayerTreeHostImplClient implementation virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; - virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) OVERRIDE; + virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE; virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; virtual void NotifyReadyToActivate() OVERRIDE; virtual void SetNeedsRedrawOnImplThread() OVERRIDE; @@ -119,9 +119,9 @@ class ThreadProxy : public Proxy, ThreadProxy(LayerTreeHost* layer_tree_host, scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); - struct BeginFrameAndCommitState { - BeginFrameAndCommitState(); - ~BeginFrameAndCommitState(); + struct BeginMainFrameAndCommitState { + BeginMainFrameAndCommitState(); + ~BeginMainFrameAndCommitState(); base::TimeTicks monotonic_frame_begin_time; scoped_ptr<ScrollAndScaleSet> scroll_info; @@ -131,8 +131,8 @@ class ThreadProxy : public Proxy, }; // Called on main thread. - void BeginFrameOnMainThread( - scoped_ptr<BeginFrameAndCommitState> begin_frame_state); + void BeginMainFrame( + scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state); void DidCommitAndDrawFrame(); void DidCompleteSwapBuffers(); void SetAnimationEvents(scoped_ptr<AnimationEventsVector> queue, @@ -150,13 +150,13 @@ class ThreadProxy : public Proxy, struct SchedulerStateRequest; void ForceCommitForReadbackOnImplThread( - CompletionEvent* begin_frame_sent_completion, + CompletionEvent* begin_main_frame_sent_completion, ReadbackRequest* request); void StartCommitOnImplThread( CompletionEvent* completion, ResourceUpdateQueue* queue, scoped_refptr<cc::ContextProvider> offscreen_context_provider); - void BeginFrameAbortedByMainThreadOnImplThread(bool did_handle); + void BeginMainFrameAbortedOnImplThread(bool did_handle); void RequestReadbackOnImplThread(ReadbackRequest* request); void FinishAllRenderingOnImplThread(CompletionEvent* completion); void InitializeImplOnImplThread(CompletionEvent* completion); @@ -200,7 +200,7 @@ class ThreadProxy : public Proxy, bool commit_requested_; // Set by SetNeedsCommit and SetNeedsAnimate. bool commit_request_sent_to_impl_thread_; - // Set by BeginFrameOnMainThread + // Set by BeginMainFrame bool created_offscreen_context_provider_; base::CancelableClosure output_surface_creation_callback_; LayerTreeHost* layer_tree_host_; @@ -226,7 +226,7 @@ class ThreadProxy : public Proxy, // Set when the main thread is waiting on a // ScheduledActionSendBeginMainFrame to be issued. CompletionEvent* - begin_frame_sent_to_main_thread_completion_event_on_impl_thread_; + begin_main_frame_sent_completion_event_on_impl_thread_; // Set when the main thread is waiting on a readback. ReadbackRequest* readback_request_on_impl_thread_; @@ -248,7 +248,7 @@ class ThreadProxy : public Proxy, bool next_frame_is_newly_committed_frame_on_impl_thread_; bool throttle_frame_production_; - bool begin_frame_scheduling_enabled_; + bool begin_impl_frame_scheduling_enabled_; bool using_synchronous_renderer_compositor_; bool inside_draw_; @@ -257,19 +257,19 @@ class ThreadProxy : public Proxy, bool defer_commits_; bool input_throttled_until_commit_; - scoped_ptr<BeginFrameAndCommitState> pending_deferred_commit_; + scoped_ptr<BeginMainFrameAndCommitState> pending_deferred_commit_; base::TimeTicks smoothness_takes_priority_expiration_time_; bool renew_tree_priority_on_impl_thread_pending_; RollingTimeDeltaHistory draw_duration_history_; - RollingTimeDeltaHistory begin_frame_to_commit_duration_history_; + RollingTimeDeltaHistory begin_main_frame_to_commit_duration_history_; RollingTimeDeltaHistory commit_to_activate_duration_history_; // Used for computing samples added to - // begin_frame_to_commit_draw_duration_history_ and + // begin_main_frame_to_commit_duration_history_ and // activation_duration_history_. - base::TimeTicks begin_frame_sent_to_main_thread_time_; + base::TimeTicks begin_main_frame_sent_time_; base::TimeTicks commit_complete_time_; base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; |