Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/resources/tile_manager.h" | 5 #include "cc/resources/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/metrics/histogram_macros.h" | |
|
Ilya Sherman
2015/04/14 21:31:50
nit: Not needed?
jbroman
2015/04/15 15:18:16
Whoops, thought I'd removed those. Thanks; done.
| |
| 16 #include "base/timer/elapsed_timer.h" | |
| 15 #include "base/trace_event/trace_event_argument.h" | 17 #include "base/trace_event/trace_event_argument.h" |
| 18 #include "cc/base/histograms.h" | |
| 16 #include "cc/debug/devtools_instrumentation.h" | 19 #include "cc/debug/devtools_instrumentation.h" |
| 17 #include "cc/debug/frame_viewer_instrumentation.h" | 20 #include "cc/debug/frame_viewer_instrumentation.h" |
| 18 #include "cc/debug/traced_value.h" | 21 #include "cc/debug/traced_value.h" |
| 19 #include "cc/layers/picture_layer_impl.h" | 22 #include "cc/layers/picture_layer_impl.h" |
| 20 #include "cc/resources/raster_buffer.h" | 23 #include "cc/resources/raster_buffer.h" |
| 21 #include "cc/resources/tile.h" | 24 #include "cc/resources/tile.h" |
| 22 #include "cc/resources/tile_task_runner.h" | 25 #include "cc/resources/tile_task_runner.h" |
| 23 #include "ui/gfx/geometry/rect_conversions.h" | 26 #include "ui/gfx/geometry/rect_conversions.h" |
| 24 | 27 |
| 25 namespace cc { | 28 namespace cc { |
| 26 namespace { | 29 namespace { |
| 27 | 30 |
| 28 // Flag to indicate whether we should try and detect that | 31 // Flag to indicate whether we should try and detect that |
| 29 // a tile is of solid color. | 32 // a tile is of solid color. |
| 30 const bool kUseColorEstimator = true; | 33 const bool kUseColorEstimator = true; |
| 31 | 34 |
| 35 DEFINE_SCOPED_UMA_HISTOGRAM_AREA_TIMER(ScopedRasterTaskTimer, | |
| 36 "Renderer4.RasterTaskUs", | |
| 37 "Renderer4.RasterTaskPixelsPerMs"); | |
| 38 | |
| 32 class RasterTaskImpl : public RasterTask { | 39 class RasterTaskImpl : public RasterTask { |
| 33 public: | 40 public: |
| 34 RasterTaskImpl( | 41 RasterTaskImpl( |
| 35 const Resource* resource, | 42 const Resource* resource, |
| 36 RasterSource* raster_source, | 43 RasterSource* raster_source, |
| 37 const gfx::Rect& content_rect, | 44 const gfx::Rect& content_rect, |
| 38 float contents_scale, | 45 float contents_scale, |
| 39 TileResolution tile_resolution, | 46 TileResolution tile_resolution, |
| 40 int layer_id, | 47 int layer_id, |
| 41 const void* tile_id, | 48 const void* tile_id, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", | 108 UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", |
| 102 analysis_.is_solid_color); | 109 analysis_.is_solid_color); |
| 103 | 110 |
| 104 // Clear the flag if we're not using the estimator. | 111 // Clear the flag if we're not using the estimator. |
| 105 analysis_.is_solid_color &= kUseColorEstimator; | 112 analysis_.is_solid_color &= kUseColorEstimator; |
| 106 } | 113 } |
| 107 | 114 |
| 108 void Raster(const RasterSource* raster_source) { | 115 void Raster(const RasterSource* raster_source) { |
| 109 frame_viewer_instrumentation::ScopedRasterTask raster_task( | 116 frame_viewer_instrumentation::ScopedRasterTask raster_task( |
| 110 tile_id_, tile_resolution_, source_frame_number_, layer_id_); | 117 tile_id_, tile_resolution_, source_frame_number_, layer_id_); |
| 118 ScopedRasterTaskTimer timer; | |
| 119 timer.SetArea(content_rect_.size().GetArea()); | |
| 111 | 120 |
| 112 DCHECK(raster_source); | 121 DCHECK(raster_source); |
| 113 | 122 |
| 114 raster_buffer_->Playback(raster_source_.get(), content_rect_, | 123 raster_buffer_->Playback(raster_source_.get(), content_rect_, |
| 115 contents_scale_); | 124 contents_scale_); |
| 116 } | 125 } |
| 117 | 126 |
| 118 RasterSource::SolidColorAnalysis analysis_; | 127 RasterSource::SolidColorAnalysis analysis_; |
| 119 scoped_refptr<RasterSource> raster_source_; | 128 scoped_refptr<RasterSource> raster_source_; |
| 120 gfx::Rect content_rect_; | 129 gfx::Rect content_rect_; |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 967 result -= other; | 976 result -= other; |
| 968 return result; | 977 return result; |
| 969 } | 978 } |
| 970 | 979 |
| 971 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 980 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
| 972 return memory_bytes_ > limit.memory_bytes_ || | 981 return memory_bytes_ > limit.memory_bytes_ || |
| 973 resource_count_ > limit.resource_count_; | 982 resource_count_ > limit.resource_count_; |
| 974 } | 983 } |
| 975 | 984 |
| 976 } // namespace cc | 985 } // namespace cc |
| OLD | NEW |