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/resources/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 NOTREACHED(); | 178 NOTREACHED(); |
179 return "Invalid TaskSet"; | 179 return "Invalid TaskSet"; |
180 } | 180 } |
181 | 181 |
182 } // namespace | 182 } // namespace |
183 | 183 |
184 RasterTaskCompletionStats::RasterTaskCompletionStats() | 184 RasterTaskCompletionStats::RasterTaskCompletionStats() |
185 : completed_count(0u), canceled_count(0u) {} | 185 : completed_count(0u), canceled_count(0u) {} |
186 | 186 |
187 scoped_refptr<base::debug::ConvertableToTraceFormat> | 187 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
188 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats) { | 188 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats) { |
189 scoped_refptr<base::debug::TracedValue> state = | 189 scoped_refptr<base::trace_event::TracedValue> state = |
190 new base::debug::TracedValue(); | 190 new base::trace_event::TracedValue(); |
191 state->SetInteger("completed_count", stats.completed_count); | 191 state->SetInteger("completed_count", stats.completed_count); |
192 state->SetInteger("canceled_count", stats.canceled_count); | 192 state->SetInteger("canceled_count", stats.canceled_count); |
193 return state; | 193 return state; |
194 } | 194 } |
195 | 195 |
196 // static | 196 // static |
197 scoped_ptr<TileManager> TileManager::Create( | 197 scoped_ptr<TileManager> TileManager::Create( |
198 TileManagerClient* client, | 198 TileManagerClient* client, |
199 base::SequencedTaskRunner* task_runner, | 199 base::SequencedTaskRunner* task_runner, |
200 ResourcePool* resource_pool, | 200 ResourcePool* resource_pool, |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 470 |
471 TRACE_EVENT_INSTANT1( | 471 TRACE_EVENT_INSTANT1( |
472 "cc", | 472 "cc", |
473 "DidUpdateVisibleTiles", | 473 "DidUpdateVisibleTiles", |
474 TRACE_EVENT_SCOPE_THREAD, | 474 TRACE_EVENT_SCOPE_THREAD, |
475 "stats", | 475 "stats", |
476 RasterTaskCompletionStatsAsValue(update_visible_tiles_stats_)); | 476 RasterTaskCompletionStatsAsValue(update_visible_tiles_stats_)); |
477 update_visible_tiles_stats_ = RasterTaskCompletionStats(); | 477 update_visible_tiles_stats_ = RasterTaskCompletionStats(); |
478 } | 478 } |
479 | 479 |
480 scoped_refptr<base::debug::ConvertableToTraceFormat> | 480 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
481 TileManager::BasicStateAsValue() const { | 481 TileManager::BasicStateAsValue() const { |
482 scoped_refptr<base::debug::TracedValue> value = | 482 scoped_refptr<base::trace_event::TracedValue> value = |
483 new base::debug::TracedValue(); | 483 new base::trace_event::TracedValue(); |
484 BasicStateAsValueInto(value.get()); | 484 BasicStateAsValueInto(value.get()); |
485 return value; | 485 return value; |
486 } | 486 } |
487 | 487 |
488 void TileManager::BasicStateAsValueInto(base::debug::TracedValue* state) const { | 488 void TileManager::BasicStateAsValueInto( |
| 489 base::trace_event::TracedValue* state) const { |
489 state->SetInteger("tile_count", tiles_.size()); | 490 state->SetInteger("tile_count", tiles_.size()); |
490 state->SetBoolean("did_oom_on_last_assign", did_oom_on_last_assign_); | 491 state->SetBoolean("did_oom_on_last_assign", did_oom_on_last_assign_); |
491 state->BeginDictionary("global_state"); | 492 state->BeginDictionary("global_state"); |
492 global_state_.AsValueInto(state); | 493 global_state_.AsValueInto(state); |
493 state->EndDictionary(); | 494 state->EndDictionary(); |
494 } | 495 } |
495 | 496 |
496 scoped_ptr<EvictionTilePriorityQueue> | 497 scoped_ptr<EvictionTilePriorityQueue> |
497 TileManager::FreeTileResourcesUntilUsageIsWithinLimit( | 498 TileManager::FreeTileResourcesUntilUsageIsWithinLimit( |
498 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 499 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 result -= other; | 1049 result -= other; |
1049 return result; | 1050 return result; |
1050 } | 1051 } |
1051 | 1052 |
1052 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 1053 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
1053 return memory_bytes_ > limit.memory_bytes_ || | 1054 return memory_bytes_ > limit.memory_bytes_ || |
1054 resource_count_ > limit.resource_count_; | 1055 resource_count_ > limit.resource_count_; |
1055 } | 1056 } |
1056 | 1057 |
1057 } // namespace cc | 1058 } // namespace cc |
OLD | NEW |