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

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

Issue 421183003: Revert of Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/tile_priority.h ('k') | cc/scheduler/delay_based_time_source.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/tile_priority.h" 5 #include "cc/resources/tile_priority.h"
6 6
7 #include "base/debug/trace_event_argument.h"
8 #include "base/values.h" 7 #include "base/values.h"
9 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
10 9
11 namespace cc { 10 namespace cc {
12 11
13 std::string WhichTreeToString(WhichTree tree) { 12 scoped_ptr<base::Value> WhichTreeAsValue(WhichTree tree) {
14 switch (tree) { 13 switch (tree) {
15 case ACTIVE_TREE: 14 case ACTIVE_TREE:
16 return "ACTIVE_TREE"; 15 return scoped_ptr<base::Value>(new base::StringValue("ACTIVE_TREE"));
17 case PENDING_TREE: 16 case PENDING_TREE:
18 return "PENDING_TREE"; 17 return scoped_ptr<base::Value>(new base::StringValue("PENDING_TREE"));
19 default: 18 default:
20 DCHECK(false) << "Unrecognized WhichTree value " << tree; 19 DCHECK(false) << "Unrecognized WhichTree value " << tree;
21 return "<unknown WhichTree value>"; 20 return scoped_ptr<base::Value>(new base::StringValue(
21 "<unknown WhichTree value>"));
22 } 22 }
23 } 23 }
24 24
25 std::string TileResolutionToString(TileResolution resolution) { 25 scoped_ptr<base::Value> TileResolutionAsValue(
26 TileResolution resolution) {
26 switch (resolution) { 27 switch (resolution) {
27 case LOW_RESOLUTION: 28 case LOW_RESOLUTION:
28 return "LOW_RESOLUTION"; 29 return scoped_ptr<base::Value>(new base::StringValue("LOW_RESOLUTION"));
29 case HIGH_RESOLUTION: 30 case HIGH_RESOLUTION:
30 return "HIGH_RESOLUTION"; 31 return scoped_ptr<base::Value>(new base::StringValue("HIGH_RESOLUTION"));
31 case NON_IDEAL_RESOLUTION: 32 case NON_IDEAL_RESOLUTION:
32 return "NON_IDEAL_RESOLUTION"; 33 return scoped_ptr<base::Value>(new base::StringValue(
34 "NON_IDEAL_RESOLUTION"));
33 } 35 }
34 DCHECK(false) << "Unrecognized TileResolution value " << resolution; 36 DCHECK(false) << "Unrecognized TileResolution value " << resolution;
35 return "<unknown TileResolution value>"; 37 return scoped_ptr<base::Value>(new base::StringValue(
38 "<unknown TileResolution value>"));
36 } 39 }
37 40
38 std::string TilePriorityBinToString(TilePriority::PriorityBin bin) { 41 scoped_ptr<base::Value> TilePriorityBinAsValue(TilePriority::PriorityBin bin) {
39 switch (bin) { 42 switch (bin) {
40 case TilePriority::NOW: 43 case TilePriority::NOW:
41 return "NOW"; 44 return scoped_ptr<base::Value>(new base::StringValue("NOW"));
42 case TilePriority::SOON: 45 case TilePriority::SOON:
43 return "SOON"; 46 return scoped_ptr<base::Value>(new base::StringValue("SOON"));
44 case TilePriority::EVENTUALLY: 47 case TilePriority::EVENTUALLY:
45 return "EVENTUALLY"; 48 return scoped_ptr<base::Value>(new base::StringValue("EVENTUALLY"));
46 } 49 }
47 DCHECK(false) << "Unrecognized TilePriority::PriorityBin value " << bin; 50 DCHECK(false) << "Unrecognized TilePriority::PriorityBin value " << bin;
48 return "<unknown TilePriority::PriorityBin value>"; 51 return scoped_ptr<base::Value>(
52 new base::StringValue("<unknown TilePriority::PriorityBin value>"));
49 } 53 }
50 54
51 void TilePriority::AsValueInto(base::debug::TracedValue* state) const { 55 scoped_ptr<base::Value> TilePriority::AsValue() const {
52 state->SetString("resolution", TileResolutionToString(resolution)); 56 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
53 state->SetString("priority_bin", TilePriorityBinToString(priority_bin)); 57 state->Set("resolution", TileResolutionAsValue(resolution).release());
54 state->SetDouble("distance_to_visible", 58 state->Set("priority_bin", TilePriorityBinAsValue(priority_bin).release());
55 MathUtil::AsDoubleSafely(distance_to_visible)); 59 state->Set("distance_to_visible",
60 MathUtil::AsValueSafely(distance_to_visible).release());
61 return state.PassAs<base::Value>();
56 } 62 }
57 63
58 std::string TileMemoryLimitPolicyToString(TileMemoryLimitPolicy policy) { 64 scoped_ptr<base::Value> TileMemoryLimitPolicyAsValue(
65 TileMemoryLimitPolicy policy) {
59 switch (policy) { 66 switch (policy) {
60 case ALLOW_NOTHING: 67 case ALLOW_NOTHING:
61 return "ALLOW_NOTHING"; 68 return scoped_ptr<base::Value>(new base::StringValue("ALLOW_NOTHING"));
62 case ALLOW_ABSOLUTE_MINIMUM: 69 case ALLOW_ABSOLUTE_MINIMUM:
63 return "ALLOW_ABSOLUTE_MINIMUM"; 70 return scoped_ptr<base::Value>(new base::StringValue(
71 "ALLOW_ABSOLUTE_MINIMUM"));
64 case ALLOW_PREPAINT_ONLY: 72 case ALLOW_PREPAINT_ONLY:
65 return "ALLOW_PREPAINT_ONLY"; 73 return scoped_ptr<base::Value>(new base::StringValue(
74 "ALLOW_PREPAINT_ONLY"));
66 case ALLOW_ANYTHING: 75 case ALLOW_ANYTHING:
67 return "ALLOW_ANYTHING"; 76 return scoped_ptr<base::Value>(new base::StringValue(
77 "ALLOW_ANYTHING"));
68 default: 78 default:
69 DCHECK(false) << "Unrecognized policy value"; 79 DCHECK(false) << "Unrecognized policy value";
70 return "<unknown>"; 80 return scoped_ptr<base::Value>(new base::StringValue(
81 "<unknown>"));
71 } 82 }
72 } 83 }
73 84
74 std::string TreePriorityToString(TreePriority prio) { 85 scoped_ptr<base::Value> TreePriorityAsValue(TreePriority prio) {
75 switch (prio) { 86 switch (prio) {
76 case SAME_PRIORITY_FOR_BOTH_TREES: 87 case SAME_PRIORITY_FOR_BOTH_TREES:
77 return "SAME_PRIORITY_FOR_BOTH_TREES"; 88 return scoped_ptr<base::Value>(new base::StringValue(
89 "SAME_PRIORITY_FOR_BOTH_TREES"));
78 case SMOOTHNESS_TAKES_PRIORITY: 90 case SMOOTHNESS_TAKES_PRIORITY:
79 return "SMOOTHNESS_TAKES_PRIORITY"; 91 return scoped_ptr<base::Value>(new base::StringValue(
92 "SMOOTHNESS_TAKES_PRIORITY"));
80 case NEW_CONTENT_TAKES_PRIORITY: 93 case NEW_CONTENT_TAKES_PRIORITY:
81 return "NEW_CONTENT_TAKES_PRIORITY"; 94 return scoped_ptr<base::Value>(new base::StringValue(
95 "NEW_CONTENT_TAKES_PRIORITY"));
82 default: 96 default:
83 DCHECK(false) << "Unrecognized priority value " << prio; 97 DCHECK(false) << "Unrecognized priority value " << prio;
84 return "<unknown>"; 98 return scoped_ptr<base::Value>(new base::StringValue("<unknown>"));
85 } 99 }
86 } 100 }
87 101
88 void GlobalStateThatImpactsTilePriority::AsValueInto( 102 scoped_ptr<base::Value> GlobalStateThatImpactsTilePriority::AsValue() const {
89 base::debug::TracedValue* state) const { 103 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
90 state->SetString("memory_limit_policy", 104 state->Set("memory_limit_policy",
91 TileMemoryLimitPolicyToString(memory_limit_policy)); 105 TileMemoryLimitPolicyAsValue(memory_limit_policy).release());
92 state->SetInteger("soft_memory_limit_in_bytes", soft_memory_limit_in_bytes); 106 state->SetInteger("soft_memory_limit_in_bytes", soft_memory_limit_in_bytes);
93 state->SetInteger("hard_memory_limit_in_bytes", hard_memory_limit_in_bytes); 107 state->SetInteger("hard_memory_limit_in_bytes", hard_memory_limit_in_bytes);
94 state->SetInteger("num_resources_limit", num_resources_limit); 108 state->SetInteger("num_resources_limit", num_resources_limit);
95 state->SetString("tree_priority", TreePriorityToString(tree_priority)); 109 state->Set("tree_priority", TreePriorityAsValue(tree_priority).release());
110 return state.PassAs<base::Value>();
96 } 111 }
97 112
98 } // namespace cc 113 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_priority.h ('k') | cc/scheduler/delay_based_time_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698