Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp |
| index 0d87eec306c2bc795bf276b483b9ee1c830a56cc..13609128b2ac31c56747a7377ff2041a0a8a42e6 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp |
| @@ -27,6 +27,10 @@ |
| namespace blink { |
| +enum { |
| + kMaxCompositorPendingFrames = 2, |
|
Eric Seckler
2017/04/28 08:19:10
same here?
|
| +}; |
| + |
| OffscreenCanvasFrameDispatcherImpl::OffscreenCanvasFrameDispatcherImpl( |
| OffscreenCanvasFrameDispatcherClient* client, |
| uint32_t client_id, |
| @@ -399,14 +403,15 @@ void OffscreenCanvasFrameDispatcherImpl::DispatchFrame( |
| change_size_for_next_commit_ = false; |
| } |
| - compositor_has_pending_frame_ = true; |
| + compositor_pending_frames_++; |
| sink_->SubmitCompositorFrame(current_local_surface_id_, std::move(frame)); |
| } |
| void OffscreenCanvasFrameDispatcherImpl::DidReceiveCompositorFrameAck( |
| const cc::ReturnedResourceArray& resources) { |
| ReclaimResources(resources); |
| - compositor_has_pending_frame_ = false; |
| + compositor_pending_frames_--; |
| + DCHECK_GE(compositor_pending_frames_, 0); |
| } |
| void OffscreenCanvasFrameDispatcherImpl::SetNeedsBeginFrame( |
| @@ -426,7 +431,7 @@ void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame( |
| begin_frame_args.source_id, begin_frame_args.sequence_number, |
| begin_frame_args.sequence_number, false); |
| - if (compositor_has_pending_frame_ || |
| + if (compositor_pending_frames_ >= kMaxCompositorPendingFrames || |
| (begin_frame_args.type == cc::BeginFrameArgs::MISSED && |
| base::TimeTicks::Now() > begin_frame_args.deadline)) { |
| sink_->BeginFrameDidNotSwap(current_begin_frame_ack_); |