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

Side by Side Diff: cc/debug/invalidation_benchmark.cc

Issue 1846043002: cc : Make CallFunctionForSubtree on impl use layer iterator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/debug/invalidation_benchmark.h" 5 #include "cc/debug/invalidation_benchmark.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } else { 56 } else {
57 CHECK(false) << "Invalid mode: " << mode_string 57 CHECK(false) << "Invalid mode: " << mode_string
58 << ". One of {fixed_size, layer, viewport, random} expected."; 58 << ". One of {fixed_size, layer, viewport, random} expected.";
59 } 59 }
60 } 60 }
61 61
62 InvalidationBenchmark::~InvalidationBenchmark() { 62 InvalidationBenchmark::~InvalidationBenchmark() {
63 } 63 }
64 64
65 void InvalidationBenchmark::DidUpdateLayers(LayerTreeHost* host) { 65 void InvalidationBenchmark::DidUpdateLayers(LayerTreeHost* host) {
66 LayerTreeHostCommon::CallFunctionForSubtree( 66 LayerTreeHostCommon::CallFunctionForEveryLayer(
67 host->root_layer(), 67 host->root_layer(),
68 [this](Layer* layer) { layer->RunMicroBenchmark(this); }); 68 [this](Layer* layer) { layer->RunMicroBenchmark(this); });
69 } 69 }
70 70
71 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) { 71 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) {
72 switch (mode_) { 72 switch (mode_) {
73 case FIXED_SIZE: { 73 case FIXED_SIZE: {
74 // Invalidation with a random position and fixed size. 74 // Invalidation with a random position and fixed size.
75 gfx::Rect visible_layer_rect = layer->visible_layer_rect(); 75 gfx::Rect visible_layer_rect = layer->visible_layer_rect();
76 int x = LCGRandom() * (visible_layer_rect.width() - width_); 76 int x = LCGRandom() * (visible_layer_rect.width() - width_);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // high quality, but they need to be identical in each run. Therefore, we use a 127 // high quality, but they need to be identical in each run. Therefore, we use a
128 // LCG and keep the state locally in the benchmark. 128 // LCG and keep the state locally in the benchmark.
129 float InvalidationBenchmark::LCGRandom() { 129 float InvalidationBenchmark::LCGRandom() {
130 const uint32_t a = 1664525; 130 const uint32_t a = 1664525;
131 const uint32_t c = 1013904223; 131 const uint32_t c = 1013904223;
132 seed_ = a * seed_ + c; 132 seed_ = a * seed_ + c;
133 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max(); 133 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max();
134 } 134 }
135 135
136 } // namespace cc 136 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698