| 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.h" | 5 #include "cc/resources/tile.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event_argument.h" | 9 #include "base/debug/trace_event_argument.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 res->BeginDictionary("managed_state"); | 84 res->BeginDictionary("managed_state"); |
| 85 managed_state_.AsValueInto(res); | 85 managed_state_.AsValueInto(res); |
| 86 res->EndDictionary(); | 86 res->EndDictionary(); |
| 87 | 87 |
| 88 res->SetBoolean("use_picture_analysis", use_picture_analysis()); | 88 res->SetBoolean("use_picture_analysis", use_picture_analysis()); |
| 89 | 89 |
| 90 res->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); | 90 res->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 size_t Tile::GPUMemoryUsageInBytes() const { | 93 size_t Tile::GPUMemoryUsageInBytes() const { |
| 94 size_t total_size = 0; | 94 return managed_state_.draw_info_.GPUMemoryUsageInBytes(); |
| 95 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) | |
| 96 total_size += managed_state_.tile_versions[mode].GPUMemoryUsageInBytes(); | |
| 97 return total_size; | |
| 98 } | |
| 99 | |
| 100 RasterMode Tile::DetermineRasterModeForTree(WhichTree tree) const { | |
| 101 return DetermineRasterModeForResolution(priority(tree).resolution); | |
| 102 } | |
| 103 | |
| 104 RasterMode Tile::DetermineOverallRasterMode() const { | |
| 105 return DetermineRasterModeForResolution(managed_state_.resolution); | |
| 106 } | |
| 107 | |
| 108 RasterMode Tile::DetermineRasterModeForResolution( | |
| 109 TileResolution resolution) const { | |
| 110 RasterMode current_mode = managed_state_.raster_mode; | |
| 111 RasterMode raster_mode = resolution == LOW_RESOLUTION | |
| 112 ? LOW_QUALITY_RASTER_MODE | |
| 113 : HIGH_QUALITY_RASTER_MODE; | |
| 114 return std::min(raster_mode, current_mode); | |
| 115 } | 95 } |
| 116 | 96 |
| 117 bool Tile::HasRasterTask() const { | 97 bool Tile::HasRasterTask() const { |
| 118 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { | 98 return !!managed_state_.draw_info_.raster_task_.get(); |
| 119 if (managed_state_.tile_versions[mode].raster_task_.get()) | |
| 120 return true; | |
| 121 } | |
| 122 return false; | |
| 123 } | 99 } |
| 124 | 100 |
| 125 } // namespace cc | 101 } // namespace cc |
| OLD | NEW |