| 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 scoped_ptr<base::Value> ManagedTileBinAsValue(ManagedTileBin bin) { | 13 scoped_ptr<base::Value> ManagedTileBinAsValue(ManagedTileBin bin) { |
| 14 switch (bin) { | 14 switch (bin) { |
| 15 case NOW_AND_READY_TO_DRAW_BIN: | 15 case NOW_AND_READY_TO_DRAW_BIN: |
| 16 return scoped_ptr<base::Value>( | 16 return scoped_ptr<base::Value>( |
| 17 base::Value::CreateStringValue("NOW_AND_READY_TO_DRAW_BIN")); | 17 new base::StringValue("NOW_AND_READY_TO_DRAW_BIN")); |
| 18 case NOW_BIN: | 18 case NOW_BIN: |
| 19 return scoped_ptr<base::Value>(base::Value::CreateStringValue("NOW_BIN")); | 19 return scoped_ptr<base::Value>(new base::StringValue("NOW_BIN")); |
| 20 case SOON_BIN: | 20 case SOON_BIN: |
| 21 return scoped_ptr<base::Value>( | 21 return scoped_ptr<base::Value>( |
| 22 base::Value::CreateStringValue("SOON_BIN")); | 22 new base::StringValue("SOON_BIN")); |
| 23 case EVENTUALLY_AND_ACTIVE_BIN: | 23 case EVENTUALLY_AND_ACTIVE_BIN: |
| 24 return scoped_ptr<base::Value>( | 24 return scoped_ptr<base::Value>( |
| 25 base::Value::CreateStringValue("EVENTUALLY_AND_ACTIVE_BIN")); | 25 new base::StringValue("EVENTUALLY_AND_ACTIVE_BIN")); |
| 26 case EVENTUALLY_BIN: | 26 case EVENTUALLY_BIN: |
| 27 return scoped_ptr<base::Value>( | 27 return scoped_ptr<base::Value>( |
| 28 base::Value::CreateStringValue("EVENTUALLY_BIN")); | 28 new base::StringValue("EVENTUALLY_BIN")); |
| 29 case AT_LAST_AND_ACTIVE_BIN: | 29 case AT_LAST_AND_ACTIVE_BIN: |
| 30 return scoped_ptr<base::Value>( | 30 return scoped_ptr<base::Value>( |
| 31 base::Value::CreateStringValue("AT_LAST_AND_ACTIVE_BIN")); | 31 new base::StringValue("AT_LAST_AND_ACTIVE_BIN")); |
| 32 case AT_LAST_BIN: | 32 case AT_LAST_BIN: |
| 33 return scoped_ptr<base::Value>( | 33 return scoped_ptr<base::Value>( |
| 34 base::Value::CreateStringValue("AT_LAST_BIN")); | 34 new base::StringValue("AT_LAST_BIN")); |
| 35 case NEVER_BIN: | 35 case NEVER_BIN: |
| 36 return scoped_ptr<base::Value>( | 36 return scoped_ptr<base::Value>( |
| 37 base::Value::CreateStringValue("NEVER_BIN")); | 37 new base::StringValue("NEVER_BIN")); |
| 38 case NUM_BINS: | 38 case NUM_BINS: |
| 39 NOTREACHED(); | 39 NOTREACHED(); |
| 40 return scoped_ptr<base::Value>( | 40 return scoped_ptr<base::Value>( |
| 41 base::Value::CreateStringValue("Invalid Bin (NUM_BINS)")); | 41 new base::StringValue("Invalid Bin (NUM_BINS)")); |
| 42 } | 42 } |
| 43 return scoped_ptr<base::Value>( | 43 return scoped_ptr<base::Value>( |
| 44 base::Value::CreateStringValue("Invalid Bin (UNKNOWN)")); | 44 new base::StringValue("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 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), |
| 53 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()), | 53 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()), |
| 54 visible_and_ready_to_draw(false), | 54 visible_and_ready_to_draw(false), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE); | 104 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE); |
| 105 state->SetBoolean( | 105 state->SetBoolean( |
| 106 "is_transparent", | 106 "is_transparent", |
| 107 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && | 107 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && |
| 108 !SkColorGetA(tile_versions[raster_mode].solid_color_)); | 108 !SkColorGetA(tile_versions[raster_mode].solid_color_)); |
| 109 state->SetInteger("scheduled_priority", scheduled_priority); | 109 state->SetInteger("scheduled_priority", scheduled_priority); |
| 110 return state.PassAs<base::Value>(); | 110 return state.PassAs<base::Value>(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace cc | 113 } // namespace cc |
| OLD | NEW |