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 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 ideal_source_scale_ = std::max(ideal_source_scale, min_source_scale); | 1322 ideal_source_scale_ = std::max(ideal_source_scale, min_source_scale); |
1322 } | 1323 } |
1323 | 1324 |
1324 void PictureLayerImpl::GetDebugBorderProperties( | 1325 void PictureLayerImpl::GetDebugBorderProperties( |
1325 SkColor* color, | 1326 SkColor* color, |
1326 float* width) const { | 1327 float* width) const { |
1327 *color = DebugColors::TiledContentLayerBorderColor(); | 1328 *color = DebugColors::TiledContentLayerBorderColor(); |
1328 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 1329 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); |
1329 } | 1330 } |
1330 | 1331 |
1331 void PictureLayerImpl::AsValueInto(base::DictionaryValue* state) const { | 1332 void PictureLayerImpl::AsValueInto(base::debug::TracedValue* state) const { |
1332 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1333 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
1333 LayerImpl::AsValueInto(state); | 1334 LayerImpl::AsValueInto(state); |
1334 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 1335 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
1335 state->SetDouble("geometry_contents_scale", MaximumTilingContentsScale()); | 1336 state->SetDouble("geometry_contents_scale", MaximumTilingContentsScale()); |
1336 state->Set("tilings", tilings_->AsValue().release()); | 1337 state->BeginArray("tilings"); |
1337 state->Set("pictures", pile_->AsValue().release()); | 1338 tilings_->AsValueInto(state); |
1338 state->Set("invalidation", invalidation_.AsValue().release()); | 1339 state->EndArray(); |
1339 | 1340 |
1340 scoped_ptr<base::ListValue> coverage_tiles(new base::ListValue); | 1341 state->BeginArray("pictures"); |
| 1342 pile_->AsValueInto(state); |
| 1343 state->EndArray(); |
| 1344 |
| 1345 state->BeginArray("invalidation"); |
| 1346 invalidation_.AsValueInto(state); |
| 1347 state->EndArray(); |
| 1348 |
| 1349 state->BeginArray("coverage_tiles"); |
1341 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(), | 1350 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(), |
1342 contents_scale_x(), | 1351 contents_scale_x(), |
1343 gfx::Rect(content_bounds()), | 1352 gfx::Rect(content_bounds()), |
1344 ideal_contents_scale_); | 1353 ideal_contents_scale_); |
1345 iter; | 1354 iter; |
1346 ++iter) { | 1355 ++iter) { |
1347 scoped_ptr<base::DictionaryValue> tile_data(new base::DictionaryValue); | 1356 state->BeginDictionary(); |
1348 tile_data->Set("geometry_rect", | 1357 |
1349 MathUtil::AsValue(iter.geometry_rect()).release()); | 1358 state->BeginArray("geometry_rect"); |
| 1359 MathUtil::AddToTracedValue(iter.geometry_rect(), state); |
| 1360 state->EndArray(); |
| 1361 |
1350 if (*iter) | 1362 if (*iter) |
1351 tile_data->Set("tile", TracedValue::CreateIDRef(*iter).release()); | 1363 TracedValue::SetIDRef(*iter, state, "tile"); |
1352 | 1364 |
1353 coverage_tiles->Append(tile_data.release()); | 1365 state->EndDictionary(); |
1354 } | 1366 } |
1355 state->Set("coverage_tiles", coverage_tiles.release()); | 1367 state->EndArray(); |
1356 } | 1368 } |
1357 | 1369 |
1358 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { | 1370 size_t PictureLayerImpl::GPUMemoryUsageInBytes() const { |
1359 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1371 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
1360 return tilings_->GPUMemoryUsageInBytes(); | 1372 return tilings_->GPUMemoryUsageInBytes(); |
1361 } | 1373 } |
1362 | 1374 |
1363 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1375 void PictureLayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1364 benchmark->RunOnLayer(this); | 1376 benchmark->RunOnLayer(this); |
1365 } | 1377 } |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 return iterator_index_ < iterators_.size(); | 1678 return iterator_index_ < iterators_.size(); |
1667 } | 1679 } |
1668 | 1680 |
1669 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1681 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
1670 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1682 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
1671 return it->get_type() == iteration_stage_ && | 1683 return it->get_type() == iteration_stage_ && |
1672 (**it)->required_for_activation() == required_for_activation_; | 1684 (**it)->required_for_activation() == required_for_activation_; |
1673 } | 1685 } |
1674 | 1686 |
1675 } // namespace cc | 1687 } // namespace cc |
OLD | NEW |