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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/containers/small_map.h" | 13 #include "base/containers/small_map.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/numerics/safe_conversions.h" |
15 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
16 #include "base/trace_event/trace_event_argument.h" | 17 #include "base/trace_event/trace_event_argument.h" |
17 #include "cc/base/math_util.h" | 18 #include "cc/base/math_util.h" |
18 #include "cc/playback/raster_source.h" | 19 #include "cc/playback/raster_source.h" |
19 #include "cc/tiles/prioritized_tile.h" | 20 #include "cc/tiles/prioritized_tile.h" |
20 #include "cc/tiles/tile.h" | 21 #include "cc/tiles/tile.h" |
21 #include "cc/tiles/tile_priority.h" | 22 #include "cc/tiles/tile_priority.h" |
22 #include "ui/gfx/geometry/point_conversions.h" | 23 #include "ui/gfx/geometry/point_conversions.h" |
23 #include "ui/gfx/geometry/rect_conversions.h" | 24 #include "ui/gfx/geometry/rect_conversions.h" |
24 #include "ui/gfx/geometry/safe_integer_conversions.h" | 25 #include "ui/gfx/geometry/safe_integer_conversions.h" |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 std::vector<PrioritizedTile>* prioritized_tiles) const { | 934 std::vector<PrioritizedTile>* prioritized_tiles) const { |
934 for (const auto& tile_pair : tiles_) { | 935 for (const auto& tile_pair : tiles_) { |
935 Tile* tile = tile_pair.second; | 936 Tile* tile = tile_pair.second; |
936 prioritized_tiles->push_back( | 937 prioritized_tiles->push_back( |
937 MakePrioritizedTile(tile, ComputePriorityRectTypeForTile(tile))); | 938 MakePrioritizedTile(tile, ComputePriorityRectTypeForTile(tile))); |
938 } | 939 } |
939 } | 940 } |
940 | 941 |
941 void PictureLayerTiling::AsValueInto( | 942 void PictureLayerTiling::AsValueInto( |
942 base::trace_event::TracedValue* state) const { | 943 base::trace_event::TracedValue* state) const { |
943 state->SetInteger("num_tiles", tiles_.size()); | 944 state->SetInteger("num_tiles", base::saturated_cast<int>(tiles_.size())); |
944 state->SetDouble("content_scale", contents_scale_); | 945 state->SetDouble("content_scale", contents_scale_); |
945 MathUtil::AddToTracedValue("visible_rect", current_visible_rect_, state); | 946 MathUtil::AddToTracedValue("visible_rect", current_visible_rect_, state); |
946 MathUtil::AddToTracedValue("skewport_rect", current_skewport_rect_, state); | 947 MathUtil::AddToTracedValue("skewport_rect", current_skewport_rect_, state); |
947 MathUtil::AddToTracedValue("soon_rect", current_soon_border_rect_, state); | 948 MathUtil::AddToTracedValue("soon_rect", current_soon_border_rect_, state); |
948 MathUtil::AddToTracedValue("eventually_rect", current_eventually_rect_, | 949 MathUtil::AddToTracedValue("eventually_rect", current_eventually_rect_, |
949 state); | 950 state); |
950 MathUtil::AddToTracedValue("tiling_size", tiling_size(), state); | 951 MathUtil::AddToTracedValue("tiling_size", tiling_size(), state); |
951 } | 952 } |
952 | 953 |
953 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { | 954 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 break; | 1105 break; |
1105 } | 1106 } |
1106 | 1107 |
1107 gfx::Rect result(origin_x, origin_y, width, height); | 1108 gfx::Rect result(origin_x, origin_y, width, height); |
1108 if (cache) | 1109 if (cache) |
1109 cache->previous_result = result; | 1110 cache->previous_result = result; |
1110 return result; | 1111 return result; |
1111 } | 1112 } |
1112 | 1113 |
1113 } // namespace cc | 1114 } // namespace cc |
OLD | NEW |