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/picture_layer_tiling.h" | 5 #include "cc/resources/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 | 11 |
11 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
12 #include "base/debug/trace_event_argument.h" | 13 #include "base/debug/trace_event_argument.h" |
13 #include "cc/base/math_util.h" | 14 #include "cc/base/math_util.h" |
14 #include "cc/resources/tile.h" | 15 #include "cc/resources/tile.h" |
15 #include "cc/resources/tile_priority.h" | 16 #include "cc/resources/tile_priority.h" |
16 #include "cc/trees/occlusion_tracker.h" | 17 #include "cc/trees/occlusion_tracker.h" |
17 #include "ui/gfx/point_conversions.h" | 18 #include "ui/gfx/point_conversions.h" |
18 #include "ui/gfx/rect_conversions.h" | 19 #include "ui/gfx/rect_conversions.h" |
19 #include "ui/gfx/safe_integer_conversions.h" | 20 #include "ui/gfx/safe_integer_conversions.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 | 678 |
678 // Tile holds a ref onto a picture pile. If the tile never gets invalidated | 679 // Tile holds a ref onto a picture pile. If the tile never gets invalidated |
679 // and recreated, then that picture pile ref could exist indefinitely. To | 680 // and recreated, then that picture pile ref could exist indefinitely. To |
680 // prevent this, ask the client to update the pile to its own ref. This | 681 // prevent this, ask the client to update the pile to its own ref. This |
681 // will cause PicturePileImpls to get deleted once the corresponding | 682 // will cause PicturePileImpls to get deleted once the corresponding |
682 // PictureLayerImpl and any in flight raster jobs go out of scope. | 683 // PictureLayerImpl and any in flight raster jobs go out of scope. |
683 it->second->set_picture_pile(active_pile); | 684 it->second->set_picture_pile(active_pile); |
684 } | 685 } |
685 } | 686 } |
686 | 687 |
| 688 void PictureLayerTiling::GetAllTilesForTracing( |
| 689 std::set<const Tile*>* tiles) const { |
| 690 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| 691 tiles->insert(it->second.get()); |
| 692 } |
| 693 |
687 void PictureLayerTiling::AsValueInto(base::debug::TracedValue* state) const { | 694 void PictureLayerTiling::AsValueInto(base::debug::TracedValue* state) const { |
688 state->SetInteger("num_tiles", tiles_.size()); | 695 state->SetInteger("num_tiles", tiles_.size()); |
689 state->SetDouble("content_scale", contents_scale_); | 696 state->SetDouble("content_scale", contents_scale_); |
690 state->BeginDictionary("tiling_size"); | 697 state->BeginDictionary("tiling_size"); |
691 MathUtil::AddToTracedValue(tiling_size(), state); | 698 MathUtil::AddToTracedValue(tiling_size(), state); |
692 state->EndDictionary(); | 699 state->EndDictionary(); |
693 } | 700 } |
694 | 701 |
695 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { | 702 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { |
696 size_t amount = 0; | 703 size_t amount = 0; |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 DCHECK(*this); | 1108 DCHECK(*this); |
1102 do { | 1109 do { |
1103 ++current_eviction_tiles_index_; | 1110 ++current_eviction_tiles_index_; |
1104 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && | 1111 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && |
1105 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); | 1112 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); |
1106 | 1113 |
1107 return *this; | 1114 return *this; |
1108 } | 1115 } |
1109 | 1116 |
1110 } // namespace cc | 1117 } // namespace cc |
OLD | NEW |