| 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 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), | 42 time_to_needed_in_seconds(std::numeric_limits<float>::infinity()), |
| 43 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()) { | 43 distance_to_visible_in_pixels(std::numeric_limits<float>::infinity()) { |
| 44 for (int i = 0; i < NUM_TREES; ++i) { | 44 for (int i = 0; i < NUM_TREES; ++i) { |
| 45 tree_bin[i] = NEVER_BIN; | 45 tree_bin[i] = NEVER_BIN; |
| 46 bin[i] = NEVER_BIN; | 46 bin[i] = NEVER_BIN; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 ManagedTileState::TileVersion::TileVersion() | 50 ManagedTileState::TileVersion::TileVersion() |
| 51 : mode_(RESOURCE_MODE), | 51 : mode_(RESOURCE_MODE), |
| 52 resource_id_(0), |
| 52 resource_format_(GL_RGBA), | 53 resource_format_(GL_RGBA), |
| 53 memory_state_(NOT_ALLOWED_TO_USE_MEMORY), | 54 memory_state_(NOT_ALLOWED_TO_USE_MEMORY), |
| 54 forced_upload_(false) { | 55 forced_upload_(false) { |
| 55 } | 56 } |
| 56 | 57 |
| 57 ManagedTileState::TileVersion::~TileVersion() { | 58 ManagedTileState::TileVersion::~TileVersion() { |
| 58 DCHECK(!resource_); | 59 DCHECK(!resource_); |
| 59 DCHECK(memory_state_ == NOT_ALLOWED_TO_USE_MEMORY); | 60 DCHECK(memory_state_ == NOT_ALLOWED_TO_USE_MEMORY); |
| 60 } | 61 } |
| 61 | 62 |
| 62 bool ManagedTileState::TileVersion::IsReadyToDraw() const { | 63 bool ManagedTileState::TileVersion::IsReadyToDraw() const { |
| 63 switch (mode_) { | 64 switch (mode_) { |
| 64 case RESOURCE_MODE: | 65 case RESOURCE_MODE: |
| 65 return resource_ && | 66 return resource_id_ && |
| 66 (memory_state_ == USING_RELEASABLE_MEMORY || | 67 (memory_state_ == USING_RELEASABLE_MEMORY || |
| 67 (memory_state_ == USING_UNRELEASABLE_MEMORY && forced_upload_)) && | 68 (memory_state_ == USING_UNRELEASABLE_MEMORY && forced_upload_)); |
| 68 resource_->id(); | |
| 69 case SOLID_COLOR_MODE: | 69 case SOLID_COLOR_MODE: |
| 70 case PICTURE_PILE_MODE: | 70 case PICTURE_PILE_MODE: |
| 71 return true; | 71 return true; |
| 72 default: | 72 default: |
| 73 NOTREACHED(); | 73 NOTREACHED(); |
| 74 return false; | 74 return false; |
| 75 } | 75 } |
| 76 } | 76 } |
| 77 | 77 |
| 78 size_t ManagedTileState::TileVersion::GPUMemoryUsageInBytes() const { | 78 size_t ManagedTileState::TileVersion::GPUMemoryUsageInBytes() const { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 102 state->SetBoolean("is_picture_pile_analyzed", picture_pile_analyzed); | 102 state->SetBoolean("is_picture_pile_analyzed", picture_pile_analyzed); |
| 103 state->SetBoolean("is_solid_color", picture_pile_analysis.is_solid_color); | 103 state->SetBoolean("is_solid_color", picture_pile_analysis.is_solid_color); |
| 104 state->SetBoolean("is_transparent", | 104 state->SetBoolean("is_transparent", |
| 105 picture_pile_analysis.is_solid_color && | 105 picture_pile_analysis.is_solid_color && |
| 106 !SkColorGetA(picture_pile_analysis.solid_color)); | 106 !SkColorGetA(picture_pile_analysis.solid_color)); |
| 107 return state.PassAs<base::Value>(); | 107 return state.PassAs<base::Value>(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace cc | 110 } // namespace cc |
| 111 | 111 |
| OLD | NEW |