| 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/tiles/picture_layer_tiling.h" | 5 #include "cc/tiles/picture_layer_tiling.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| 11 #include <limits> | 11 #include <limits> |
| 12 #include <set> | 12 #include <set> |
| 13 | 13 |
| 14 #include "base/containers/small_map.h" | 14 #include "base/containers/small_map.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ptr_util.h" |
| 16 #include "base/numerics/safe_conversions.h" | 17 #include "base/numerics/safe_conversions.h" |
| 17 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
| 18 #include "base/trace_event/trace_event_argument.h" | 19 #include "base/trace_event/trace_event_argument.h" |
| 19 #include "cc/base/math_util.h" | 20 #include "cc/base/math_util.h" |
| 20 #include "cc/playback/raster_source.h" | 21 #include "cc/playback/raster_source.h" |
| 21 #include "cc/tiles/prioritized_tile.h" | 22 #include "cc/tiles/prioritized_tile.h" |
| 22 #include "cc/tiles/tile.h" | 23 #include "cc/tiles/tile.h" |
| 23 #include "cc/tiles/tile_priority.h" | 24 #include "cc/tiles/tile_priority.h" |
| 24 #include "ui/gfx/geometry/point_conversions.h" | 25 #include "ui/gfx/geometry/point_conversions.h" |
| 25 #include "ui/gfx/geometry/rect_conversions.h" | 26 #include "ui/gfx/geometry/rect_conversions.h" |
| 26 #include "ui/gfx/geometry/rect_f.h" | 27 #include "ui/gfx/geometry/rect_f.h" |
| 27 #include "ui/gfx/geometry/safe_integer_conversions.h" | 28 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 28 #include "ui/gfx/geometry/size_conversions.h" | 29 #include "ui/gfx/geometry/size_conversions.h" |
| 29 | 30 |
| 30 namespace cc { | 31 namespace cc { |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 const float kSoonBorderDistanceViewportPercentage = 0.15f; | 34 const float kSoonBorderDistanceViewportPercentage = 0.15f; |
| 34 const float kMaxSoonBorderDistanceInScreenPixels = 312.f; | 35 const float kMaxSoonBorderDistanceInScreenPixels = 312.f; |
| 35 | 36 |
| 36 } // namespace | 37 } // namespace |
| 37 | 38 |
| 38 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( | 39 std::unique_ptr<PictureLayerTiling> PictureLayerTiling::Create( |
| 39 WhichTree tree, | 40 WhichTree tree, |
| 40 float contents_scale, | 41 float contents_scale, |
| 41 scoped_refptr<RasterSource> raster_source, | 42 scoped_refptr<RasterSource> raster_source, |
| 42 PictureLayerTilingClient* client, | 43 PictureLayerTilingClient* client, |
| 43 size_t tiling_interest_area_padding, | 44 size_t tiling_interest_area_padding, |
| 44 float skewport_target_time_in_seconds, | 45 float skewport_target_time_in_seconds, |
| 45 int skewport_extrapolation_limit_in_content_pixels) { | 46 int skewport_extrapolation_limit_in_content_pixels) { |
| 46 return make_scoped_ptr(new PictureLayerTiling( | 47 return base::WrapUnique(new PictureLayerTiling( |
| 47 tree, contents_scale, raster_source, client, tiling_interest_area_padding, | 48 tree, contents_scale, raster_source, client, tiling_interest_area_padding, |
| 48 skewport_target_time_in_seconds, | 49 skewport_target_time_in_seconds, |
| 49 skewport_extrapolation_limit_in_content_pixels)); | 50 skewport_extrapolation_limit_in_content_pixels)); |
| 50 } | 51 } |
| 51 | 52 |
| 52 PictureLayerTiling::PictureLayerTiling( | 53 PictureLayerTiling::PictureLayerTiling( |
| 53 WhichTree tree, | 54 WhichTree tree, |
| 54 float contents_scale, | 55 float contents_scale, |
| 55 scoped_refptr<RasterSource> raster_source, | 56 scoped_refptr<RasterSource> raster_source, |
| 56 PictureLayerTilingClient* client, | 57 PictureLayerTilingClient* client, |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { | 1034 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { |
| 1034 size_t amount = 0; | 1035 size_t amount = 0; |
| 1035 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 1036 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
| 1036 const Tile* tile = it->second.get(); | 1037 const Tile* tile = it->second.get(); |
| 1037 amount += tile->GPUMemoryUsageInBytes(); | 1038 amount += tile->GPUMemoryUsageInBytes(); |
| 1038 } | 1039 } |
| 1039 return amount; | 1040 return amount; |
| 1040 } | 1041 } |
| 1041 | 1042 |
| 1042 } // namespace cc | 1043 } // namespace cc |
| OLD | NEW |