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

Side by Side Diff: cc/tiles/tile_manager.cc

Issue 1139743004: cc: Reland "Add UMA stats for record and raster time." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge with master (conflicts with cc/resources move) Created 5 years, 7 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/tiles/tile_manager.h" 5 #include "cc/tiles/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/trace_event/trace_event_argument.h" 15 #include "base/trace_event/trace_event_argument.h"
16 #include "cc/base/histograms.h"
16 #include "cc/debug/devtools_instrumentation.h" 17 #include "cc/debug/devtools_instrumentation.h"
17 #include "cc/debug/frame_viewer_instrumentation.h" 18 #include "cc/debug/frame_viewer_instrumentation.h"
18 #include "cc/debug/traced_value.h" 19 #include "cc/debug/traced_value.h"
19 #include "cc/layers/picture_layer_impl.h" 20 #include "cc/layers/picture_layer_impl.h"
20 #include "cc/raster/raster_buffer.h" 21 #include "cc/raster/raster_buffer.h"
21 #include "cc/raster/tile_task_runner.h" 22 #include "cc/raster/tile_task_runner.h"
22 #include "cc/tiles/tile.h" 23 #include "cc/tiles/tile.h"
23 #include "ui/gfx/geometry/rect_conversions.h" 24 #include "ui/gfx/geometry/rect_conversions.h"
24 25
25 namespace cc { 26 namespace cc {
26 namespace { 27 namespace {
27 28
28 // Flag to indicate whether we should try and detect that 29 // Flag to indicate whether we should try and detect that
29 // a tile is of solid color. 30 // a tile is of solid color.
30 const bool kUseColorEstimator = true; 31 const bool kUseColorEstimator = true;
31 32
33 DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER(
34 ScopedRasterTaskTimer,
35 "Compositing.RasterTask.RasterUs",
36 "Compositing.RasterTask.RasterPixelsPerMs");
37
32 class RasterTaskImpl : public RasterTask { 38 class RasterTaskImpl : public RasterTask {
33 public: 39 public:
34 RasterTaskImpl( 40 RasterTaskImpl(
35 const Resource* resource, 41 const Resource* resource,
36 RasterSource* raster_source, 42 RasterSource* raster_source,
37 const gfx::Rect& content_rect, 43 const gfx::Rect& content_rect,
38 float contents_scale, 44 float contents_scale,
39 TileResolution tile_resolution, 45 TileResolution tile_resolution,
40 int layer_id, 46 int layer_id,
41 const void* tile_id, 47 const void* tile_id,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 102
97 raster_source->PerformSolidColorAnalysis(content_rect_, contents_scale_, 103 raster_source->PerformSolidColorAnalysis(content_rect_, contents_scale_,
98 &analysis_); 104 &analysis_);
99 // Clear the flag if we're not using the estimator. 105 // Clear the flag if we're not using the estimator.
100 analysis_.is_solid_color &= kUseColorEstimator; 106 analysis_.is_solid_color &= kUseColorEstimator;
101 } 107 }
102 108
103 void Raster(const RasterSource* raster_source) { 109 void Raster(const RasterSource* raster_source) {
104 frame_viewer_instrumentation::ScopedRasterTask raster_task( 110 frame_viewer_instrumentation::ScopedRasterTask raster_task(
105 tile_id_, tile_resolution_, source_frame_number_, layer_id_); 111 tile_id_, tile_resolution_, source_frame_number_, layer_id_);
112 ScopedRasterTaskTimer timer;
113 timer.SetArea(content_rect_.size().GetArea());
106 114
107 DCHECK(raster_source); 115 DCHECK(raster_source);
108 116
109 raster_buffer_->Playback(raster_source_.get(), content_rect_, 117 raster_buffer_->Playback(raster_source_.get(), content_rect_,
110 contents_scale_); 118 contents_scale_);
111 } 119 }
112 120
113 RasterSource::SolidColorAnalysis analysis_; 121 RasterSource::SolidColorAnalysis analysis_;
114 scoped_refptr<RasterSource> raster_source_; 122 scoped_refptr<RasterSource> raster_source_;
115 gfx::Rect content_rect_; 123 gfx::Rect content_rect_;
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 result -= other; 974 result -= other;
967 return result; 975 return result;
968 } 976 }
969 977
970 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { 978 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const {
971 return memory_bytes_ > limit.memory_bytes_ || 979 return memory_bytes_ > limit.memory_bytes_ ||
972 resource_count_ > limit.resource_count_; 980 resource_count_ > limit.resource_count_;
973 } 981 }
974 982
975 } // namespace cc 983 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698