OLD | NEW |
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/layers/picture_layer.h" | 5 #include "cc/layers/picture_layer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 gfx::Rect layer_rect(layer_bounds); | 441 gfx::Rect layer_rect(layer_bounds); |
442 Region invalidation(layer_rect); | 442 Region invalidation(layer_rect); |
443 recording_source->UpdateAndExpandInvalidation( | 443 recording_source->UpdateAndExpandInvalidation( |
444 client, &invalidation, layer_bounds, 1, RecordingSource::RECORD_NORMALLY); | 444 client, &invalidation, layer_bounds, 1, RecordingSource::RECORD_NORMALLY); |
445 | 445 |
446 // Layer is suitable for gpu rasterization by default. | 446 // Layer is suitable for gpu rasterization by default. |
447 EXPECT_TRUE(recording_source->IsSuitableForGpuRasterization()); | 447 EXPECT_TRUE(recording_source->IsSuitableForGpuRasterization()); |
448 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); | 448 EXPECT_TRUE(layer->IsSuitableForGpuRasterization()); |
449 | 449 |
450 // Veto gpu rasterization. | 450 // Veto gpu rasterization. |
451 recording_source->SetUnsuitableForGpuRasterization(); | 451 recording_source->SetForceUnsuitableForGpuRasterization(true); |
452 EXPECT_FALSE(recording_source->IsSuitableForGpuRasterization()); | 452 EXPECT_FALSE(recording_source->IsSuitableForGpuRasterization()); |
453 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); | 453 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); |
454 } | 454 } |
455 | 455 |
456 // PicturePile uses the source frame number as a unit for measuring invalidation | 456 // PicturePile uses the source frame number as a unit for measuring invalidation |
457 // frequency. When a pile moves between compositors, the frame number increases | 457 // frequency. When a pile moves between compositors, the frame number increases |
458 // non-monotonically. This executes that code path under this scenario allowing | 458 // non-monotonically. This executes that code path under this scenario allowing |
459 // for the code to verify correctness with DCHECKs. | 459 // for the code to verify correctness with DCHECKs. |
460 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { | 460 TEST(PictureLayerTest, NonMonotonicSourceFrameNumber) { |
461 LayerTreeSettings settings; | 461 LayerTreeSettings settings; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 // Do a main frame, record the picture layers. The frame number has changed | 520 // Do a main frame, record the picture layers. The frame number has changed |
521 // non-monotonically. | 521 // non-monotonically. |
522 layer->SetNeedsDisplay(); | 522 layer->SetNeedsDisplay(); |
523 host2->Composite(base::TimeTicks::Now()); | 523 host2->Composite(base::TimeTicks::Now()); |
524 EXPECT_EQ(3, layer->update_count()); | 524 EXPECT_EQ(3, layer->update_count()); |
525 EXPECT_EQ(1, host2->source_frame_number()); | 525 EXPECT_EQ(1, host2->source_frame_number()); |
526 } | 526 } |
527 | 527 |
528 } // namespace | 528 } // namespace |
529 } // namespace cc | 529 } // namespace cc |
OLD | NEW |