| 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/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/resources/raster_buffer.h" | 21 #include "cc/resources/raster_buffer.h" |
| 21 #include "cc/resources/tile.h" | 22 #include "cc/resources/tile.h" |
| 22 #include "cc/resources/tile_task_runner.h" | 23 #include "cc/resources/tile_task_runner.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", | 107 UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", |
| 102 analysis_.is_solid_color); | 108 analysis_.is_solid_color); |
| 103 | 109 |
| 104 // Clear the flag if we're not using the estimator. | 110 // Clear the flag if we're not using the estimator. |
| 105 analysis_.is_solid_color &= kUseColorEstimator; | 111 analysis_.is_solid_color &= kUseColorEstimator; |
| 106 } | 112 } |
| 107 | 113 |
| 108 void Raster(const RasterSource* raster_source) { | 114 void Raster(const RasterSource* raster_source) { |
| 109 frame_viewer_instrumentation::ScopedRasterTask raster_task( | 115 frame_viewer_instrumentation::ScopedRasterTask raster_task( |
| 110 tile_id_, tile_resolution_, source_frame_number_, layer_id_); | 116 tile_id_, tile_resolution_, source_frame_number_, layer_id_); |
| 117 ScopedRasterTaskTimer timer; |
| 118 timer.SetArea(content_rect_.size().GetArea()); |
| 111 | 119 |
| 112 DCHECK(raster_source); | 120 DCHECK(raster_source); |
| 113 | 121 |
| 114 raster_buffer_->Playback(raster_source_.get(), content_rect_, | 122 raster_buffer_->Playback(raster_source_.get(), content_rect_, |
| 115 contents_scale_); | 123 contents_scale_); |
| 116 } | 124 } |
| 117 | 125 |
| 118 RasterSource::SolidColorAnalysis analysis_; | 126 RasterSource::SolidColorAnalysis analysis_; |
| 119 scoped_refptr<RasterSource> raster_source_; | 127 scoped_refptr<RasterSource> raster_source_; |
| 120 gfx::Rect content_rect_; | 128 gfx::Rect content_rect_; |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 result -= other; | 975 result -= other; |
| 968 return result; | 976 return result; |
| 969 } | 977 } |
| 970 | 978 |
| 971 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 979 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
| 972 return memory_bytes_ > limit.memory_bytes_ || | 980 return memory_bytes_ > limit.memory_bytes_ || |
| 973 resource_count_ > limit.resource_count_; | 981 resource_count_ > limit.resource_count_; |
| 974 } | 982 } |
| 975 | 983 |
| 976 } // namespace cc | 984 } // namespace cc |
| OLD | NEW |