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

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

Issue 684653004: Plumb can_use_lcd_text, contents_opaque directly to ContentLayerClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/rasterize_and_record_benchmark.h" 5 #include "cc/debug/rasterize_and_record_benchmark.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 weak_ptr_factory_.GetWeakPtr()))); 94 weak_ptr_factory_.GetWeakPtr())));
95 } 95 }
96 96
97 void RasterizeAndRecordBenchmark::Run(Layer* layer) { 97 void RasterizeAndRecordBenchmark::Run(Layer* layer) {
98 layer->RunMicroBenchmark(this); 98 layer->RunMicroBenchmark(this);
99 } 99 }
100 100
101 void RasterizeAndRecordBenchmark::RunOnLayer(PictureLayer* layer) { 101 void RasterizeAndRecordBenchmark::RunOnLayer(PictureLayer* layer) {
102 ContentLayerClient* painter = layer->client(); 102 ContentLayerClient* painter = layer->client();
103 gfx::Size content_bounds = layer->content_bounds(); 103 gfx::Size content_bounds = layer->content_bounds();
104 bool can_use_lcd_text = layer->can_use_lcd_text();
105 bool contents_opaque = layer->contents_opaque();
104 106
105 DCHECK(host_); 107 DCHECK(host_);
106 gfx::Size tile_grid_size = host_->settings().default_tile_size; 108 gfx::Size tile_grid_size = host_->settings().default_tile_size;
107 109
108 SkTileGridFactory::TileGridInfo tile_grid_info; 110 SkTileGridFactory::TileGridInfo tile_grid_info;
109 PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info); 111 PicturePileBase::ComputeTileGridInfo(tile_grid_size, &tile_grid_info);
110 112
111 gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect( 113 gfx::Rect visible_content_rect = gfx::ScaleToEnclosingRect(
112 layer->visible_content_rect(), 1.f / layer->contents_scale_x()); 114 layer->visible_content_rect(), 1.f / layer->contents_scale_x());
113 if (visible_content_rect.IsEmpty()) 115 if (visible_content_rect.IsEmpty())
(...skipping 10 matching lines...) Expand all
124 const int kWarmupRuns = 0; 126 const int kWarmupRuns = 0;
125 const int kTimeCheckInterval = 1; 127 const int kTimeCheckInterval = 1;
126 128
127 for (int i = 0; i < record_repeat_count_; ++i) { 129 for (int i = 0; i < record_repeat_count_; ++i) {
128 // Run for a minimum amount of time to avoid problems with timer 130 // Run for a minimum amount of time to avoid problems with timer
129 // quantization when the layer is very small. 131 // quantization when the layer is very small.
130 LapTimer timer(kWarmupRuns, 132 LapTimer timer(kWarmupRuns,
131 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 133 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
132 kTimeCheckInterval); 134 kTimeCheckInterval);
133 do { 135 do {
134 scoped_refptr<Picture> picture = Picture::Create( 136 bool gather_pixels_refs = false;
135 visible_content_rect, painter, tile_grid_info, false, mode); 137 scoped_refptr<Picture> picture = Picture::Create(visible_content_rect,
138 painter,
139 can_use_lcd_text,
140 contents_opaque,
141 tile_grid_info,
142 gather_pixels_refs,
143 mode);
136 timer.NextLap(); 144 timer.NextLap();
137 } while (!timer.HasTimeLimitExpired()); 145 } while (!timer.HasTimeLimitExpired());
138 base::TimeDelta duration = 146 base::TimeDelta duration =
139 base::TimeDelta::FromMillisecondsD(timer.MsPerLap()); 147 base::TimeDelta::FromMillisecondsD(timer.MsPerLap());
140 if (duration < min_time) 148 if (duration < min_time)
141 min_time = duration; 149 min_time = duration;
142 } 150 }
143 151
144 if (mode == Picture::RECORD_NORMALLY) { 152 if (mode == Picture::RECORD_NORMALLY) {
145 record_results_.pixels_recorded += 153 record_results_.pixels_recorded +=
146 visible_content_rect.width() * visible_content_rect.height(); 154 visible_content_rect.width() * visible_content_rect.height();
147 } 155 }
148 record_results_.total_best_time[mode_index] += min_time; 156 record_results_.total_best_time[mode_index] += min_time;
149 } 157 }
150 } 158 }
151 159
152 RasterizeAndRecordBenchmark::RecordResults::RecordResults() 160 RasterizeAndRecordBenchmark::RecordResults::RecordResults()
153 : pixels_recorded(0) {} 161 : pixels_recorded(0) {}
154 162
155 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {} 163 RasterizeAndRecordBenchmark::RecordResults::~RecordResults() {}
156 164
157 } // namespace cc 165 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698