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

Side by Side Diff: cc/trees/layer_tree_host_unittest_delegated.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: Add perf test Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "cc/layers/delegated_renderer_layer.h" 7 #include "cc/layers/delegated_renderer_layer.h"
8 #include "cc/layers/delegated_renderer_layer_impl.h" 8 #include "cc/layers/delegated_renderer_layer_impl.h"
9 #include "cc/output/delegated_frame_data.h" 9 #include "cc/output/delegated_frame_data.h"
10 #include "cc/quads/shared_quad_state.h" 10 #include "cc/quads/shared_quad_state.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 242 }
243 243
244 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 244 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
245 LayerTreeHostImpl::FrameData* frame, 245 LayerTreeHostImpl::FrameData* frame,
246 bool result) OVERRIDE { 246 bool result) OVERRIDE {
247 EXPECT_TRUE(result); 247 EXPECT_TRUE(result);
248 248
249 if (!first_draw_for_source_frame_) 249 if (!first_draw_for_source_frame_)
250 return result; 250 return result;
251 251
252 gfx::RectF damage_rect = frame->render_passes.back()->damage_rect; 252 gfx::RectF damage_rect;
253 if (!frame->has_no_damage) {
254 damage_rect = frame->render_passes.back()->damage_rect;
255 } else {
256 // If there is no damage, then we have no render passes to send.
257 EXPECT_TRUE(frame->render_passes.empty());
258 }
253 259
254 switch (host_impl->active_tree()->source_frame_number()) { 260 switch (host_impl->active_tree()->source_frame_number()) {
255 case 0: 261 case 0:
256 // Before the layer has a frame to display it should not 262 // Before the layer has a frame to display it should not
257 // be visible at all, and not damage anything. 263 // be visible at all, and not damage anything.
258 EXPECT_EQ(gfx::RectF(0.f, 0.f, 0.f, 0.f).ToString(), 264 EXPECT_EQ(gfx::RectF(0.f, 0.f, 0.f, 0.f).ToString(),
259 damage_rect.ToString()); 265 damage_rect.ToString());
260 break; 266 break;
261 case 1: 267 case 1:
262 EXPECT_EQ(gfx::RectF(0.f, 0.f, 10.f, 10.f).ToString(), 268 EXPECT_EQ(gfx::RectF(0.f, 0.f, 10.f, 10.f).ToString(),
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 } 1235 }
1230 } 1236 }
1231 1237
1232 virtual void AfterTest() OVERRIDE {} 1238 virtual void AfterTest() OVERRIDE {}
1233 }; 1239 };
1234 1240
1235 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake) 1241 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostDelegatedTestCommitWithoutTake)
1236 1242
1237 } // namespace 1243 } // namespace
1238 } // namespace cc 1244 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698