OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 InvalidationBenchmark::~InvalidationBenchmark() { | 63 InvalidationBenchmark::~InvalidationBenchmark() { |
64 } | 64 } |
65 | 65 |
66 void InvalidationBenchmark::DidUpdateLayers(LayerTreeHost* host) { | 66 void InvalidationBenchmark::DidUpdateLayers(LayerTreeHost* host) { |
67 LayerTreeHostCommon::CallFunctionForEveryLayer( | 67 LayerTreeHostCommon::CallFunctionForEveryLayer( |
68 host, [this](Layer* layer) { layer->RunMicroBenchmark(this); }); | 68 host, [this](Layer* layer) { layer->RunMicroBenchmark(this); }); |
69 } | 69 } |
70 | 70 |
71 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) { | 71 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) { |
72 PropertyTrees* property_trees = layer->layer_tree_host()->property_trees(); | 72 PropertyTrees* property_trees = layer->GetLayerTree()->property_trees(); |
73 LayerList update_list; | 73 LayerList update_list; |
74 update_list.push_back(layer); | 74 update_list.push_back(layer); |
75 draw_property_utils::ComputeVisibleRectsForTesting( | 75 draw_property_utils::ComputeVisibleRectsForTesting( |
76 property_trees, property_trees->non_root_surfaces_enabled, &update_list); | 76 property_trees, property_trees->non_root_surfaces_enabled, &update_list); |
77 gfx::Rect visible_layer_rect = layer->visible_layer_rect_for_testing(); | 77 gfx::Rect visible_layer_rect = layer->visible_layer_rect_for_testing(); |
78 switch (mode_) { | 78 switch (mode_) { |
79 case FIXED_SIZE: { | 79 case FIXED_SIZE: { |
80 // Invalidation with a random position and fixed size. | 80 // Invalidation with a random position and fixed size. |
81 int x = LCGRandom() * (visible_layer_rect.width() - width_); | 81 int x = LCGRandom() * (visible_layer_rect.width() - width_); |
82 int y = LCGRandom() * (visible_layer_rect.height() - height_); | 82 int y = LCGRandom() * (visible_layer_rect.height() - height_); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // high quality, but they need to be identical in each run. Therefore, we use a | 131 // high quality, but they need to be identical in each run. Therefore, we use a |
132 // LCG and keep the state locally in the benchmark. | 132 // LCG and keep the state locally in the benchmark. |
133 float InvalidationBenchmark::LCGRandom() { | 133 float InvalidationBenchmark::LCGRandom() { |
134 const uint32_t a = 1664525; | 134 const uint32_t a = 1664525; |
135 const uint32_t c = 1013904223; | 135 const uint32_t c = 1013904223; |
136 seed_ = a * seed_ + c; | 136 seed_ = a * seed_ + c; |
137 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max(); | 137 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max(); |
138 } | 138 } |
139 | 139 |
140 } // namespace cc | 140 } // namespace cc |
OLD | NEW |