OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layers/tiled_layer_impl.h" | 5 #include "cc/layers/tiled_layer_impl.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/debug/trace_event_argument.h" |
8 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
9 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
10 #include "cc/debug/debug_colors.h" | 11 #include "cc/debug/debug_colors.h" |
11 #include "cc/layers/append_quads_data.h" | 12 #include "cc/layers/append_quads_data.h" |
12 #include "cc/quads/checkerboard_draw_quad.h" | 13 #include "cc/quads/checkerboard_draw_quad.h" |
13 #include "cc/quads/debug_border_draw_quad.h" | 14 #include "cc/quads/debug_border_draw_quad.h" |
14 #include "cc/quads/solid_color_draw_quad.h" | 15 #include "cc/quads/solid_color_draw_quad.h" |
15 #include "cc/quads/tile_draw_quad.h" | 16 #include "cc/quads/tile_draw_quad.h" |
16 #include "cc/resources/layer_tiling_data.h" | 17 #include "cc/resources/layer_tiling_data.h" |
17 #include "cc/trees/occlusion_tracker.h" | 18 #include "cc/trees/occlusion_tracker.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 float* width) const { | 93 float* width) const { |
93 *color = DebugColors::TiledContentLayerBorderColor(); | 94 *color = DebugColors::TiledContentLayerBorderColor(); |
94 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 95 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); |
95 } | 96 } |
96 | 97 |
97 scoped_ptr<LayerImpl> TiledLayerImpl::CreateLayerImpl( | 98 scoped_ptr<LayerImpl> TiledLayerImpl::CreateLayerImpl( |
98 LayerTreeImpl* tree_impl) { | 99 LayerTreeImpl* tree_impl) { |
99 return TiledLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 100 return TiledLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
100 } | 101 } |
101 | 102 |
102 void TiledLayerImpl::AsValueInto(base::DictionaryValue* state) const { | 103 void TiledLayerImpl::AsValueInto(base::debug::TracedValue* state) const { |
103 LayerImpl::AsValueInto(state); | 104 LayerImpl::AsValueInto(state); |
104 state->Set("invalidation", MathUtil::AsValue(update_rect()).release()); | 105 state->BeginArray("invalidation"); |
| 106 MathUtil::AddToTracedValue(update_rect(), state); |
| 107 state->EndArray(); |
105 } | 108 } |
106 | 109 |
107 size_t TiledLayerImpl::GPUMemoryUsageInBytes() const { | 110 size_t TiledLayerImpl::GPUMemoryUsageInBytes() const { |
108 size_t amount = 0; | 111 size_t amount = 0; |
109 const size_t kMemoryUsagePerTileInBytes = | 112 const size_t kMemoryUsagePerTileInBytes = |
110 4 * tiler_->tile_size().width() * tiler_->tile_size().height(); | 113 4 * tiler_->tile_size().width() * tiler_->tile_size().height(); |
111 for (LayerTilingData::TileMap::const_iterator iter = tiler_->tiles().begin(); | 114 for (LayerTilingData::TileMap::const_iterator iter = tiler_->tiles().begin(); |
112 iter != tiler_->tiles().end(); | 115 iter != tiler_->tiles().end(); |
113 ++iter) { | 116 ++iter) { |
114 const DrawableTile* tile = static_cast<DrawableTile*>(iter->second); | 117 const DrawableTile* tile = static_cast<DrawableTile*>(iter->second); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 311 |
309 void TiledLayerImpl::ReleaseResources() { | 312 void TiledLayerImpl::ReleaseResources() { |
310 tiler_->reset(); | 313 tiler_->reset(); |
311 } | 314 } |
312 | 315 |
313 const char* TiledLayerImpl::LayerTypeAsString() const { | 316 const char* TiledLayerImpl::LayerTypeAsString() const { |
314 return "cc::TiledLayerImpl"; | 317 return "cc::TiledLayerImpl"; |
315 } | 318 } |
316 | 319 |
317 } // namespace cc | 320 } // namespace cc |
OLD | NEW |