| 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); |
| 69 } | 70 } |
| 70 | 71 |
| 71 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) { | 72 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) { |
| 72 PropertyTrees* property_trees = layer->layer_tree_host()->property_trees(); | 73 PropertyTrees* property_trees = layer->layer_tree_host()->property_trees(); |
| 73 LayerList update_list; | 74 LayerList update_list; |
| 74 update_list.push_back(layer); | 75 update_list.push_back(layer); |
| 75 draw_property_utils::ComputeVisibleRectsForTesting( | 76 draw_property_utils::ComputeVisibleRectsForTesting( |
| 76 property_trees, property_trees->non_root_surfaces_enabled, &update_list); | 77 property_trees, property_trees->non_root_surfaces_enabled, &update_list); |
| 77 gfx::Rect visible_layer_rect = layer->visible_layer_rect_for_testing(); | 78 gfx::Rect visible_layer_rect = layer->visible_layer_rect_for_testing(); |
| 78 switch (mode_) { | 79 switch (mode_) { |
| (...skipping 52 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 | 132 // 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. | 133 // LCG and keep the state locally in the benchmark. |
| 133 float InvalidationBenchmark::LCGRandom() { | 134 float InvalidationBenchmark::LCGRandom() { |
| 134 const uint32_t a = 1664525; | 135 const uint32_t a = 1664525; |
| 135 const uint32_t c = 1013904223; | 136 const uint32_t c = 1013904223; |
| 136 seed_ = a * seed_ + c; | 137 seed_ = a * seed_ + c; |
| 137 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max(); | 138 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max(); |
| 138 } | 139 } |
| 139 | 140 |
| 140 } // namespace cc | 141 } // namespace cc |
| OLD | NEW |