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

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: Rebase on another LTH refactor CL. 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
« no previous file with comments | « cc/debug/invalidation_benchmark.h ('k') | cc/debug/micro_benchmark.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 11
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "cc/layers/layer.h" 14 #include "cc/layers/layer.h"
15 #include "cc/layers/picture_layer.h" 15 #include "cc/layers/picture_layer.h"
16 #include "cc/trees/draw_property_utils.h" 16 #include "cc/trees/draw_property_utils.h"
17 #include "cc/trees/layer_tree_host.h" 17 #include "cc/trees/layer_tree.h"
18 #include "cc/trees/layer_tree_host_common.h" 18 #include "cc/trees/layer_tree_host_common.h"
19 #include "ui/gfx/geometry/rect.h" 19 #include "ui/gfx/geometry/rect.h"
20 20
21 namespace cc { 21 namespace cc {
22 22
23 namespace { 23 namespace {
24 24
25 const char* kDefaultInvalidationMode = "viewport"; 25 const char* kDefaultInvalidationMode = "viewport";
26 26
27 } // namespace 27 } // namespace
(...skipping 28 matching lines...) Expand all
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(LayerTree* layer_tree) {
67 LayerTreeHostCommon::CallFunctionForEveryLayer( 67 LayerTreeHostCommon::CallFunctionForEveryLayer(
68 host, [this](Layer* layer) { layer->RunMicroBenchmark(this); }); 68 layer_tree, [this](Layer* layer) { layer->RunMicroBenchmark(this); });
69 } 69 }
70 70
71 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) { 71 void InvalidationBenchmark::RunOnLayer(PictureLayer* layer) {
72 gfx::Rect visible_layer_rect = gfx::Rect(layer->bounds()); 72 gfx::Rect visible_layer_rect = gfx::Rect(layer->bounds());
73 gfx::Transform from_screen; 73 gfx::Transform from_screen;
74 bool invertible = layer->screen_space_transform().GetInverse(&from_screen); 74 bool invertible = layer->screen_space_transform().GetInverse(&from_screen);
75 if (!invertible) 75 if (!invertible)
76 from_screen = gfx::Transform(); 76 from_screen = gfx::Transform();
77 gfx::Rect viewport_rect = MathUtil::ProjectEnclosingClippedRect( 77 gfx::Rect viewport_rect = MathUtil::ProjectEnclosingClippedRect(
78 from_screen, gfx::Rect(layer->GetLayerTree()->device_viewport_size())); 78 from_screen, gfx::Rect(layer->GetLayerTree()->device_viewport_size()));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // high quality, but they need to be identical in each run. Therefore, we use a 133 // high quality, but they need to be identical in each run. Therefore, we use a
134 // LCG and keep the state locally in the benchmark. 134 // LCG and keep the state locally in the benchmark.
135 float InvalidationBenchmark::LCGRandom() { 135 float InvalidationBenchmark::LCGRandom() {
136 const uint32_t a = 1664525; 136 const uint32_t a = 1664525;
137 const uint32_t c = 1013904223; 137 const uint32_t c = 1013904223;
138 seed_ = a * seed_ + c; 138 seed_ = a * seed_ + c;
139 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max(); 139 return static_cast<float>(seed_) / std::numeric_limits<uint32_t>::max();
140 } 140 }
141 141
142 } // namespace cc 142 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/invalidation_benchmark.h ('k') | cc/debug/micro_benchmark.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698