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

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

Issue 22911037: cc: Add DEFINE_ENUM macro. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 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') | no next file » | 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/values.h" 7 #include "base/values.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 9
10 namespace { 10 namespace {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 namespace cc { 61 namespace cc {
62 62
63 scoped_ptr<base::Value> WhichTreeAsValue(WhichTree tree) { 63 scoped_ptr<base::Value> WhichTreeAsValue(WhichTree tree) {
64 switch (tree) { 64 switch (tree) {
65 case ACTIVE_TREE: 65 case ACTIVE_TREE:
66 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 66 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
67 "ACTIVE_TREE")); 67 "ACTIVE_TREE"));
68 case PENDING_TREE: 68 case PENDING_TREE:
69 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 69 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
70 "PENDING_TREE")); 70 "PENDING_TREE"));
71 default:
72 DCHECK(false) << "Unrecognized WhichTree value " << tree;
73 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
74 "<unknown WhichTree value>"));
75 } 71 }
72 DCHECK(false) << "Unrecognized WhichTree value " << tree;
73 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
74 "<unknown WhichTree value>"));
76 } 75 }
77 76
78 scoped_ptr<base::Value> TileResolutionAsValue( 77 scoped_ptr<base::Value> TileResolutionAsValue(
79 TileResolution resolution) { 78 TileResolution resolution) {
80 switch (resolution) { 79 switch (resolution) {
81 case LOW_RESOLUTION: 80 case LOW_RESOLUTION:
82 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 81 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
83 "LOW_RESOLUTION")); 82 "LOW_RESOLUTION"));
84 case HIGH_RESOLUTION: 83 case HIGH_RESOLUTION:
85 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 84 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 "ALLOW_NOTHING")); 149 "ALLOW_NOTHING"));
151 case ALLOW_ABSOLUTE_MINIMUM: 150 case ALLOW_ABSOLUTE_MINIMUM:
152 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 151 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
153 "ALLOW_ABSOLUTE_MINIMUM")); 152 "ALLOW_ABSOLUTE_MINIMUM"));
154 case ALLOW_PREPAINT_ONLY: 153 case ALLOW_PREPAINT_ONLY:
155 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 154 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
156 "ALLOW_PREPAINT_ONLY")); 155 "ALLOW_PREPAINT_ONLY"));
157 case ALLOW_ANYTHING: 156 case ALLOW_ANYTHING:
158 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 157 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
159 "ALLOW_ANYTHING")); 158 "ALLOW_ANYTHING"));
160 default:
161 DCHECK(false) << "Unrecognized policy value";
162 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
163 "<unknown>"));
164 } 159 }
160 DCHECK(false) << "Unrecognized policy value";
161 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
162 "<unknown>"));
165 } 163 }
166 164
167 scoped_ptr<base::Value> TreePriorityAsValue(TreePriority prio) { 165 scoped_ptr<base::Value> TreePriorityAsValue(TreePriority prio) {
168 switch (prio) { 166 switch (prio) {
169 case SAME_PRIORITY_FOR_BOTH_TREES: 167 case SAME_PRIORITY_FOR_BOTH_TREES:
170 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 168 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
171 "SAME_PRIORITY_FOR_BOTH_TREES")); 169 "SAME_PRIORITY_FOR_BOTH_TREES"));
172 case SMOOTHNESS_TAKES_PRIORITY: 170 case SMOOTHNESS_TAKES_PRIORITY:
173 return scoped_ptr<base::Value>(base::Value::CreateStringValue( 171 return scoped_ptr<base::Value>(base::Value::CreateStringValue(
174 "SMOOTHNESS_TAKES_PRIORITY")); 172 "SMOOTHNESS_TAKES_PRIORITY"));
(...skipping 12 matching lines...) Expand all
187 TileMemoryLimitPolicyAsValue(memory_limit_policy).release()); 185 TileMemoryLimitPolicyAsValue(memory_limit_policy).release());
188 state->SetInteger("memory_limit_in_bytes", memory_limit_in_bytes); 186 state->SetInteger("memory_limit_in_bytes", memory_limit_in_bytes);
189 state->SetInteger("unused_memory_limit_in_bytes", 187 state->SetInteger("unused_memory_limit_in_bytes",
190 unused_memory_limit_in_bytes); 188 unused_memory_limit_in_bytes);
191 state->SetInteger("num_resources_limit", num_resources_limit); 189 state->SetInteger("num_resources_limit", num_resources_limit);
192 state->Set("tree_priority", TreePriorityAsValue(tree_priority).release()); 190 state->Set("tree_priority", TreePriorityAsValue(tree_priority).release());
193 return state.PassAs<base::Value>(); 191 return state.PassAs<base::Value>();
194 } 192 }
195 193
196 } // namespace cc 194 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_priority.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698