| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "cc/resources/managed_tile_state.h" | |
| 6 | |
| 7 #include <limits> | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/debug/trace_event_argument.h" | |
| 11 #include "cc/base/math_util.h" | |
| 12 | |
| 13 namespace cc { | |
| 14 | |
| 15 ManagedTileState::ManagedTileState() | |
| 16 : resolution(NON_IDEAL_RESOLUTION), | |
| 17 priority_bin(TilePriority::EVENTUALLY), | |
| 18 scheduled_priority(0) { | |
| 19 } | |
| 20 | |
| 21 ManagedTileState::DrawInfo::DrawInfo() | |
| 22 : mode_(RESOURCE_MODE), solid_color_(SK_ColorWHITE) { | |
| 23 } | |
| 24 | |
| 25 ManagedTileState::DrawInfo::~DrawInfo() { | |
| 26 DCHECK(!resource_); | |
| 27 } | |
| 28 | |
| 29 bool ManagedTileState::DrawInfo::IsReadyToDraw() const { | |
| 30 switch (mode_) { | |
| 31 case RESOURCE_MODE: | |
| 32 return !!resource_; | |
| 33 case SOLID_COLOR_MODE: | |
| 34 case PICTURE_PILE_MODE: | |
| 35 return true; | |
| 36 } | |
| 37 NOTREACHED(); | |
| 38 return false; | |
| 39 } | |
| 40 | |
| 41 ManagedTileState::~ManagedTileState() {} | |
| 42 | |
| 43 void ManagedTileState::AsValueInto(base::debug::TracedValue* state) const { | |
| 44 bool has_resource = (draw_info.resource_.get() != 0); | |
| 45 bool has_active_task = (raster_task.get() != 0); | |
| 46 | |
| 47 bool is_using_gpu_memory = has_resource || has_active_task; | |
| 48 | |
| 49 state->SetBoolean("has_resource", has_resource); | |
| 50 state->SetBoolean("is_using_gpu_memory", is_using_gpu_memory); | |
| 51 state->SetString("resolution", TileResolutionToString(resolution)); | |
| 52 state->SetString("priority_bin", TilePriorityBinToString(priority_bin)); | |
| 53 state->SetBoolean("is_solid_color", | |
| 54 draw_info.mode_ == DrawInfo::SOLID_COLOR_MODE); | |
| 55 state->SetBoolean("is_transparent", | |
| 56 draw_info.mode_ == DrawInfo::SOLID_COLOR_MODE && | |
| 57 !SkColorGetA(draw_info.solid_color_)); | |
| 58 state->SetInteger("scheduled_priority", scheduled_priority); | |
| 59 } | |
| 60 | |
| 61 } // namespace cc | |
| OLD | NEW |