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.
5 #include "cc/resources/managed_tile_state.h"
10 #include "base/debug/trace_event_argument.h"
11 #include "cc/base/math_util.h"
15 ManagedTileState::ManagedTileState()
16 : resolution(NON_IDEAL_RESOLUTION
),
17 priority_bin(TilePriority::EVENTUALLY
),
18 scheduled_priority(0) {
21 ManagedTileState::DrawInfo::DrawInfo()
22 : mode_(RESOURCE_MODE
), solid_color_(SK_ColorWHITE
) {
25 ManagedTileState::DrawInfo::~DrawInfo() {
29 bool ManagedTileState::DrawInfo::IsReadyToDraw() const {
33 case SOLID_COLOR_MODE
:
34 case PICTURE_PILE_MODE
:
41 ManagedTileState::~ManagedTileState() {}
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);
47 bool is_using_gpu_memory
= has_resource
|| has_active_task
;
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
);