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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 ManagedTileState::ManagedTileState() | 48 ManagedTileState::ManagedTileState() |
49 : raster_mode(LOW_QUALITY_RASTER_MODE), | 49 : raster_mode(LOW_QUALITY_RASTER_MODE), |
50 bin(NEVER_BIN), | 50 bin(NEVER_BIN), |
51 resolution(NON_IDEAL_RESOLUTION), | 51 resolution(NON_IDEAL_RESOLUTION), |
52 required_for_activation(false), | 52 required_for_activation(false), |
53 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), | 53 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), |
54 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()), | 54 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()), |
55 visible_and_ready_to_draw(false), | 55 visible_and_ready_to_draw(false), |
56 scheduled_priority(0) { | 56 scheduled_priority(0) { |
57 for (int i = 0; i < NUM_TREES; ++i) | |
58 tree_bin[i] = NEVER_BIN; | |
59 } | 57 } |
60 | 58 |
61 ManagedTileState::TileVersion::TileVersion() | 59 ManagedTileState::TileVersion::TileVersion() |
62 : mode_(RESOURCE_MODE), | 60 : mode_(RESOURCE_MODE), |
63 has_text_(false) { | 61 has_text_(false) { |
64 } | 62 } |
65 | 63 |
66 ManagedTileState::TileVersion::~TileVersion() { | 64 ManagedTileState::TileVersion::~TileVersion() { |
67 DCHECK(!resource_); | 65 DCHECK(!resource_); |
68 } | 66 } |
(...skipping 25 matching lines...) Expand all Loading... |
94 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { | 92 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { |
95 has_resource |= (tile_versions[mode].resource_.get() != 0); | 93 has_resource |= (tile_versions[mode].resource_.get() != 0); |
96 has_active_task |= !tile_versions[mode].raster_task_.is_null(); | 94 has_active_task |= !tile_versions[mode].raster_task_.is_null(); |
97 } | 95 } |
98 | 96 |
99 bool is_using_gpu_memory = has_resource || has_active_task; | 97 bool is_using_gpu_memory = has_resource || has_active_task; |
100 | 98 |
101 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 99 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
102 state->SetBoolean("has_resource", has_resource); | 100 state->SetBoolean("has_resource", has_resource); |
103 state->SetBoolean("is_using_gpu_memory", is_using_gpu_memory); | 101 state->SetBoolean("is_using_gpu_memory", is_using_gpu_memory); |
104 state->Set("tree_bin.0", | 102 state->Set("bin", ManagedTileBinAsValue(bin).release()); |
105 ManagedTileBinAsValue(tree_bin[ACTIVE_TREE]).release()); | |
106 state->Set("tree_bin.1", | |
107 ManagedTileBinAsValue(tree_bin[PENDING_TREE]).release()); | |
108 state->Set("resolution", TileResolutionAsValue(resolution).release()); | 103 state->Set("resolution", TileResolutionAsValue(resolution).release()); |
109 state->Set("time_to_needed_in_seconds", | 104 state->Set("time_to_needed_in_seconds", |
110 MathUtil::AsValueSafely(time_to_needed_in_seconds).release()); | 105 MathUtil::AsValueSafely(time_to_needed_in_seconds).release()); |
111 state->Set("distance_to_visible_in_pixels", | 106 state->Set("distance_to_visible_in_pixels", |
112 MathUtil::AsValueSafely(distance_to_visible_in_pixels).release()); | 107 MathUtil::AsValueSafely(distance_to_visible_in_pixels).release()); |
113 state->SetBoolean("required_for_activation", required_for_activation); | 108 state->SetBoolean("required_for_activation", required_for_activation); |
114 state->SetBoolean( | 109 state->SetBoolean( |
115 "is_solid_color", | 110 "is_solid_color", |
116 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE); | 111 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE); |
117 state->SetBoolean( | 112 state->SetBoolean( |
118 "is_transparent", | 113 "is_transparent", |
119 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && | 114 tile_versions[raster_mode].mode_ == TileVersion::SOLID_COLOR_MODE && |
120 !SkColorGetA(tile_versions[raster_mode].solid_color_)); | 115 !SkColorGetA(tile_versions[raster_mode].solid_color_)); |
121 state->SetInteger("scheduled_priority", scheduled_priority); | 116 state->SetInteger("scheduled_priority", scheduled_priority); |
122 return state.PassAs<base::Value>(); | 117 return state.PassAs<base::Value>(); |
123 } | 118 } |
124 | 119 |
125 } // namespace cc | 120 } // namespace cc |
126 | |
OLD | NEW |