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

Side by Side Diff: cc/trees/layer_tree_host_unittest_checkerimaging.cc

Issue 2924233002: cc: Move pre-decodes to background worker. (Closed)
Patch Set: export Created 3 years, 6 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/tiles/tile_manager.cc ('K') | « cc/tiles/tile_manager_unittest.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/base/completion_event.h" 5 #include "cc/base/completion_event.h"
6 #include "cc/test/begin_frame_args_test.h" 6 #include "cc/test/begin_frame_args_test.h"
7 #include "cc/test/fake_content_layer_client.h" 7 #include "cc/test/fake_content_layer_client.h"
8 #include "cc/test/fake_external_begin_frame_source.h" 8 #include "cc/test/fake_external_begin_frame_source.h"
9 #include "cc/test/fake_picture_layer.h" 9 #include "cc/test/fake_picture_layer.h"
10 #include "cc/test/layer_tree_test.h" 10 #include "cc/test/layer_tree_test.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 void ReadyToCommitOnThread(LayerTreeHostImpl* host_impl) override { 76 void ReadyToCommitOnThread(LayerTreeHostImpl* host_impl) override {
77 if (num_of_commits_ == 1) { 77 if (num_of_commits_ == 1) {
78 // Send the blocked invalidation request before notifying that we're ready 78 // Send the blocked invalidation request before notifying that we're ready
79 // to commit, since the invalidation will be merged with the commit. 79 // to commit, since the invalidation will be merged with the commit.
80 host_impl->BlockImplSideInvalidationRequestsForTesting(false); 80 host_impl->BlockImplSideInvalidationRequestsForTesting(false);
81 } 81 }
82 } 82 }
83 83
84 void NotifyAllTileTasksCompleted(LayerTreeHostImpl* host_impl) override {
85 // Wait until all tile tasks have finished before flushing the decode tasks.
86 // The CheckerImageTracker does not queue decode work until higher priority
87 // raster work has finished.
88
89 // Run all tasks on the image worker to ensure that the decode completion
90 // triggers an impl-side invalidation request.
91 FlushImageDecodeTasks();
92
93 // Request a commit to ensure that this invalidation is merged with the
94 // incoming frame.
95 host_impl->GetTaskRunner()->PostTask(
96 FROM_HERE, base::Bind(&LayerTreeHostImpl::SetNeedsCommit,
97 base::Unretained(host_impl)));
98 }
99
84 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 100 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
85 switch (++num_of_commits_) { 101 switch (++num_of_commits_) {
86 case 1: { 102 case 1:
87 // The first commit has happened. Run all tasks on the image worker to 103 // Block notifying the scheduler of this request until we've had a
88 // ensure that the decode completion triggers an impl-side invalidation 104 // chance to make sure that the decode work was scheduled, flushed and
89 // request. 105 // the commit requested after it is received.
90 FlushImageDecodeTasks();
91
92 // Block notifying the scheduler of this request until we get a commit.
93 host_impl->BlockImplSideInvalidationRequestsForTesting(true); 106 host_impl->BlockImplSideInvalidationRequestsForTesting(true);
94 host_impl->SetNeedsCommit(); 107 break;
95 } break;
96 case 2: { 108 case 2: {
97 // Ensure that the expected tiles are invalidated on the sync tree. 109 // Ensure that the expected tiles are invalidated on the sync tree.
98 PictureLayerImpl* sync_layer_impl = static_cast<PictureLayerImpl*>( 110 PictureLayerImpl* sync_layer_impl = static_cast<PictureLayerImpl*>(
99 host_impl->sync_tree()->root_layer_for_testing()); 111 host_impl->sync_tree()->root_layer_for_testing());
100 PictureLayerTiling* sync_tiling = 112 PictureLayerTiling* sync_tiling =
101 sync_layer_impl->picture_layer_tiling_set() 113 sync_layer_impl->picture_layer_tiling_set()
102 ->FindTilingWithResolution(TileResolution::HIGH_RESOLUTION); 114 ->FindTilingWithResolution(TileResolution::HIGH_RESOLUTION);
103 115
104 for (int i = 0; i < 4; i++) { 116 for (int i = 0; i < 4; i++) {
117 SCOPED_TRACE(i);
105 for (int j = 0; j < 2; j++) { 118 for (int j = 0; j < 2; j++) {
119 SCOPED_TRACE(j);
106 Tile* tile = 120 Tile* tile =
107 sync_tiling->TileAt(i, j) ? sync_tiling->TileAt(i, j) : nullptr; 121 sync_tiling->TileAt(i, j) ? sync_tiling->TileAt(i, j) : nullptr;
108 122
109 // If this is the pending tree, then only the invalidated tiles 123 // If this is the pending tree, then only the invalidated tiles
110 // exist and have a raster task. If its the active tree, then only 124 // exist and have a raster task. If its the active tree, then only
111 // the invalidated tiles have a raster task. 125 // the invalidated tiles have a raster task.
112 if (i < 3) { 126 if (i < 3) {
113 EXPECT_TRUE(tile->HasRasterTask()); 127 EXPECT_TRUE(tile->HasRasterTask());
114 } else if (host_impl->pending_tree()) { 128 } else if (host_impl->pending_tree()) {
115 EXPECT_EQ(tile, nullptr); 129 EXPECT_EQ(tile, nullptr);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 200
187 int num_of_activations_ = 0; 201 int num_of_activations_ = 0;
188 int num_of_commits_ = 0; 202 int num_of_commits_ = 0;
189 int num_of_impl_side_invalidations_ = 0; 203 int num_of_impl_side_invalidations_ = 0;
190 }; 204 };
191 205
192 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostCheckerImagingTestImplSideTree); 206 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostCheckerImagingTestImplSideTree);
193 207
194 } // namespace 208 } // namespace
195 } // namespace cc 209 } // namespace cc
OLDNEW
« cc/tiles/tile_manager.cc ('K') | « cc/tiles/tile_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698