| 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 return scoped_ptr<base::Value>( | 43 return scoped_ptr<base::Value>( |
| 44 base::Value::CreateStringValue("Invalid Bin (UNKNOWN)")); | 44 base::Value::CreateStringValue("Invalid Bin (UNKNOWN)")); |
| 45 } | 45 } |
| 46 | 46 |
| 47 ManagedTileState::ManagedTileState() | 47 ManagedTileState::ManagedTileState() |
| 48 : raster_mode(LOW_QUALITY_RASTER_MODE), | 48 : raster_mode(LOW_QUALITY_RASTER_MODE), |
| 49 bin(NEVER_BIN), | 49 bin(NEVER_BIN), |
| 50 resolution(NON_IDEAL_RESOLUTION), | 50 resolution(NON_IDEAL_RESOLUTION), |
| 51 required_for_activation(false), | 51 required_for_activation(false), |
| 52 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), | 52 priority_bin(TilePriority::EVENTUALLY), |
| 53 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()), | 53 distance_to_visible(std::numeric_limits<float>::infinity()), |
| 54 visible_and_ready_to_draw(false), | 54 visible_and_ready_to_draw(false), |
| 55 scheduled_priority(0) {} | 55 scheduled_priority(0) {} |
| 56 | 56 |
| 57 ManagedTileState::TileVersion::TileVersion() | 57 ManagedTileState::TileVersion::TileVersion() |
| 58 : mode_(RESOURCE_MODE), has_text_(false) {} | 58 : mode_(RESOURCE_MODE), has_text_(false) {} |
| 59 | 59 |
| 60 ManagedTileState::TileVersion::~TileVersion() { DCHECK(!resource_); } | 60 ManagedTileState::TileVersion::~TileVersion() { DCHECK(!resource_); } |
| 61 | 61 |
| 62 bool ManagedTileState::TileVersion::IsReadyToDraw() const { | 62 bool ManagedTileState::TileVersion::IsReadyToDraw() const { |
| 63 switch (mode_) { | 63 switch (mode_) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 87 has_active_task |= !tile_versions[mode].raster_task_.is_null(); | 87 has_active_task |= !tile_versions[mode].raster_task_.is_null(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool is_using_gpu_memory = has_resource || has_active_task; | 90 bool is_using_gpu_memory = has_resource || has_active_task; |
| 91 | 91 |
| 92 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 92 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 93 state->SetBoolean("has_resource", has_resource); | 93 state->SetBoolean("has_resource", has_resource); |
| 94 state->SetBoolean("is_using_gpu_memory", is_using_gpu_memory); | 94 state->SetBoolean("is_using_gpu_memory", is_using_gpu_memory); |
| 95 state->Set("bin", ManagedTileBinAsValue(bin).release()); | 95 state->Set("bin", ManagedTileBinAsValue(bin).release()); |
| 96 state->Set("resolution", TileResolutionAsValue(resolution).release()); | 96 state->Set("resolution", TileResolutionAsValue(resolution).release()); |
| 97 state->Set("time_to_needed_in_seconds", | 97 state->Set("priority_bin", TilePriorityBinAsValue(priority_bin).release()); |
| 98 MathUtil::AsValueSafely(time_to_needed_in_seconds).release()); | 98 state->Set("distance_to_visible", |
| 99 state->Set("distance_to_visible_in_pixels", | 99 MathUtil::AsValueSafely(distance_to_visible).release()); |
| 100 MathUtil::AsValueSafely(distance_to_visible_in_pixels).release()); | |
| 101 state->SetBoolean("required_for_activation", required_for_activation); | 100 state->SetBoolean("required_for_activation", required_for_activation); |
| 102 state->SetBoolean( | 101 state->SetBoolean( |
| 103 "is_solid_color", | 102 "is_solid_color", |
| 104 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE); | 103 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE); |
| 105 state->SetBoolean( | 104 state->SetBoolean( |
| 106 "is_transparent", | 105 "is_transparent", |
| 107 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && | 106 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && |
| 108 !SkColorGetA(tile_versions[raster_mode].solid_color_)); | 107 !SkColorGetA(tile_versions[raster_mode].solid_color_)); |
| 109 state->SetInteger("scheduled_priority", scheduled_priority); | 108 state->SetInteger("scheduled_priority", scheduled_priority); |
| 110 return state.PassAs<base::Value>(); | 109 return state.PassAs<base::Value>(); |
| 111 } | 110 } |
| 112 | 111 |
| 113 } // namespace cc | 112 } // namespace cc |
| OLD | NEW |