| 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 | 10 |
| 11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 12 #include "base/debug/trace_event_argument.h" | |
| 13 #include "cc/base/math_util.h" | 12 #include "cc/base/math_util.h" |
| 14 #include "cc/resources/tile.h" | 13 #include "cc/resources/tile.h" |
| 15 #include "cc/resources/tile_priority.h" | 14 #include "cc/resources/tile_priority.h" |
| 16 #include "cc/trees/occlusion_tracker.h" | 15 #include "cc/trees/occlusion_tracker.h" |
| 17 #include "ui/gfx/point_conversions.h" | 16 #include "ui/gfx/point_conversions.h" |
| 18 #include "ui/gfx/rect_conversions.h" | 17 #include "ui/gfx/rect_conversions.h" |
| 19 #include "ui/gfx/safe_integer_conversions.h" | 18 #include "ui/gfx/safe_integer_conversions.h" |
| 20 #include "ui/gfx/size_conversions.h" | 19 #include "ui/gfx/size_conversions.h" |
| 21 | 20 |
| 22 namespace cc { | 21 namespace cc { |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 // Tile holds a ref onto a picture pile. If the tile never gets invalidated | 651 // Tile holds a ref onto a picture pile. If the tile never gets invalidated |
| 653 // and recreated, then that picture pile ref could exist indefinitely. To | 652 // and recreated, then that picture pile ref could exist indefinitely. To |
| 654 // prevent this, ask the client to update the pile to its own ref. This | 653 // prevent this, ask the client to update the pile to its own ref. This |
| 655 // will cause PicturePileImpls and their clones to get deleted once the | 654 // will cause PicturePileImpls and their clones to get deleted once the |
| 656 // corresponding PictureLayerImpl and any in flight raster jobs go out of | 655 // corresponding PictureLayerImpl and any in flight raster jobs go out of |
| 657 // scope. | 656 // scope. |
| 658 it->second->set_picture_pile(active_pile); | 657 it->second->set_picture_pile(active_pile); |
| 659 } | 658 } |
| 660 } | 659 } |
| 661 | 660 |
| 662 void PictureLayerTiling::AsValueInto(base::debug::TracedValue* state) const { | 661 scoped_ptr<base::Value> PictureLayerTiling::AsValue() const { |
| 662 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 663 state->SetInteger("num_tiles", tiles_.size()); | 663 state->SetInteger("num_tiles", tiles_.size()); |
| 664 state->SetDouble("content_scale", contents_scale_); | 664 state->SetDouble("content_scale", contents_scale_); |
| 665 state->BeginDictionary("tiling_size"); | 665 state->Set("tiling_size", MathUtil::AsValue(tiling_size()).release()); |
| 666 MathUtil::AddToTracedValue(tiling_size(), state); | 666 return state.PassAs<base::Value>(); |
| 667 state->EndDictionary(); | |
| 668 } | 667 } |
| 669 | 668 |
| 670 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { | 669 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { |
| 671 size_t amount = 0; | 670 size_t amount = 0; |
| 672 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 671 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
| 673 const Tile* tile = it->second.get(); | 672 const Tile* tile = it->second.get(); |
| 674 amount += tile->GPUMemoryUsageInBytes(); | 673 amount += tile->GPUMemoryUsageInBytes(); |
| 675 } | 674 } |
| 676 return amount; | 675 return amount; |
| 677 } | 676 } |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 DCHECK(*this); | 1007 DCHECK(*this); |
| 1009 do { | 1008 do { |
| 1010 ++tile_iterator_; | 1009 ++tile_iterator_; |
| 1011 } while (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && | 1010 } while (tile_iterator_ != tiling_->eviction_tiles_cache_.end() && |
| 1012 (!(*tile_iterator_)->HasResources())); | 1011 (!(*tile_iterator_)->HasResources())); |
| 1013 | 1012 |
| 1014 return *this; | 1013 return *this; |
| 1015 } | 1014 } |
| 1016 | 1015 |
| 1017 } // namespace cc | 1016 } // namespace cc |
| OLD | NEW |