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

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

Issue 23171014: Fix UpdateTilePriorities viewport in Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to 221292 Created 7 years, 3 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 | « android_webview/browser/in_process_view_renderer.cc ('k') | cc/layers/picture_layer_impl.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/overdraw_metrics.h" 5 #include "cc/debug/overdraw_metrics.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/trees/layer_tree_host.h" 10 #include "cc/trees/layer_tree_host.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 void OverdrawMetrics::RecordMetrics( 142 void OverdrawMetrics::RecordMetrics(
143 const LayerTreeHostImpl* layer_tree_host_impl) const { 143 const LayerTreeHostImpl* layer_tree_host_impl) const {
144 if (record_metrics_for_frame_) { 144 if (record_metrics_for_frame_) {
145 RecordMetricsInternal<LayerTreeHostImpl>(DrawingToScreen, 145 RecordMetricsInternal<LayerTreeHostImpl>(DrawingToScreen,
146 layer_tree_host_impl); 146 layer_tree_host_impl);
147 } 147 }
148 } 148 }
149 149
150 static gfx::Size DeviceViewportSize(const LayerTreeHost* host) { 150 static gfx::Size DrawViewportSize(const LayerTreeHost* host) {
151 return host->device_viewport_size(); 151 return host->device_viewport_size();
152 } 152 }
153 static gfx::Size DeviceViewportSize(const LayerTreeHostImpl* host_impl) { 153 static gfx::Size DrawViewportSize(const LayerTreeHostImpl* host_impl) {
154 return host_impl->device_viewport_size(); 154 return host_impl->DrawViewportSize();
155 } 155 }
156 156
157 template <typename LayerTreeHostType> 157 template <typename LayerTreeHostType>
158 void OverdrawMetrics::RecordMetricsInternal( 158 void OverdrawMetrics::RecordMetricsInternal(
159 MetricsType metrics_type, 159 MetricsType metrics_type,
160 const LayerTreeHostType* layer_tree_host) const { 160 const LayerTreeHostType* layer_tree_host) const {
161 // This gives approximately 10x the percentage of pixels to fill the viewport 161 // This gives approximately 10x the percentage of pixels to fill the viewport
162 // once. 162 // once.
163 float normalization = 1000.f / (DeviceViewportSize(layer_tree_host).width() * 163 float normalization = 1000.f / (DrawViewportSize(layer_tree_host).width() *
164 DeviceViewportSize(layer_tree_host).height()); 164 DrawViewportSize(layer_tree_host).height());
165 // This gives approximately 100x the percentage of tiles to fill the viewport 165 // This gives approximately 100x the percentage of tiles to fill the viewport
166 // once, if all tiles were 256x256. 166 // once, if all tiles were 256x256.
167 float tile_normalization = 167 float tile_normalization =
168 10000.f / (DeviceViewportSize(layer_tree_host).width() / 256.f * 168 10000.f / (DrawViewportSize(layer_tree_host).width() / 256.f *
169 DeviceViewportSize(layer_tree_host).height() / 256.f); 169 DrawViewportSize(layer_tree_host).height() / 256.f);
170 // This gives approximately 10x the percentage of bytes to fill the viewport 170 // This gives approximately 10x the percentage of bytes to fill the viewport
171 // once, assuming 4 bytes per pixel. 171 // once, assuming 4 bytes per pixel.
172 float byte_normalization = normalization / 4; 172 float byte_normalization = normalization / 4;
173 173
174 switch (metrics_type) { 174 switch (metrics_type) {
175 case DrawingToScreen: { 175 case DrawingToScreen: {
176 UMA_HISTOGRAM_CUSTOM_COUNTS( 176 UMA_HISTOGRAM_CUSTOM_COUNTS(
177 "Renderer4.pixelCountOpaque_Draw", 177 "Renderer4.pixelCountOpaque_Draw",
178 static_cast<int>(normalization * pixels_drawn_opaque_), 178 static_cast<int>(normalization * pixels_drawn_opaque_),
179 100, 1000000, 50); 179 100, 1000000, 50);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 contents_texture_use_bytes_, 259 contents_texture_use_bytes_,
260 "RenderSurfaceTextureBytes", 260 "RenderSurfaceTextureBytes",
261 render_surface_texture_use_bytes_); 261 render_surface_texture_use_bytes_);
262 } 262 }
263 break; 263 break;
264 } 264 }
265 } 265 }
266 } 266 }
267 267
268 } // namespace cc 268 } // namespace cc
OLDNEW
« no previous file with comments | « android_webview/browser/in_process_view_renderer.cc ('k') | cc/layers/picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698