| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 // Tile holds a ref onto a picture pile. If the tile never gets invalidated | 662 // Tile holds a ref onto a picture pile. If the tile never gets invalidated |
| 662 // and recreated, then that picture pile ref could exist indefinitely. To | 663 // and recreated, then that picture pile ref could exist indefinitely. To |
| 663 // prevent this, ask the client to update the pile to its own ref. This | 664 // prevent this, ask the client to update the pile to its own ref. This |
| 664 // will cause PicturePileImpls and their clones to get deleted once the | 665 // will cause PicturePileImpls and their clones to get deleted once the |
| 665 // corresponding PictureLayerImpl and any in flight raster jobs go out of | 666 // corresponding PictureLayerImpl and any in flight raster jobs go out of |
| 666 // scope. | 667 // scope. |
| 667 it->second->set_picture_pile(active_pile); | 668 it->second->set_picture_pile(active_pile); |
| 668 } | 669 } |
| 669 } | 670 } |
| 670 | 671 |
| 672 void PictureLayerTiling::AllTilesForTracingInto( |
| 673 std::set<const Tile*>* tiles) const { |
| 674 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
| 675 tiles->insert(it->second.get()); |
| 676 } |
| 677 |
| 671 void PictureLayerTiling::AsValueInto(base::debug::TracedValue* state) const { | 678 void PictureLayerTiling::AsValueInto(base::debug::TracedValue* state) const { |
| 672 state->SetInteger("num_tiles", tiles_.size()); | 679 state->SetInteger("num_tiles", tiles_.size()); |
| 673 state->SetDouble("content_scale", contents_scale_); | 680 state->SetDouble("content_scale", contents_scale_); |
| 674 state->BeginDictionary("tiling_size"); | 681 state->BeginDictionary("tiling_size"); |
| 675 MathUtil::AddToTracedValue(tiling_size(), state); | 682 MathUtil::AddToTracedValue(tiling_size(), state); |
| 676 state->EndDictionary(); | 683 state->EndDictionary(); |
| 677 } | 684 } |
| 678 | 685 |
| 679 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { | 686 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { |
| 680 size_t amount = 0; | 687 size_t amount = 0; |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 DCHECK(*this); | 1092 DCHECK(*this); |
| 1086 do { | 1093 do { |
| 1087 ++current_eviction_tiles_index_; | 1094 ++current_eviction_tiles_index_; |
| 1088 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && | 1095 } while (current_eviction_tiles_index_ != eviction_tiles_->size() && |
| 1089 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); | 1096 !(*eviction_tiles_)[current_eviction_tiles_index_]->HasResources()); |
| 1090 | 1097 |
| 1091 return *this; | 1098 return *this; |
| 1092 } | 1099 } |
| 1093 | 1100 |
| 1094 } // namespace cc | 1101 } // namespace cc |
| OLD | NEW |