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

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

Issue 2216203002: Refactor MutatorHostClient from LayerTreeHost to LayerTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix call site in cc_perftest. Created 4 years, 4 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 mode_ = VIEWPORT; 56 mode_ = VIEWPORT;
57 } else { 57 } else {
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) {
Khushal 2016/08/15 17:46:39 How about updating the MicroBenchmark interface to
xingliu 2016/08/15 21:29:12 I think it makes sense, and there isn't too much w
67 LayerTreeHostCommon::CallFunctionForEveryLayer( 67 LayerTreeHostCommon::CallFunctionForEveryLayer(
68 host, [this](Layer* layer) { layer->RunMicroBenchmark(this); }); 68 host->GetLayerTree(),
69 [this](Layer* layer) { layer->RunMicroBenchmark(this); });
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698