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