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

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

Issue 2817603004: Throttle frames in OffscreenCanvasFrameDispatcherImpl (Closed)
Patch Set: Remove obsolete comment 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c4c1429966dd7fb90c0825a49d02a2a6fce45c50..89b5cb6fc5c6162a45557e167789c288ca4083a9 100644
--- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
+++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -399,13 +399,14 @@ void OffscreenCanvasFrameDispatcherImpl::DispatchFrame(
change_size_for_next_commit_ = false;
}
+ compositor_has_pending_frame_ = true;
sink_->SubmitCompositorFrame(current_local_surface_id_, std::move(frame));
}
void OffscreenCanvasFrameDispatcherImpl::DidReceiveCompositorFrameAck(
const cc::ReturnedResourceArray& resources) {
ReclaimResources(resources);
- // TODO(fsamuel): Implement this.
+ compositor_has_pending_frame_ = false;
}
void OffscreenCanvasFrameDispatcherImpl::SetNeedsBeginFrame(
@@ -419,10 +420,19 @@ void OffscreenCanvasFrameDispatcherImpl::SetNeedsBeginFrame(
void OffscreenCanvasFrameDispatcherImpl::OnBeginFrame(
const cc::BeginFrameArgs& begin_frame_args) {
DCHECK(Client());
+
// TODO(eseckler): Set correct |latest_confirmed_sequence_number|.
current_begin_frame_ack_ = cc::BeginFrameAck(
begin_frame_args.source_id, begin_frame_args.sequence_number,
begin_frame_args.sequence_number, false);
+
+ if (compositor_has_pending_frame_ ||
+ (begin_frame_args.type == cc::BeginFrameArgs::MISSED &&
+ base::TimeTicks::Now() > begin_frame_args.deadline)) {
+ sink_->BeginFrameDidNotSwap(current_begin_frame_ack_);
+ return;
+ }
+
Client()->BeginFrame();
// TODO(eseckler): Tell |m_sink| if we did not draw during the BeginFrame.
current_begin_frame_ack_.sequence_number =
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698