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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 CHECK(false) << "Invalid mode: " << mode_string | 58 CHECK(false) << "Invalid mode: " << mode_string |
59 << ". One of {fixed_size, layer, viewport, random} expected."; | 59 << ". One of {fixed_size, layer, viewport, random} expected."; |
60 } | 60 } |
61 } | 61 } |
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 CallFunctionLayerType::ALL_LAYERS); | |
70 } | 69 } |
71 | 70 |
72 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) { | 71 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) { |
73 PropertyTrees* property_trees = layer->layer_tree_host()->property_trees(); | 72 PropertyTrees* property_trees = layer->layer_tree_host()->property_trees(); |
74 LayerList update_list; | 73 LayerList update_list; |
75 update_list.push_back(layer); | 74 update_list.push_back(layer); |
76 draw_property_utils::ComputeVisibleRectsForTesting( | 75 draw_property_utils::ComputeVisibleRectsForTesting( |
77 property_trees, property_trees->non_root_surfaces_enabled, &update_list); | 76 property_trees, property_trees->non_root_surfaces_enabled, &update_list); |
78 gfx::Rect visible_layer_rect = layer->visible_layer_rect_for_testing(); | 77 gfx::Rect visible_layer_rect = layer->visible_layer_rect_for_testing(); |
79 switch (mode_) { | 78 switch (mode_) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // 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 |
133 // LCG and keep the state locally in the benchmark. | 132 // LCG and keep the state locally in the benchmark. |
134 float InvalidationBenchmark::LCGRandom() { | 133 float InvalidationBenchmark::LCGRandom() { |
135 const uint32_t a = 1664525; | 134 const uint32_t a = 1664525; |
136 const uint32_t c = 1013904223; | 135 const uint32_t c = 1013904223; |
137 seed_ = a * seed_ + c; | 136 seed_ = a * seed_ + c; |
138 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max(); | 137 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max(); |
139 } | 138 } |
140 | 139 |
141 } // namespace cc | 140 } // namespace cc |
OLD | NEW |