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 15 matching lines...) Expand all Loading... |
26 "EVENTUALLY_AND_ACTIVE_BIN")); | 26 "EVENTUALLY_AND_ACTIVE_BIN")); |
27 case EVENTUALLY_BIN: | 27 case EVENTUALLY_BIN: |
28 return scoped_ptr<base::Value>(base::Value::CreateStringValue( | 28 return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
29 "EVENTUALLY_BIN")); | 29 "EVENTUALLY_BIN")); |
30 case NEVER_AND_ACTIVE_BIN: | 30 case NEVER_AND_ACTIVE_BIN: |
31 return scoped_ptr<base::Value>(base::Value::CreateStringValue( | 31 return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
32 "NEVER_AND_ACTIVE_BIN")); | 32 "NEVER_AND_ACTIVE_BIN")); |
33 case NEVER_BIN: | 33 case NEVER_BIN: |
34 return scoped_ptr<base::Value>(base::Value::CreateStringValue( | 34 return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
35 "NEVER_BIN")); | 35 "NEVER_BIN")); |
36 default: | |
37 DCHECK(false) << "Unrecognized ManagedTileBin value " << bin; | |
38 return scoped_ptr<base::Value>(base::Value::CreateStringValue( | |
39 "<unknown ManagedTileBin value>")); | |
40 } | 36 } |
| 37 DCHECK(false) << "Unrecognized ManagedTileBin value " << bin; |
| 38 return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
| 39 "<unknown ManagedTileBin value>")); |
41 } | 40 } |
42 | 41 |
43 scoped_ptr<base::Value> ManagedTileBinPriorityAsValue( | 42 scoped_ptr<base::Value> ManagedTileBinPriorityAsValue( |
44 ManagedTileBinPriority bin_priority) { | 43 ManagedTileBinPriority bin_priority) { |
45 switch (bin_priority) { | 44 switch (bin_priority) { |
46 case HIGH_PRIORITY_BIN: | 45 case HIGH_PRIORITY_BIN: |
47 return scoped_ptr<base::Value>(base::Value::CreateStringValue( | 46 return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
48 "HIGH_PRIORITY_BIN")); | 47 "HIGH_PRIORITY_BIN")); |
49 case LOW_PRIORITY_BIN: | 48 case LOW_PRIORITY_BIN: |
50 return scoped_ptr<base::Value>(base::Value::CreateStringValue( | 49 return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
51 "LOW_PRIORITY_BIN")); | 50 "LOW_PRIORITY_BIN")); |
52 default: | |
53 DCHECK(false) << "Unrecognized ManagedTileBinPriority value"; | |
54 return scoped_ptr<base::Value>(base::Value::CreateStringValue( | |
55 "<unknown ManagedTileBinPriority value>")); | |
56 } | 51 } |
| 52 DCHECK(false) << "Unrecognized ManagedTileBinPriority value"; |
| 53 return scoped_ptr<base::Value>(base::Value::CreateStringValue( |
| 54 "<unknown ManagedTileBinPriority value>")); |
57 } | 55 } |
58 | 56 |
59 ManagedTileState::ManagedTileState() | 57 ManagedTileState::ManagedTileState() |
60 : raster_mode(LOW_QUALITY_RASTER_MODE), | 58 : raster_mode(LOW_QUALITY_RASTER_MODE), |
61 gpu_memmgr_stats_bin(NEVER_BIN), | 59 gpu_memmgr_stats_bin(NEVER_BIN), |
62 resolution(NON_IDEAL_RESOLUTION), | 60 resolution(NON_IDEAL_RESOLUTION), |
63 required_for_activation(false), | 61 required_for_activation(false), |
64 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), | 62 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), |
65 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()), | 63 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()), |
66 visible_and_ready_to_draw(false), | 64 visible_and_ready_to_draw(false), |
67 scheduled_priority(0) { | 65 scheduled_priority(0) { |
68 for (int i = 0; i < NUM_TREES; ++i) { | 66 for (int i = 0; i < ManagedTileBinPriority_ARRAYSIZE; ++i) |
| 67 bin[i] = NEVER_BIN; |
| 68 for (int i = 0; i < WhichTree_ARRAYSIZE; ++i) |
69 tree_bin[i] = NEVER_BIN; | 69 tree_bin[i] = NEVER_BIN; |
70 bin[i] = NEVER_BIN; | |
71 } | |
72 } | 70 } |
73 | 71 |
74 ManagedTileState::TileVersion::TileVersion() | 72 ManagedTileState::TileVersion::TileVersion() |
75 : mode_(RESOURCE_MODE), | 73 : mode_(RESOURCE_MODE), |
76 has_text_(false) { | 74 has_text_(false) { |
77 } | 75 } |
78 | 76 |
79 ManagedTileState::TileVersion::~TileVersion() { | 77 ManagedTileState::TileVersion::~TileVersion() { |
80 DCHECK(!resource_); | 78 DCHECK(!resource_); |
81 } | 79 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 state->SetBoolean( | 119 state->SetBoolean( |
122 "is_transparent", | 120 "is_transparent", |
123 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && | 121 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && |
124 !SkColorGetA(tile_versions[raster_mode].solid_color_)); | 122 !SkColorGetA(tile_versions[raster_mode].solid_color_)); |
125 state->SetInteger("scheduled_priority", scheduled_priority); | 123 state->SetInteger("scheduled_priority", scheduled_priority); |
126 return state.PassAs<base::Value>(); | 124 return state.PassAs<base::Value>(); |
127 } | 125 } |
128 | 126 |
129 } // namespace cc | 127 } // namespace cc |
130 | 128 |
OLD | NEW |