Chromium Code Reviews| Index: cc/output/output_surface.cc |
| diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc |
| index 9c52bcb3688da9516756d9ab9bab18e56575898f..3515cf1dd034b1ff492c7126984bd72d8ff9039d 100644 |
| --- a/cc/output/output_surface.cc |
| +++ b/cc/output/output_surface.cc |
| @@ -49,7 +49,6 @@ OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider) |
| max_frames_pending_(0), |
| pending_swap_buffers_(0), |
| needs_begin_impl_frame_(false), |
| - client_ready_for_begin_impl_frame_(true), |
| client_(NULL), |
| check_for_retroactive_begin_impl_frame_pending_(false), |
| external_stencil_test_enabled_(false), |
| @@ -62,7 +61,6 @@ OutputSurface::OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device) |
| max_frames_pending_(0), |
| pending_swap_buffers_(0), |
| needs_begin_impl_frame_(false), |
| - client_ready_for_begin_impl_frame_(true), |
| client_(NULL), |
| check_for_retroactive_begin_impl_frame_pending_(false), |
| external_stencil_test_enabled_(false), |
| @@ -77,14 +75,13 @@ OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider, |
| max_frames_pending_(0), |
| pending_swap_buffers_(0), |
| needs_begin_impl_frame_(false), |
| - client_ready_for_begin_impl_frame_(true), |
| client_(NULL), |
| check_for_retroactive_begin_impl_frame_pending_(false), |
| external_stencil_test_enabled_(false), |
| weak_ptr_factory_(this), |
| gpu_latency_history_(kGpuLatencyHistorySize) {} |
| -void OutputSurface::InitializeBeginImplFrameEmulation( |
| +void OutputSurface::InitializeBeginFrameEmulation( |
| base::SingleThreadTaskRunner* task_runner, |
| bool throttle_frame_production, |
| base::TimeDelta interval) { |
| @@ -135,7 +132,7 @@ void OutputSurface::FrameRateControllerTick(bool throttled, |
| if (throttled) |
| skipped_begin_impl_frame_args_ = args; |
| else |
| - BeginImplFrame(args); |
| + BeginFrame(args); |
| } |
| // Forwarded to OutputSurfaceClient |
| @@ -144,38 +141,36 @@ void OutputSurface::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
| client_->SetNeedsRedrawRect(damage_rect); |
| } |
| -void OutputSurface::SetNeedsBeginImplFrame(bool enable) { |
| - TRACE_EVENT1("cc", "OutputSurface::SetNeedsBeginImplFrame", "enable", enable); |
| +void OutputSurface::SetNeedsBeginFrame(bool enable) { |
| + TRACE_EVENT1("cc", "OutputSurface::SetNeedsBeginFrame", "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_impl_frame_args_ = skipped; |
| } |
| if (needs_begin_impl_frame_) |
| - PostCheckForRetroactiveBeginImplFrame(); |
| + PostCheckForRetroactiveBeginFrame(); |
| } |
| -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_impl_frame_ || !client_ready_for_begin_impl_frame_ || |
| +void OutputSurface::BeginFrame(const BeginFrameArgs& args) { |
| + TRACE_EVENT1("cc", |
| + "OutputSurface::BeginFrame", |
| + "pending_swap_buffers_", |
| + pending_swap_buffers_); |
| + if (!needs_begin_impl_frame_ || |
| (pending_swap_buffers_ >= max_frames_pending_ && |
| max_frames_pending_ > 0)) { |
| skipped_begin_impl_frame_args_ = args; |
| } else { |
| - client_ready_for_begin_impl_frame_ = false; |
| - client_->BeginImplFrame(args); |
| + client_->BeginFrame(args); |
| // args might be an alias for skipped_begin_impl_frame_args_. |
| - // Do not reset it before calling BeginImplFrame! |
| + // Do not reset it before calling BeginFrame! |
| skipped_begin_impl_frame_args_ = BeginFrameArgs(); |
| } |
| } |
| -base::TimeTicks OutputSurface::RetroactiveBeginImplFrameDeadline() { |
| +base::TimeTicks OutputSurface::RetroactiveBeginFrameDeadline() { |
| // TODO(brianderson): Remove the alternative deadline once we have better |
| // deadline estimations. |
| base::TimeTicks alternative_deadline = |
| @@ -185,23 +180,23 @@ base::TimeTicks OutputSurface::RetroactiveBeginImplFrameDeadline() { |
| alternative_deadline); |
| } |
| -void OutputSurface::PostCheckForRetroactiveBeginImplFrame() { |
| +void OutputSurface::PostCheckForRetroactiveBeginFrame() { |
| if (!skipped_begin_impl_frame_args_.IsValid() || |
| check_for_retroactive_begin_impl_frame_pending_) |
|
Sami
2014/04/01 13:09:10
Rename this flag too?
|
| return; |
| base::MessageLoop::current()->PostTask( |
| - FROM_HERE, |
| - base::Bind(&OutputSurface::CheckForRetroactiveBeginImplFrame, |
| - weak_ptr_factory_.GetWeakPtr())); |
| + FROM_HERE, |
| + base::Bind(&OutputSurface::CheckForRetroactiveBeginFrame, |
| + weak_ptr_factory_.GetWeakPtr())); |
| check_for_retroactive_begin_impl_frame_pending_ = true; |
| } |
| -void OutputSurface::CheckForRetroactiveBeginImplFrame() { |
| - TRACE_EVENT0("cc", "OutputSurface::CheckForRetroactiveBeginImplFrame"); |
| +void OutputSurface::CheckForRetroactiveBeginFrame() { |
| + TRACE_EVENT0("cc", "OutputSurface::CheckForRetroactiveBeginFrame"); |
| check_for_retroactive_begin_impl_frame_pending_ = false; |
| - if (gfx::FrameTime::Now() < RetroactiveBeginImplFrameDeadline()) |
| - BeginImplFrame(skipped_begin_impl_frame_args_); |
| + if (gfx::FrameTime::Now() < RetroactiveBeginFrameDeadline()) |
| + BeginFrame(skipped_begin_impl_frame_args_); |
| } |
| void OutputSurface::DidSwapBuffers() { |
| @@ -211,7 +206,7 @@ void OutputSurface::DidSwapBuffers() { |
| client_->DidSwapBuffers(); |
| if (frame_rate_controller_) |
| frame_rate_controller_->DidSwapBuffers(); |
| - PostCheckForRetroactiveBeginImplFrame(); |
| + PostCheckForRetroactiveBeginFrame(); |
| } |
| void OutputSurface::OnSwapBuffersComplete() { |
| @@ -221,7 +216,7 @@ void OutputSurface::OnSwapBuffersComplete() { |
| client_->OnSwapBuffersComplete(); |
| if (frame_rate_controller_) |
| frame_rate_controller_->DidSwapBuffersComplete(); |
| - PostCheckForRetroactiveBeginImplFrame(); |
| + PostCheckForRetroactiveBeginFrame(); |
| } |
| void OutputSurface::ReclaimResources(const CompositorFrameAck* ack) { |
| @@ -230,7 +225,6 @@ void OutputSurface::ReclaimResources(const CompositorFrameAck* ack) { |
| void OutputSurface::DidLoseOutputSurface() { |
| TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); |
| - client_ready_for_begin_impl_frame_ = true; |
| pending_swap_buffers_ = 0; |
| skipped_begin_impl_frame_args_ = BeginFrameArgs(); |
| if (frame_rate_controller_) |