Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp

Issue 2848553003: Adjust OffscreenCanvas throttling to allow two frames of backlog (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_);

Powered by Google App Engine
This is Rietveld 408576698