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

Side by Side Diff: cc/layers/heads_up_display_layer_impl.cc

Issue 1296673004: Devtools/CC: Remove continuous repainting feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 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/layers/heads_up_display_layer_impl.h" 5 #include "cc/layers/heads_up_display_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 base::TimeTicks now = layer_tree_impl()->CurrentBeginFrameArgs().frame_time; 238 base::TimeTicks now = layer_tree_impl()->CurrentBeginFrameArgs().frame_time;
239 if (base::TimeDelta(now - time_of_last_graph_update_).InSecondsF() > 0.25f) { 239 if (base::TimeDelta(now - time_of_last_graph_update_).InSecondsF() > 0.25f) {
240 time_of_last_graph_update_ = now; 240 time_of_last_graph_update_ = now;
241 241
242 if (debug_state.show_fps_counter) { 242 if (debug_state.show_fps_counter) {
243 FrameRateCounter* fps_counter = layer_tree_impl()->frame_rate_counter(); 243 FrameRateCounter* fps_counter = layer_tree_impl()->frame_rate_counter();
244 fps_graph_.value = fps_counter->GetAverageFPS(); 244 fps_graph_.value = fps_counter->GetAverageFPS();
245 fps_counter->GetMinAndMaxFPS(&fps_graph_.min, &fps_graph_.max); 245 fps_counter->GetMinAndMaxFPS(&fps_graph_.min, &fps_graph_.max);
246 } 246 }
247 247
248 if (debug_state.continuous_painting) {
249 PaintTimeCounter* paint_time_counter =
250 layer_tree_impl()->paint_time_counter();
251 base::TimeDelta latest, min, max;
252
253 if (paint_time_counter->End())
254 latest = **paint_time_counter->End();
255 paint_time_counter->GetMinAndMaxPaintTime(&min, &max);
256
257 paint_time_graph_.value = latest.InMillisecondsF();
258 paint_time_graph_.min = min.InMillisecondsF();
259 paint_time_graph_.max = max.InMillisecondsF();
260 }
261
262 if (debug_state.ShowMemoryStats()) { 248 if (debug_state.ShowMemoryStats()) {
263 MemoryHistory* memory_history = layer_tree_impl()->memory_history(); 249 MemoryHistory* memory_history = layer_tree_impl()->memory_history();
264 if (memory_history->End()) 250 if (memory_history->End())
265 memory_entry_ = **memory_history->End(); 251 memory_entry_ = **memory_history->End();
266 else 252 else
267 memory_entry_ = MemoryHistory::Entry(); 253 memory_entry_ = MemoryHistory::Entry();
268 } 254 }
269 } 255 }
270 256
271 fps_graph_.UpdateUpperBound(); 257 fps_graph_.UpdateUpperBound();
272 paint_time_graph_.UpdateUpperBound(); 258 paint_time_graph_.UpdateUpperBound();
273 } 259 }
274 260
275 void HeadsUpDisplayLayerImpl::DrawHudContents(SkCanvas* canvas) { 261 void HeadsUpDisplayLayerImpl::DrawHudContents(SkCanvas* canvas) {
276 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); 262 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state();
277 263
278 if (debug_state.ShowHudRects()) { 264 if (debug_state.ShowHudRects()) {
279 DrawDebugRects(canvas, layer_tree_impl()->debug_rect_history()); 265 DrawDebugRects(canvas, layer_tree_impl()->debug_rect_history());
280 if (IsAnimatingHUDContents()) { 266 if (IsAnimatingHUDContents()) {
281 layer_tree_impl()->SetNeedsRedraw(); 267 layer_tree_impl()->SetNeedsRedraw();
282 } 268 }
283 } 269 }
284 270
285 SkRect area = SkRect::MakeEmpty(); 271 SkRect area = SkRect::MakeEmpty();
286 if (debug_state.continuous_painting) { 272 if (debug_state.show_fps_counter) {
danakj 2015/08/21 18:56:09 you can just early out if !show_fps_counter and do
samli 2015/08/26 21:08:24 Done.
287 area = DrawPaintTimeDisplay(
288 canvas, layer_tree_impl()->paint_time_counter(), 0, 0);
289 } else if (debug_state.show_fps_counter) {
290 // Don't show the FPS display when continuous painting is enabled, because 273 // Don't show the FPS display when continuous painting is enabled, because
danakj 2015/08/21 18:56:09 This comment should go
samli 2015/08/26 21:08:24 Done.
291 // it would show misleading numbers. 274 // it would show misleading numbers.
292 area = 275 area =
293 DrawFPSDisplay(canvas, layer_tree_impl()->frame_rate_counter(), 0, 0); 276 DrawFPSDisplay(canvas, layer_tree_impl()->frame_rate_counter(), 0, 0);
294 } 277 }
295 278
296 if (debug_state.show_fps_counter || debug_state.continuous_painting) { 279 if (debug_state.show_fps_counter) {
297 area = DrawGpuRasterizationStatus(canvas, 0, area.bottom(), 280 area = DrawGpuRasterizationStatus(canvas, 0, area.bottom(),
298 SkMaxScalar(area.width(), 150)); 281 SkMaxScalar(area.width(), 150));
299 } 282 }
300 283
301 if (debug_state.ShowMemoryStats()) 284 if (debug_state.ShowMemoryStats())
302 DrawMemoryDisplay(canvas, 0, area.bottom(), SkMaxScalar(area.width(), 150)); 285 DrawMemoryDisplay(canvas, 0, area.bottom(), SkMaxScalar(area.width(), 150));
303 } 286 }
304 int HeadsUpDisplayLayerImpl::MeasureText(SkPaint* paint, 287 int HeadsUpDisplayLayerImpl::MeasureText(SkPaint* paint,
305 const std::string& text, 288 const std::string& text,
306 int size) const { 289 int size) const {
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 return "cc::HeadsUpDisplayLayerImpl"; 849 return "cc::HeadsUpDisplayLayerImpl";
867 } 850 }
868 851
869 void HeadsUpDisplayLayerImpl::AsValueInto( 852 void HeadsUpDisplayLayerImpl::AsValueInto(
870 base::trace_event::TracedValue* dict) const { 853 base::trace_event::TracedValue* dict) const {
871 LayerImpl::AsValueInto(dict); 854 LayerImpl::AsValueInto(dict);
872 dict->SetString("layer_name", "Heads Up Display Layer"); 855 dict->SetString("layer_name", "Heads Up Display Layer");
873 } 856 }
874 857
875 } // namespace cc 858 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698