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