| 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_manager.h" | 5 #include "cc/tiles/tile_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 scoped_refptr<TileTask> TileManager::CreateTaskSetFinishedTask( | 1357 scoped_refptr<TileTask> TileManager::CreateTaskSetFinishedTask( |
| 1358 void (TileManager::*callback)()) { | 1358 void (TileManager::*callback)()) { |
| 1359 return make_scoped_refptr(new TaskSetFinishedTaskImpl( | 1359 return make_scoped_refptr(new TaskSetFinishedTaskImpl( |
| 1360 task_runner_, | 1360 task_runner_, |
| 1361 base::Bind(callback, task_set_finished_weak_ptr_factory_.GetWeakPtr()))); | 1361 base::Bind(callback, task_set_finished_weak_ptr_factory_.GetWeakPtr()))); |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 1364 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 1365 TileManager::ActivationStateAsValue() { | 1365 TileManager::ActivationStateAsValue() { |
| 1366 auto state = base::MakeUnique<base::trace_event::TracedValue>(); | 1366 auto state = base::MakeUnique<base::trace_event::TracedValue>(); |
| 1367 ActivationStateAsValueInto(state.get()); |
| 1368 return std::move(state); |
| 1369 } |
| 1370 |
| 1371 void TileManager::ActivationStateAsValueInto( |
| 1372 base::trace_event::TracedValue* state) { |
| 1367 state->SetString("tree_priority", | 1373 state->SetString("tree_priority", |
| 1368 TreePriorityToString(global_state_.tree_priority)); | 1374 TreePriorityToString(global_state_.tree_priority)); |
| 1369 state->SetInteger("soft_memory_limit", | 1375 state->SetInteger("soft_memory_limit", |
| 1370 global_state_.soft_memory_limit_in_bytes); | 1376 global_state_.soft_memory_limit_in_bytes); |
| 1371 state->SetInteger("hard_memory_limit", | 1377 state->SetInteger("hard_memory_limit", |
| 1372 global_state_.soft_memory_limit_in_bytes); | 1378 global_state_.soft_memory_limit_in_bytes); |
| 1373 state->SetInteger("pending_required_for_activation_callback_id", | 1379 state->SetInteger("pending_required_for_activation_callback_id", |
| 1374 pending_required_for_activation_callback_id_); | 1380 pending_required_for_activation_callback_id_); |
| 1375 state->SetInteger("current_memory_usage", | 1381 state->SetInteger("current_memory_usage", |
| 1376 resource_pool_->memory_usage_bytes()); | 1382 resource_pool_->memory_usage_bytes()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1395 tile->required_for_activation()); | 1401 tile->required_for_activation()); |
| 1396 value->SetBoolean("required_for_draw", tile->required_for_draw()); | 1402 value->SetBoolean("required_for_draw", tile->required_for_draw()); |
| 1397 }; | 1403 }; |
| 1398 | 1404 |
| 1399 std::unique_ptr<RasterTilePriorityQueue> raster_priority_queue( | 1405 std::unique_ptr<RasterTilePriorityQueue> raster_priority_queue( |
| 1400 client_->BuildRasterQueue(global_state_.tree_priority, | 1406 client_->BuildRasterQueue(global_state_.tree_priority, |
| 1401 RasterTilePriorityQueue::Type::ALL)); | 1407 RasterTilePriorityQueue::Type::ALL)); |
| 1402 state->BeginArray("raster_tiles"); | 1408 state->BeginArray("raster_tiles"); |
| 1403 for (; !raster_priority_queue->IsEmpty(); raster_priority_queue->Pop()) { | 1409 for (; !raster_priority_queue->IsEmpty(); raster_priority_queue->Pop()) { |
| 1404 state->BeginDictionary(); | 1410 state->BeginDictionary(); |
| 1405 tile_as_value(raster_priority_queue->Top(), state.get()); | 1411 tile_as_value(raster_priority_queue->Top(), state); |
| 1406 state->EndDictionary(); | 1412 state->EndDictionary(); |
| 1407 } | 1413 } |
| 1408 state->EndArray(); | 1414 state->EndArray(); |
| 1409 | 1415 |
| 1410 std::unique_ptr<RasterTilePriorityQueue> required_priority_queue( | 1416 std::unique_ptr<RasterTilePriorityQueue> required_priority_queue( |
| 1411 client_->BuildRasterQueue( | 1417 client_->BuildRasterQueue( |
| 1412 global_state_.tree_priority, | 1418 global_state_.tree_priority, |
| 1413 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION)); | 1419 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION)); |
| 1414 state->BeginArray("activation_tiles"); | 1420 state->BeginArray("activation_tiles"); |
| 1415 for (; !required_priority_queue->IsEmpty(); required_priority_queue->Pop()) { | 1421 for (; !required_priority_queue->IsEmpty(); required_priority_queue->Pop()) { |
| 1416 state->BeginDictionary(); | 1422 state->BeginDictionary(); |
| 1417 tile_as_value(required_priority_queue->Top(), state.get()); | 1423 tile_as_value(required_priority_queue->Top(), state); |
| 1418 state->EndDictionary(); | 1424 state->EndDictionary(); |
| 1419 } | 1425 } |
| 1420 state->EndArray(); | 1426 state->EndArray(); |
| 1421 | |
| 1422 return std::move(state); | |
| 1423 } | 1427 } |
| 1424 | 1428 |
| 1425 TileManager::MemoryUsage::MemoryUsage() | 1429 TileManager::MemoryUsage::MemoryUsage() |
| 1426 : memory_bytes_(0), resource_count_(0) {} | 1430 : memory_bytes_(0), resource_count_(0) {} |
| 1427 | 1431 |
| 1428 TileManager::MemoryUsage::MemoryUsage(size_t memory_bytes, | 1432 TileManager::MemoryUsage::MemoryUsage(size_t memory_bytes, |
| 1429 size_t resource_count) | 1433 size_t resource_count) |
| 1430 : memory_bytes_(static_cast<int64_t>(memory_bytes)), | 1434 : memory_bytes_(static_cast<int64_t>(memory_bytes)), |
| 1431 resource_count_(static_cast<int>(resource_count)) { | 1435 resource_count_(static_cast<int>(resource_count)) { |
| 1432 // MemoryUsage is constructed using size_ts, since it deals with memory and | 1436 // MemoryUsage is constructed using size_ts, since it deals with memory and |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 all_tile_tasks_completed = false; | 1502 all_tile_tasks_completed = false; |
| 1499 did_notify_all_tile_tasks_completed = false; | 1503 did_notify_all_tile_tasks_completed = false; |
| 1500 } | 1504 } |
| 1501 | 1505 |
| 1502 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; | 1506 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; |
| 1503 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( | 1507 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( |
| 1504 PrioritizedWorkToSchedule&& other) = default; | 1508 PrioritizedWorkToSchedule&& other) = default; |
| 1505 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; | 1509 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; |
| 1506 | 1510 |
| 1507 } // namespace cc | 1511 } // namespace cc |
| OLD | NEW |