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

Side by Side Diff: cc/resources/picture_pile_unittest.cc

Issue 643363002: cc: Make full-pile invalidations cheap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« cc/resources/picture_pile.cc ('K') | « cc/resources/picture_pile.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <map> 5 #include <map>
6 #include <utility> 6 #include <utility>
7 7
8 #include "cc/resources/picture_pile.h" 8 #include "cc/resources/picture_pile.h"
9 #include "cc/test/fake_content_layer_client.h" 9 #include "cc/test/fake_content_layer_client.h"
10 #include "cc/test/fake_rendering_stats_instrumentation.h" 10 #include "cc/test/fake_rendering_stats_instrumentation.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 EXPECT_EQ(gfx::Rect(0, 0, 1, 1).ToString(), invalidation.ToString()); 357 EXPECT_EQ(gfx::Rect(0, 0, 1, 1).ToString(), invalidation.ToString());
358 358
359 // No invalidation, changing viewport. 359 // No invalidation, changing viewport.
360 invalidation = Region(); 360 invalidation = Region();
361 UpdateAndExpandInvalidation( 361 UpdateAndExpandInvalidation(
362 &invalidation, tiling_size(), gfx::Rect(5, 5, 5, 5)); 362 &invalidation, tiling_size(), gfx::Rect(5, 5, 5, 5));
363 EXPECT_TRUE(!pile_->recorded_viewport().IsEmpty()); 363 EXPECT_TRUE(!pile_->recorded_viewport().IsEmpty());
364 EXPECT_EQ(Region().ToString(), invalidation.ToString()); 364 EXPECT_EQ(Region().ToString(), invalidation.ToString());
365 } 365 }
366 366
367 TEST_F(PicturePileTest, BigFullLayerInvalidation) {
368 gfx::Size huge_layer_size(100000000, 100000000);
369 gfx::Rect viewport(300000, 400000, 5000, 6000);
370
371 // Resize the pile.
372 Region invalidation;
373 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport);
374
375 // Invalidating a huge layer should be fast.
376 base::TimeTicks start = base::TimeTicks::Now();
377 invalidation = gfx::Rect(huge_layer_size);
378 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport);
379 base::TimeTicks end = base::TimeTicks::Now();
380 base::TimeDelta length = end - start;
381 // This is verrrry generous to avoid flake.
382 EXPECT_LT(length.InSeconds(), 5);
383 }
384
385 TEST_F(PicturePileTest, BigFullLayerInvalidationWithResizeGrow) {
386 gfx::Size huge_layer_size(100000000, 100000000);
387 gfx::Rect viewport(300000, 400000, 5000, 6000);
388
389 // Resize the pile.
390 Region invalidation;
391 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport);
392
393 // Resize the pile even larger, while invalidating everything in the old size.
394 // Invalidating the whole thing should be fast.
395 base::TimeTicks start = base::TimeTicks::Now();
396 gfx::Size bigger_layer_size(huge_layer_size.width() * 2,
397 huge_layer_size.height() * 2);
398 invalidation = gfx::Rect(huge_layer_size);
399 UpdateAndExpandInvalidation(&invalidation, bigger_layer_size, viewport);
400 base::TimeTicks end = base::TimeTicks::Now();
401 base::TimeDelta length = end - start;
402 // This is verrrry generous to avoid flake.
403 EXPECT_LT(length.InSeconds(), 5);
404 }
405
406 TEST_F(PicturePileTest, BigFullLayerInvalidationWithResizeShrink) {
407 gfx::Size huge_layer_size(100000000, 100000000);
408 gfx::Rect viewport(300000, 400000, 5000, 6000);
409
410 // Resize the pile.
411 Region invalidation;
412 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport);
413
414 // Resize the pile smaller, while invalidating everything in the new size.
415 // Invalidating the whole thing should be fast.
416 base::TimeTicks start = base::TimeTicks::Now();
417 gfx::Size smaller_layer_size(huge_layer_size.width() - 1000,
418 huge_layer_size.height() - 1000);
419 invalidation = gfx::Rect(smaller_layer_size);
420 UpdateAndExpandInvalidation(&invalidation, smaller_layer_size, viewport);
421 base::TimeTicks end = base::TimeTicks::Now();
422 base::TimeDelta length = end - start;
423 // This is verrrry generous to avoid flake.
424 EXPECT_LT(length.InSeconds(), 5);
enne (OOO) 2014/10/11 00:26:33 Are there correctness tests you can do here too, l
danakj 2014/10/11 00:30:22 Hmm ya I guess that'd be good. I did break some LT
425 }
426
367 TEST_F(PicturePileTest, InvalidationOutsideRecordingRect) { 427 TEST_F(PicturePileTest, InvalidationOutsideRecordingRect) {
368 gfx::Size huge_layer_size(10000000, 20000000); 428 gfx::Size huge_layer_size(10000000, 20000000);
369 gfx::Rect viewport(300000, 400000, 5000, 6000); 429 gfx::Rect viewport(300000, 400000, 5000, 6000);
370 430
371 // Resize the pile and set up the interest rect. 431 // Resize the pile and set up the interest rect.
372 Region invalidation; 432 Region invalidation;
373 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); 433 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport);
374 434
375 // Invalidation inside the recording rect does not need to be expanded. 435 // Invalidation inside the recording rect does not need to be expanded.
376 invalidation = viewport; 436 invalidation = viewport;
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 client_.add_draw_rect(tiling_rect(), paint); 1331 client_.add_draw_rect(tiling_rect(), paint);
1272 client_.add_draw_rect(tiling_rect(), paint); 1332 client_.add_draw_rect(tiling_rect(), paint);
1273 client_.add_draw_rect(tiling_rect(), paint); 1333 client_.add_draw_rect(tiling_rect(), paint);
1274 Region invalidation5(tiling_rect()); 1334 Region invalidation5(tiling_rect());
1275 UpdateAndExpandInvalidation(&invalidation5, tiling_size(), tiling_rect()); 1335 UpdateAndExpandInvalidation(&invalidation5, tiling_size(), tiling_rect());
1276 EXPECT_FALSE(pile_->is_solid_color()); 1336 EXPECT_FALSE(pile_->is_solid_color());
1277 } 1337 }
1278 1338
1279 } // namespace 1339 } // namespace
1280 } // namespace cc 1340 } // namespace cc
OLDNEW
« cc/resources/picture_pile.cc ('K') | « cc/resources/picture_pile.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698