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

Unified Diff: cc/trees/single_thread_proxy.cc

Issue 12662021: cc: Don't draw and swap if the frame will not change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/single_thread_proxy.cc
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 07056c4c594ff4e0b337e2cb341e2f9e8d75f0f9..31a7054b65436d5f4be58cc560d48338b846ad6f 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -54,7 +54,12 @@ bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) {
TRACE_EVENT0("cc", "SingleThreadProxy::CompositeAndReadback");
DCHECK(Proxy::IsMainThread());
- if (!CommitAndComposite(base::TimeTicks::Now()))
+ gfx::Rect device_viewport_damage_rect = rect;
+
+ LayerTreeHostImpl::FrameData frame;
+ if (!CommitAndComposite(base::TimeTicks::Now(),
+ device_viewport_damage_rect,
+ &frame))
return false;
{
@@ -64,7 +69,7 @@ bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) {
if (layer_tree_host_impl_->IsContextLost())
return false;
- layer_tree_host_impl_->SwapBuffers();
+ layer_tree_host_impl_->SwapBuffers(frame);
}
DidSwapFrame();
@@ -330,8 +335,13 @@ void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() {
// Called by the legacy scheduling path (e.g. where render_widget does the
// scheduling)
void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) {
- if (CommitAndComposite(frame_begin_time)) {
- layer_tree_host_impl_->SwapBuffers();
+ gfx::Rect device_viewport_damage_rect;
+
+ LayerTreeHostImpl::FrameData frame;
+ if (CommitAndComposite(frame_begin_time,
+ device_viewport_damage_rect,
+ &frame)) {
+ layer_tree_host_impl_->SwapBuffers(frame);
DidSwapFrame();
}
}
@@ -360,7 +370,10 @@ void SingleThreadProxy::ForceSerializeOnSwapBuffers() {
void SingleThreadProxy::OnSwapBuffersCompleteOnImplThread() { NOTREACHED(); }
-bool SingleThreadProxy::CommitAndComposite(base::TimeTicks frame_begin_time) {
+bool SingleThreadProxy::CommitAndComposite(
+ base::TimeTicks frame_begin_time,
+ gfx::Rect device_viewport_damage_rect,
+ LayerTreeHostImpl::FrameData* frame) {
DCHECK(Proxy::IsMainThread());
if (!layer_tree_host_->InitializeRendererIfNeeded())
@@ -384,7 +397,10 @@ bool SingleThreadProxy::CommitAndComposite(base::TimeTicks frame_begin_time) {
layer_tree_host_->WillCommit();
DoCommit(queue.Pass());
- bool result = DoComposite(offscreen_context_provider, frame_begin_time);
+ bool result = DoComposite(offscreen_context_provider,
+ frame_begin_time,
+ device_viewport_damage_rect,
+ frame);
layer_tree_host_->DidBeginFrame();
return result;
}
@@ -397,7 +413,9 @@ bool SingleThreadProxy::ShouldComposite() const {
bool SingleThreadProxy::DoComposite(
scoped_refptr<cc::ContextProvider> offscreen_context_provider,
- base::TimeTicks frame_begin_time) {
+ base::TimeTicks frame_begin_time,
+ gfx::Rect device_viewport_damage_rect,
+ LayerTreeHostImpl::FrameData* frame) {
DCHECK(!output_surface_lost_);
{
DebugScopedSetImplThread impl(this);
@@ -418,10 +436,9 @@ bool SingleThreadProxy::DoComposite(
layer_tree_host_impl_->Animate(base::TimeTicks::Now(), base::Time::Now());
layer_tree_host_impl_->UpdateBackgroundAnimateTicking(false);
- LayerTreeHostImpl::FrameData frame;
- layer_tree_host_impl_->PrepareToDraw(&frame);
- layer_tree_host_impl_->DrawLayers(&frame, frame_begin_time);
- layer_tree_host_impl_->DidDrawAllLayers(frame);
+ layer_tree_host_impl_->PrepareToDraw(frame, device_viewport_damage_rect);
+ layer_tree_host_impl_->DrawLayers(frame, frame_begin_time);
+ layer_tree_host_impl_->DidDrawAllLayers(*frame);
output_surface_lost_ = layer_tree_host_impl_->IsContextLost();
bool start_ready_animations = true;
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698