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

Side by Side Diff: cc/tiles/tile_manager.cc

Issue 2797883002: cc: Add TileManager::GetActivationStateAsValue for debugging state. (Closed)
Patch Set: compilefix Created 3 years, 8 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
« no previous file with comments | « cc/tiles/tile_manager.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/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 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 1351
1352 // Utility function that can be used to create a "Task set finished" task that 1352 // Utility function that can be used to create a "Task set finished" task that
1353 // posts |callback| to |task_runner| when run. 1353 // posts |callback| to |task_runner| when run.
1354 scoped_refptr<TileTask> TileManager::CreateTaskSetFinishedTask( 1354 scoped_refptr<TileTask> TileManager::CreateTaskSetFinishedTask(
1355 void (TileManager::*callback)()) { 1355 void (TileManager::*callback)()) {
1356 return make_scoped_refptr(new TaskSetFinishedTaskImpl( 1356 return make_scoped_refptr(new TaskSetFinishedTaskImpl(
1357 task_runner_, 1357 task_runner_,
1358 base::Bind(callback, task_set_finished_weak_ptr_factory_.GetWeakPtr()))); 1358 base::Bind(callback, task_set_finished_weak_ptr_factory_.GetWeakPtr())));
1359 } 1359 }
1360 1360
1361 std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
1362 TileManager::ActivationStateAsValue() {
1363 auto state = base::MakeUnique<base::trace_event::TracedValue>();
1364 state->SetString("tree_priority",
1365 TreePriorityToString(global_state_.tree_priority));
1366 state->SetInteger("soft_memory_limit",
1367 global_state_.soft_memory_limit_in_bytes);
1368 state->SetInteger("hard_memory_limit",
1369 global_state_.soft_memory_limit_in_bytes);
1370 state->SetInteger("pending_required_for_activation_callback_id",
1371 pending_required_for_activation_callback_id_);
1372 state->SetInteger("current_memory_usage",
1373 resource_pool_->memory_usage_bytes());
1374 state->SetInteger("current_resource_usage", resource_pool_->resource_count());
1375
1376 // Use a custom tile_as_value, instead of Tile::AsValueInto, since we don't
1377 // need all of the state that would be captured by other functions.
1378 auto tile_as_value = [](const PrioritizedTile& prioritized_tile,
1379 base::trace_event::TracedValue* value) {
1380 Tile* tile = prioritized_tile.tile();
1381 TilePriority priority = prioritized_tile.priority();
1382
1383 value->SetInteger("id", tile->id());
1384 value->SetString("content_rect", tile->content_rect().ToString());
1385 value->SetDouble("contents_scale", tile->contents_scale());
1386 value->SetBoolean("is_ready_to_draw", tile->draw_info().IsReadyToDraw());
1387 value->SetString("resolution", TileResolutionToString(priority.resolution));
1388 value->SetString("priority_bin",
1389 TilePriorityBinToString(priority.priority_bin));
1390 value->SetDouble("distance_to_visible", priority.distance_to_visible);
1391 value->SetBoolean("required_for_activation",
1392 tile->required_for_activation());
1393 value->SetBoolean("required_for_draw", tile->required_for_draw());
1394 };
1395
1396 std::unique_ptr<RasterTilePriorityQueue> raster_priority_queue(
1397 client_->BuildRasterQueue(global_state_.tree_priority,
1398 RasterTilePriorityQueue::Type::ALL));
1399 state->BeginArray("raster_tiles");
1400 for (; !raster_priority_queue->IsEmpty(); raster_priority_queue->Pop()) {
1401 state->BeginDictionary();
1402 tile_as_value(raster_priority_queue->Top(), state.get());
1403 state->EndDictionary();
1404 }
1405 state->EndArray();
1406
1407 std::unique_ptr<RasterTilePriorityQueue> required_priority_queue(
1408 client_->BuildRasterQueue(
1409 global_state_.tree_priority,
1410 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION));
1411 state->BeginArray("activation_tiles");
1412 for (; !required_priority_queue->IsEmpty(); required_priority_queue->Pop()) {
1413 state->BeginDictionary();
1414 tile_as_value(required_priority_queue->Top(), state.get());
1415 state->EndDictionary();
1416 }
1417 state->EndArray();
1418
1419 return std::move(state);
1420 }
1421
1361 TileManager::MemoryUsage::MemoryUsage() 1422 TileManager::MemoryUsage::MemoryUsage()
1362 : memory_bytes_(0), resource_count_(0) {} 1423 : memory_bytes_(0), resource_count_(0) {}
1363 1424
1364 TileManager::MemoryUsage::MemoryUsage(size_t memory_bytes, 1425 TileManager::MemoryUsage::MemoryUsage(size_t memory_bytes,
1365 size_t resource_count) 1426 size_t resource_count)
1366 : memory_bytes_(static_cast<int64_t>(memory_bytes)), 1427 : memory_bytes_(static_cast<int64_t>(memory_bytes)),
1367 resource_count_(static_cast<int>(resource_count)) { 1428 resource_count_(static_cast<int>(resource_count)) {
1368 // MemoryUsage is constructed using size_ts, since it deals with memory and 1429 // MemoryUsage is constructed using size_ts, since it deals with memory and
1369 // the inputs are typically size_t. However, during the course of usage (in 1430 // the inputs are typically size_t. However, during the course of usage (in
1370 // particular operator-=) can cause internal values to become negative. 1431 // particular operator-=) can cause internal values to become negative.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 all_tile_tasks_completed = false; 1495 all_tile_tasks_completed = false;
1435 did_notify_all_tile_tasks_completed = false; 1496 did_notify_all_tile_tasks_completed = false;
1436 } 1497 }
1437 1498
1438 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; 1499 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default;
1439 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( 1500 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule(
1440 PrioritizedWorkToSchedule&& other) = default; 1501 PrioritizedWorkToSchedule&& other) = default;
1441 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; 1502 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default;
1442 1503
1443 } // namespace cc 1504 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698