Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/managed_tile_state.h" | 5 #include "cc/resources/managed_tile_state.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 ManagedTileState::ManagedTileState() | 13 ManagedTileState::ManagedTileState() |
| 14 : picture_pile_analyzed(false), | 14 : raster_mode(static_cast<TileRasterMode>(0)), |
|
reveman
2013/06/06 06:02:02
raster_mode(LOW_QUALITY_RASTER_MODE) ?
vmpstr
2013/06/06 15:20:22
Done.
| |
| 15 picture_pile_analyzed(false), | |
| 15 gpu_memmgr_stats_bin(NEVER_BIN), | 16 gpu_memmgr_stats_bin(NEVER_BIN), |
| 16 resolution(NON_IDEAL_RESOLUTION), | 17 resolution(NON_IDEAL_RESOLUTION), |
| 17 required_for_activation(false), | 18 required_for_activation(false), |
| 18 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), | 19 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), |
| 19 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()) { | 20 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()) { |
| 20 for (int i = 0; i < NUM_TREES; ++i) { | 21 for (int i = 0; i < NUM_TREES; ++i) { |
| 21 tree_bin[i] = NEVER_BIN; | 22 tree_bin[i] = NEVER_BIN; |
| 22 bin[i] = NEVER_BIN; | 23 bin[i] = NEVER_BIN; |
| 23 } | 24 } |
| 24 } | 25 } |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 51 if (!resource_) | 52 if (!resource_) |
| 52 return 0; | 53 return 0; |
| 53 return resource_->bytes(); | 54 return resource_->bytes(); |
| 54 } | 55 } |
| 55 | 56 |
| 56 ManagedTileState::~ManagedTileState() { | 57 ManagedTileState::~ManagedTileState() { |
| 57 } | 58 } |
| 58 | 59 |
| 59 scoped_ptr<base::Value> ManagedTileState::AsValue() const { | 60 scoped_ptr<base::Value> ManagedTileState::AsValue() const { |
| 60 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 61 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 61 state->SetBoolean("has_resource", tile_version.resource_.get() != 0); | 62 state->SetBoolean("has_resource", |
| 63 tile_versions[raster_mode].resource_.get() != 0); | |
| 62 state->Set("bin.0", TileManagerBinAsValue(bin[ACTIVE_TREE]).release()); | 64 state->Set("bin.0", TileManagerBinAsValue(bin[ACTIVE_TREE]).release()); |
| 63 state->Set("bin.1", TileManagerBinAsValue(bin[PENDING_TREE]).release()); | 65 state->Set("bin.1", TileManagerBinAsValue(bin[PENDING_TREE]).release()); |
| 64 state->Set("gpu_memmgr_stats_bin", | 66 state->Set("gpu_memmgr_stats_bin", |
| 65 TileManagerBinAsValue(bin[ACTIVE_TREE]).release()); | 67 TileManagerBinAsValue(bin[ACTIVE_TREE]).release()); |
| 66 state->Set("resolution", TileResolutionAsValue(resolution).release()); | 68 state->Set("resolution", TileResolutionAsValue(resolution).release()); |
| 67 state->Set("time_to_needed_in_seconds", | 69 state->Set("time_to_needed_in_seconds", |
| 68 MathUtil::AsValueSafely(time_to_needed_in_seconds).release()); | 70 MathUtil::AsValueSafely(time_to_needed_in_seconds).release()); |
| 69 state->Set("distance_to_visible_in_pixels", | 71 state->Set("distance_to_visible_in_pixels", |
| 70 MathUtil::AsValueSafely(distance_to_visible_in_pixels).release()); | 72 MathUtil::AsValueSafely(distance_to_visible_in_pixels).release()); |
| 71 state->SetBoolean("required_for_activation", required_for_activation); | 73 state->SetBoolean("required_for_activation", required_for_activation); |
| 72 state->SetBoolean("is_picture_pile_analyzed", picture_pile_analyzed); | 74 state->SetBoolean("is_picture_pile_analyzed", picture_pile_analyzed); |
| 73 state->SetBoolean("is_solid_color", picture_pile_analysis.is_solid_color); | 75 state->SetBoolean("is_solid_color", picture_pile_analysis.is_solid_color); |
| 74 state->SetBoolean("is_transparent", | 76 state->SetBoolean("is_transparent", |
| 75 picture_pile_analysis.is_solid_color && | 77 picture_pile_analysis.is_solid_color && |
| 76 !SkColorGetA(picture_pile_analysis.solid_color)); | 78 !SkColorGetA(picture_pile_analysis.solid_color)); |
| 77 return state.PassAs<base::Value>(); | 79 return state.PassAs<base::Value>(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 } // namespace cc | 82 } // namespace cc |
| 81 | 83 |
| OLD | NEW |