| 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" |
| 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" |
| 16 #include "cc/debug/devtools_instrumentation.h" | 18 #include "cc/debug/devtools_instrumentation.h" |
| 17 #include "cc/debug/frame_viewer_instrumentation.h" | 19 #include "cc/debug/frame_viewer_instrumentation.h" |
| 18 #include "cc/debug/traced_value.h" | 20 #include "cc/debug/traced_value.h" |
| 19 #include "cc/layers/picture_layer_impl.h" | 21 #include "cc/layers/picture_layer_impl.h" |
| 20 #include "cc/resources/raster_buffer.h" | 22 #include "cc/resources/raster_buffer.h" |
| 21 #include "cc/resources/tile.h" | 23 #include "cc/resources/tile.h" |
| 22 #include "cc/resources/tile_task_runner.h" | 24 #include "cc/resources/tile_task_runner.h" |
| 23 #include "ui/gfx/geometry/rect_conversions.h" | 25 #include "ui/gfx/geometry/rect_conversions.h" |
| 24 | 26 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", | 103 UMA_HISTOGRAM_BOOLEAN("Renderer4.SolidColorTilesAnalyzed", |
| 102 analysis_.is_solid_color); | 104 analysis_.is_solid_color); |
| 103 | 105 |
| 104 // Clear the flag if we're not using the estimator. | 106 // Clear the flag if we're not using the estimator. |
| 105 analysis_.is_solid_color &= kUseColorEstimator; | 107 analysis_.is_solid_color &= kUseColorEstimator; |
| 106 } | 108 } |
| 107 | 109 |
| 108 void Raster(const RasterSource* raster_source) { | 110 void Raster(const RasterSource* raster_source) { |
| 109 frame_viewer_instrumentation::ScopedRasterTask raster_task( | 111 frame_viewer_instrumentation::ScopedRasterTask raster_task( |
| 110 tile_id_, tile_resolution_, source_frame_number_, layer_id_); | 112 tile_id_, tile_resolution_, source_frame_number_, layer_id_); |
| 113 base::ElapsedTimer timer; |
| 111 | 114 |
| 112 DCHECK(raster_source); | 115 DCHECK(raster_source); |
| 113 | 116 |
| 114 raster_buffer_->Playback(raster_source_.get(), content_rect_, | 117 raster_buffer_->Playback(raster_source_.get(), content_rect_, |
| 115 contents_scale_); | 118 contents_scale_); |
| 119 |
| 120 base::TimeDelta elapsed = timer.Elapsed(); |
| 121 UMA_HISTOGRAM_COUNTS("Renderer4.RasterTaskUs", elapsed.InMicroseconds()); |
| 122 UMA_HISTOGRAM_COUNTS( |
| 123 "Renderer4.RasterTaskPixelsPerMs", |
| 124 content_rect_.size().GetArea() / elapsed.InMillisecondsF()); |
| 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_; |
| 121 float contents_scale_; | 130 float contents_scale_; |
| 122 TileResolution tile_resolution_; | 131 TileResolution tile_resolution_; |
| 123 int layer_id_; | 132 int layer_id_; |
| 124 const void* tile_id_; | 133 const void* tile_id_; |
| 125 int source_frame_number_; | 134 int source_frame_number_; |
| (...skipping 841 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 |