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

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

Issue 1591513002: cc: Early out of UpdateTiles for resoureceless draw (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix perftests Created 4 years, 10 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
« no previous file with comments | « cc/tiles/tile_manager_perftest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 9128 matching lines...) Expand 10 before | Expand all | Expand 10 after
9139 EXPECT_FALSE(last_on_draw_frame_->has_no_damage); 9139 EXPECT_FALSE(last_on_draw_frame_->has_no_damage);
9140 last_on_draw_frame_.reset(); 9140 last_on_draw_frame_.reset();
9141 9141
9142 // Next hardware draw has damage. 9142 // Next hardware draw has damage.
9143 resourceless_software_draw = false; 9143 resourceless_software_draw = false;
9144 host_impl_->OnDraw(draw_transform, draw_viewport, clip, 9144 host_impl_->OnDraw(draw_transform, draw_viewport, clip,
9145 resourceless_software_draw); 9145 resourceless_software_draw);
9146 EXPECT_FALSE(last_on_draw_frame_->has_no_damage); 9146 EXPECT_FALSE(last_on_draw_frame_->has_no_damage);
9147 } 9147 }
9148 9148
9149 TEST_F(ResourcelessSoftwareLayerTreeHostImplTest,
9150 ResourcelessSoftwareDrawSkipsUpdateTiles) {
9151 const gfx::Size viewport_size(100, 100);
9152 host_impl_->SetViewportSize(viewport_size);
9153
9154 host_impl_->CreatePendingTree();
9155 scoped_refptr<FakeDisplayListRasterSource> raster_source(
9156 FakeDisplayListRasterSource::CreateFilled(viewport_size));
9157 scoped_ptr<FakePictureLayerImpl> layer(
9158 FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(),
9159 11, raster_source));
9160 layer->SetBounds(viewport_size);
9161 layer->SetDrawsContent(true);
9162 host_impl_->pending_tree()->SetRootLayer(std::move(layer));
9163
9164 host_impl_->pending_tree()->BuildPropertyTreesForTesting();
9165 host_impl_->ActivateSyncTree();
9166
9167 const gfx::Transform draw_transform;
9168 const gfx::Rect draw_viewport(viewport_size);
9169 const gfx::Rect clip(viewport_size);
9170 bool resourceless_software_draw = false;
9171
9172 // Regular draw causes UpdateTiles.
9173 did_request_prepare_tiles_ = false;
9174 host_impl_->OnDraw(draw_transform, draw_viewport, clip,
9175 resourceless_software_draw);
9176 EXPECT_TRUE(did_request_prepare_tiles_);
9177 host_impl_->PrepareTiles();
9178
9179 // Resourceless draw skips UpdateTiles.
9180 const gfx::Rect new_draw_viewport(50, 50);
9181 resourceless_software_draw = true;
9182 did_request_prepare_tiles_ = false;
9183 host_impl_->OnDraw(draw_transform, new_draw_viewport, clip,
9184 resourceless_software_draw);
9185 EXPECT_FALSE(did_request_prepare_tiles_);
9186 }
9187
9149 TEST_F(LayerTreeHostImplTest, ExternalViewportAffectsVisibleRects) { 9188 TEST_F(LayerTreeHostImplTest, ExternalViewportAffectsVisibleRects) {
9150 const gfx::Size layer_size(100, 100); 9189 const gfx::Size layer_size(100, 100);
9151 SetupScrollAndContentsLayers(layer_size); 9190 SetupScrollAndContentsLayers(layer_size);
9152 LayerImpl* content_layer = host_impl_->active_tree() 9191 LayerImpl* content_layer = host_impl_->active_tree()
9153 ->OuterViewportScrollLayer() 9192 ->OuterViewportScrollLayer()
9154 ->children()[0] 9193 ->children()[0]
9155 .get(); 9194 .get();
9156 RebuildPropertyTrees(); 9195 RebuildPropertyTrees();
9157 9196
9158 bool update_lcd_text = false; 9197 bool update_lcd_text = false;
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
10100 // There should not be any jitter measured till we hit the fixed point hits 10139 // There should not be any jitter measured till we hit the fixed point hits
10101 // threshold. 10140 // threshold.
10102 float expected_jitter = 10141 float expected_jitter =
10103 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0; 10142 (i == pending_tree->kFixedPointHitsThreshold) ? 500 : 0;
10104 EXPECT_EQ(jitter, expected_jitter); 10143 EXPECT_EQ(jitter, expected_jitter);
10105 } 10144 }
10106 } 10145 }
10107 10146
10108 } // namespace 10147 } // namespace
10109 } // namespace cc 10148 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager_perftest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698