OLD | NEW |
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/tiles/tile_priority.h" | 5 #include "cc/tiles/tile_priority.h" |
6 | 6 |
| 7 #include "base/numerics/safe_conversions.h" |
7 #include "base/trace_event/trace_event_argument.h" | 8 #include "base/trace_event/trace_event_argument.h" |
8 #include "base/values.h" | 9 #include "base/values.h" |
9 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
10 | 11 |
11 namespace cc { | 12 namespace cc { |
12 | 13 |
13 std::string WhichTreeToString(WhichTree tree) { | 14 std::string WhichTreeToString(WhichTree tree) { |
14 switch (tree) { | 15 switch (tree) { |
15 case ACTIVE_TREE: | 16 case ACTIVE_TREE: |
16 return "ACTIVE_TREE"; | 17 return "ACTIVE_TREE"; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 default: | 83 default: |
83 DCHECK(false) << "Unrecognized priority value " << prio; | 84 DCHECK(false) << "Unrecognized priority value " << prio; |
84 return "<unknown>"; | 85 return "<unknown>"; |
85 } | 86 } |
86 } | 87 } |
87 | 88 |
88 void GlobalStateThatImpactsTilePriority::AsValueInto( | 89 void GlobalStateThatImpactsTilePriority::AsValueInto( |
89 base::trace_event::TracedValue* state) const { | 90 base::trace_event::TracedValue* state) const { |
90 state->SetString("memory_limit_policy", | 91 state->SetString("memory_limit_policy", |
91 TileMemoryLimitPolicyToString(memory_limit_policy)); | 92 TileMemoryLimitPolicyToString(memory_limit_policy)); |
92 state->SetInteger("soft_memory_limit_in_bytes", soft_memory_limit_in_bytes); | 93 state->SetInteger("soft_memory_limit_in_bytes", |
93 state->SetInteger("hard_memory_limit_in_bytes", hard_memory_limit_in_bytes); | 94 base::saturated_cast<int>(soft_memory_limit_in_bytes)); |
94 state->SetInteger("num_resources_limit", num_resources_limit); | 95 state->SetInteger("hard_memory_limit_in_bytes", |
| 96 base::saturated_cast<int>(hard_memory_limit_in_bytes)); |
| 97 state->SetInteger("num_resources_limit", |
| 98 base::saturated_cast<int>(num_resources_limit)); |
95 state->SetString("tree_priority", TreePriorityToString(tree_priority)); | 99 state->SetString("tree_priority", TreePriorityToString(tree_priority)); |
96 } | 100 } |
97 | 101 |
98 } // namespace cc | 102 } // namespace cc |
OLD | NEW |