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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2520 // Set the tile priority rects such that only the tile with the second image | 2520 // Set the tile priority rects such that only the tile with the second image |
2521 // is scheduled for decodes, since it is checker-imaged. | 2521 // is scheduled for decodes, since it is checker-imaged. |
2522 gfx::Rect rect_to_raster(600, 0, 300, 900); | 2522 gfx::Rect rect_to_raster(600, 0, 300, 900); |
2523 active_tiling->SetTilePriorityRectsForTesting( | 2523 active_tiling->SetTilePriorityRectsForTesting( |
2524 gfx::Rect(rect_to_raster), // Visible rect. | 2524 gfx::Rect(rect_to_raster), // Visible rect. |
2525 gfx::Rect(rect_to_raster), // Skewport rect. | 2525 gfx::Rect(rect_to_raster), // Skewport rect. |
2526 gfx::Rect(rect_to_raster), // Soon rect. | 2526 gfx::Rect(rect_to_raster), // Soon rect. |
2527 gfx::Rect(rect_to_raster)); // Eventually rect. | 2527 gfx::Rect(rect_to_raster)); // Eventually rect. |
2528 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); | 2528 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
2529 | 2529 |
| 2530 // Finish all raster and dispatch completion callback so that the decode work |
| 2531 // for checkered images can be scheduled. |
| 2532 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner())->RunUntilIdle(); |
| 2533 base::RunLoop().RunUntilIdle(); |
| 2534 |
2530 // Run decode tasks to trigger completion of any pending decodes. | 2535 // Run decode tasks to trigger completion of any pending decodes. |
2531 FlushDecodeTasks(); | 2536 FlushDecodeTasks(); |
2532 | 2537 |
2533 // Create a new pending tree to invalidate tiles for decoded images and verify | 2538 // Create a new pending tree to invalidate tiles for decoded images and verify |
2534 // that only tiles for |image2| are invalidated. | 2539 // that only tiles for |image2| are invalidated. |
2535 EXPECT_TRUE(host_impl()->client()->did_request_impl_side_invalidation()); | 2540 EXPECT_TRUE(host_impl()->client()->did_request_impl_side_invalidation()); |
2536 PerformImplSideInvalidation(); | 2541 PerformImplSideInvalidation(); |
2537 for (int i = 0; i < 2; i++) { | 2542 for (int i = 0; i < 2; i++) { |
2538 for (int j = 0; j < 2; j++) { | 2543 for (int j = 0; j < 2; j++) { |
2539 const Tile* tile = pending_tiling->TileAt(i, j); | 2544 const Tile* tile = pending_tiling->TileAt(i, j); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 gfx::Rect complete_tiling_rect(layer_bounds); | 2634 gfx::Rect complete_tiling_rect(layer_bounds); |
2630 PictureLayerTiling* active_tiling = | 2635 PictureLayerTiling* active_tiling = |
2631 active_layer()->picture_layer_tiling_set()->tiling_at(0); | 2636 active_layer()->picture_layer_tiling_set()->tiling_at(0); |
2632 active_tiling->SetTilePriorityRectsForTesting( | 2637 active_tiling->SetTilePriorityRectsForTesting( |
2633 complete_tiling_rect, // Visible rect. | 2638 complete_tiling_rect, // Visible rect. |
2634 complete_tiling_rect, // Skewport rect. | 2639 complete_tiling_rect, // Skewport rect. |
2635 complete_tiling_rect, // Soon rect. | 2640 complete_tiling_rect, // Soon rect. |
2636 complete_tiling_rect); // Eventually rect. | 2641 complete_tiling_rect); // Eventually rect. |
2637 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); | 2642 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
2638 | 2643 |
| 2644 // Finish all raster work so the decode work for checkered images can be |
| 2645 // scheduled. |
| 2646 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner())->RunUntilIdle(); |
| 2647 base::RunLoop().RunUntilIdle(); |
| 2648 |
2639 // Flush all decode tasks. The tiles with checkered images should be | 2649 // Flush all decode tasks. The tiles with checkered images should be |
2640 // invalidated. | 2650 // invalidated. |
2641 FlushDecodeTasks(); | 2651 FlushDecodeTasks(); |
2642 EXPECT_TRUE(host_impl()->client()->did_request_impl_side_invalidation()); | 2652 EXPECT_TRUE(host_impl()->client()->did_request_impl_side_invalidation()); |
2643 PerformImplSideInvalidation(); | 2653 PerformImplSideInvalidation(); |
2644 for (int i = 0; i < 2; i++) { | 2654 for (int i = 0; i < 2; i++) { |
2645 for (int j = 0; j < 3; j++) { | 2655 for (int j = 0; j < 3; j++) { |
2646 const Tile* tile = pending_tiling->TileAt(i, j); | 2656 const Tile* tile = pending_tiling->TileAt(i, j); |
2647 if (j == 1) | 2657 if (j == 1) |
2648 EXPECT_TRUE(tile); | 2658 EXPECT_TRUE(tile); |
2649 else | 2659 else |
2650 EXPECT_FALSE(tile); | 2660 EXPECT_FALSE(tile); |
2651 } | 2661 } |
2652 } | 2662 } |
2653 host_impl()->client()->reset_did_request_impl_side_invalidation(); | 2663 host_impl()->client()->reset_did_request_impl_side_invalidation(); |
2654 } | 2664 } |
2655 | 2665 |
2656 } // namespace | 2666 } // namespace |
2657 } // namespace cc | 2667 } // namespace cc |
OLD | NEW |