Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Side by Side Diff: cc/resources/managed_tile_state.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/managed_tile_state.h ('k') | cc/resources/picture.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <string> 8 #include <string>
9 9
10 #include "base/debug/trace_event_argument.h" 10 #include "base/debug/trace_event_argument.h"
11 #include "cc/base/math_util.h" 11 #include "cc/base/math_util.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 std::string ManagedTileBinToString(ManagedTileBin bin) {
16 switch (bin) {
17 case NOW_AND_READY_TO_DRAW_BIN:
18 return "NOW_AND_READY_TO_DRAW_BIN";
19 case NOW_BIN:
20 return "NOW_BIN";
21 case SOON_BIN:
22 return "SOON_BIN";
23 case EVENTUALLY_AND_ACTIVE_BIN:
24 return "EVENTUALLY_AND_ACTIVE_BIN";
25 case EVENTUALLY_BIN:
26 return "EVENTUALLY_BIN";
27 case AT_LAST_AND_ACTIVE_BIN:
28 return "AT_LAST_AND_ACTIVE_BIN";
29 case AT_LAST_BIN:
30 return "AT_LAST_BIN";
31 case NEVER_BIN:
32 return "NEVER_BIN";
33 case NUM_BINS:
34 NOTREACHED();
35 return "Invalid Bin (NUM_BINS)";
36 }
37 return "Invalid Bin (UNKNOWN)";
38 }
39
40 ManagedTileState::ManagedTileState() 15 ManagedTileState::ManagedTileState()
41 : bin(NEVER_BIN), 16 : resolution(NON_IDEAL_RESOLUTION),
42 resolution(NON_IDEAL_RESOLUTION),
43 required_for_activation(false),
44 priority_bin(TilePriority::EVENTUALLY), 17 priority_bin(TilePriority::EVENTUALLY),
45 distance_to_visible(std::numeric_limits<float>::infinity()),
46 visible_and_ready_to_draw(false),
47 scheduled_priority(0) { 18 scheduled_priority(0) {
48 } 19 }
49 20
50 ManagedTileState::DrawInfo::DrawInfo() 21 ManagedTileState::DrawInfo::DrawInfo()
51 : mode_(RESOURCE_MODE), solid_color_(SK_ColorWHITE) { 22 : mode_(RESOURCE_MODE), solid_color_(SK_ColorWHITE) {
52 } 23 }
53 24
54 ManagedTileState::DrawInfo::~DrawInfo() { 25 ManagedTileState::DrawInfo::~DrawInfo() {
55 DCHECK(!resource_); 26 DCHECK(!resource_);
56 } 27 }
(...skipping 13 matching lines...) Expand all
70 ManagedTileState::~ManagedTileState() {} 41 ManagedTileState::~ManagedTileState() {}
71 42
72 void ManagedTileState::AsValueInto(base::debug::TracedValue* state) const { 43 void ManagedTileState::AsValueInto(base::debug::TracedValue* state) const {
73 bool has_resource = (draw_info.resource_.get() != 0); 44 bool has_resource = (draw_info.resource_.get() != 0);
74 bool has_active_task = (raster_task.get() != 0); 45 bool has_active_task = (raster_task.get() != 0);
75 46
76 bool is_using_gpu_memory = has_resource || has_active_task; 47 bool is_using_gpu_memory = has_resource || has_active_task;
77 48
78 state->SetBoolean("has_resource", has_resource); 49 state->SetBoolean("has_resource", has_resource);
79 state->SetBoolean("is_using_gpu_memory", is_using_gpu_memory); 50 state->SetBoolean("is_using_gpu_memory", is_using_gpu_memory);
80 state->SetString("bin", ManagedTileBinToString(bin));
81 state->SetString("resolution", TileResolutionToString(resolution)); 51 state->SetString("resolution", TileResolutionToString(resolution));
82 state->SetString("priority_bin", TilePriorityBinToString(priority_bin)); 52 state->SetString("priority_bin", TilePriorityBinToString(priority_bin));
83 state->SetDouble("distance_to_visible",
84 MathUtil::AsFloatSafely(distance_to_visible));
85 state->SetBoolean("required_for_activation", required_for_activation);
86 state->SetBoolean("is_solid_color", 53 state->SetBoolean("is_solid_color",
87 draw_info.mode_ == DrawInfo::SOLID_COLOR_MODE); 54 draw_info.mode_ == DrawInfo::SOLID_COLOR_MODE);
88 state->SetBoolean("is_transparent", 55 state->SetBoolean("is_transparent",
89 draw_info.mode_ == DrawInfo::SOLID_COLOR_MODE && 56 draw_info.mode_ == DrawInfo::SOLID_COLOR_MODE &&
90 !SkColorGetA(draw_info.solid_color_)); 57 !SkColorGetA(draw_info.solid_color_));
91 state->SetInteger("scheduled_priority", scheduled_priority); 58 state->SetInteger("scheduled_priority", scheduled_priority);
92 } 59 }
93 60
94 } // namespace cc 61 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/managed_tile_state.h ('k') | cc/resources/picture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698