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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
| 10 #include "base/debug/trace_event_argument.h" |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
11 #include "cc/base/math_util.h" | 12 #include "cc/base/math_util.h" |
12 #include "cc/base/util.h" | 13 #include "cc/base/util.h" |
13 #include "cc/debug/debug_colors.h" | 14 #include "cc/debug/debug_colors.h" |
14 #include "cc/debug/micro_benchmark_impl.h" | 15 #include "cc/debug/micro_benchmark_impl.h" |
15 #include "cc/debug/traced_value.h" | 16 #include "cc/debug/traced_value.h" |
16 #include "cc/layers/append_quads_data.h" | 17 #include "cc/layers/append_quads_data.h" |
17 #include "cc/quads/checkerboard_draw_quad.h" | 18 #include "cc/quads/checkerboard_draw_quad.h" |
18 #include "cc/quads/debug_border_draw_quad.h" | 19 #include "cc/quads/debug_border_draw_quad.h" |
19 #include "cc/quads/picture_draw_quad.h" | 20 #include "cc/quads/picture_draw_quad.h" |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 ideal_source_scale_ = std::max(ideal_source_scale, min_source_scale); | 1329 ideal_source_scale_ = std::max(ideal_source_scale, min_source_scale); |
1329 } | 1330 } |
1330 | 1331 |
1331 void PictureLayerImpl::GetDebugBorderProperties( | 1332 void PictureLayerImpl::GetDebugBorderProperties( |
1332 SkColor* color, | 1333 SkColor* color, |
1333 float* width) const { | 1334 float* width) const { |
1334 *color = DebugColors::TiledContentLayerBorderColor(); | 1335 *color = DebugColors::TiledContentLayerBorderColor(); |
1335 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 1336 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); |
1336 } | 1337 } |
1337 | 1338 |
1338 void PictureLayerImpl::AsValueInto(base::DictionaryValue* state) const { | 1339 void PictureLayerImpl::AsValueInto(base::debug::TracedValue* state) const { |
1339 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1340 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
1340 LayerImpl::AsValueInto(state); | 1341 LayerImpl::AsValueInto(state); |
1341 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 1342 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
1342 state->SetDouble("geometry_contents_scale", MaximumTilingContentsScale()); | 1343 state->SetDouble("geometry_contents_scale", MaximumTilingContentsScale()); |
1343 state->Set("tilings", tilings_->AsValue().release()); | 1344 state->BeginArray("tilings"); |
1344 state->Set("pictures", pile_->AsValue().release()); | 1345 tilings_->AsValueInto(state); |
1345 state->Set("invalidation", invalidation_.AsValue().release()); | 1346 state->EndArray(); |
1346 | 1347 |
1347 scoped_ptr<base::ListValue> coverage_tiles(new base::ListValue); | 1348 state->BeginArray("pictures"); |
| 1349 pile_->AsValueInto(state); |
| 1350 state->EndArray(); |
| 1351 |
| 1352 state->BeginArray("invalidation"); |
| 1353 invalidation_.AsValueInto(state); |
| 1354 state->EndArray(); |
| 1355 |
| 1356 state->BeginArray("coverage_tiles"); |
1348 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(), | 1357 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(), |
1349 contents_scale_x(), | 1358 contents_scale_x(), |
1350 gfx::Rect(content_bounds()), | 1359 gfx::Rect(content_bounds()), |
1351 ideal_contents_scale_); | 1360 ideal_contents_scale_); |
1352 iter; | 1361 iter; |
1353 ++iter) { | 1362 ++iter) { |
1354 scoped_ptr<base::DictionaryValue> tile_data(new base::DictionaryValue); | 1363 state->BeginDictionary(); |
1355 tile_data->Set("geometry_rect", | 1364 |
1356 MathUtil::AsValue(iter.geometry_rect()).release()); | 1365 state->BeginArray("geometry_rect"); |
| 1366 MathUtil::AddToTracedValue(iter.geometry_rect(), state); |
| 1367 state->EndArray(); |
| 1368 |
1357 if (*iter) | 1369 if (*iter) |
1358 tile_data->Set("tile", TracedValue::CreateIDRef(*iter).release()); | 1370 TracedValue::SetIDRef(*iter, state, "tile"); |
1359 | 1371 |
1360 coverage_tiles->Append(tile_data.release()); | 1372 state->EndDictionary(); |
1361 } | 1373 } |
1362 state->Set("coverage_tiles", coverage_tiles.release()); | 1374 state->EndArray(); |
1363 } | 1375 } |
1364 | 1376 |
1365 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { | 1377 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { |
1366 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1378 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
1367 return tilings_->GPUMemoryUsageInBytes(); | 1379 return tilings_->GPUMemoryUsageInBytes(); |
1368 } | 1380 } |
1369 | 1381 |
1370 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1382 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1371 benchmark->RunOnLayer(this); | 1383 benchmark->RunOnLayer(this); |
1372 } | 1384 } |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 return iterator_index_ < iterators_.size(); | 1675 return iterator_index_ < iterators_.size(); |
1664 } | 1676 } |
1665 | 1677 |
1666 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1678 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
1667 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1679 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
1668 return it->get_type() == iteration_stage_ && | 1680 return it->get_type() == iteration_stage_ && |
1669 (**it)->required_for_activation() == required_for_activation_; | 1681 (**it)->required_for_activation() == required_for_activation_; |
1670 } | 1682 } |
1671 | 1683 |
1672 } // namespace cc | 1684 } // namespace cc |
OLD | NEW |