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

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

Issue 228183002: cc: Move ResourcePool ownership to LTHI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_manager_perftest.cc » ('j') | 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_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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 const RasterTaskCompletionStats& stats) { 390 const RasterTaskCompletionStats& stats) {
391 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 391 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
392 state->SetInteger("completed_count", stats.completed_count); 392 state->SetInteger("completed_count", stats.completed_count);
393 state->SetInteger("canceled_count", stats.canceled_count); 393 state->SetInteger("canceled_count", stats.canceled_count);
394 return state.PassAs<base::Value>(); 394 return state.PassAs<base::Value>();
395 } 395 }
396 396
397 // static 397 // static
398 scoped_ptr<TileManager> TileManager::Create( 398 scoped_ptr<TileManager> TileManager::Create(
399 TileManagerClient* client, 399 TileManagerClient* client,
400 ResourceProvider* resource_provider, 400 ResourcePool* resource_pool,
401 Rasterizer* rasterizer, 401 Rasterizer* rasterizer,
402 Rasterizer* gpu_rasterizer, 402 Rasterizer* gpu_rasterizer,
403 size_t max_raster_usage_bytes, 403 size_t max_raster_usage_bytes,
404 bool use_rasterize_on_demand, 404 bool use_rasterize_on_demand,
405 RenderingStatsInstrumentation* rendering_stats_instrumentation) { 405 RenderingStatsInstrumentation* rendering_stats_instrumentation) {
406 return make_scoped_ptr(new TileManager(client, 406 return make_scoped_ptr(new TileManager(client,
407 resource_provider, 407 resource_pool,
408 rasterizer, 408 rasterizer,
409 gpu_rasterizer, 409 gpu_rasterizer,
410 max_raster_usage_bytes, 410 max_raster_usage_bytes,
411 use_rasterize_on_demand, 411 use_rasterize_on_demand,
412 rendering_stats_instrumentation)); 412 rendering_stats_instrumentation));
413 } 413 }
414 414
415 TileManager::TileManager( 415 TileManager::TileManager(
416 TileManagerClient* client, 416 TileManagerClient* client,
417 ResourceProvider* resource_provider, 417 ResourcePool* resource_pool,
418 Rasterizer* rasterizer, 418 Rasterizer* rasterizer,
419 Rasterizer* gpu_rasterizer, 419 Rasterizer* gpu_rasterizer,
420 size_t max_raster_usage_bytes, 420 size_t max_raster_usage_bytes,
421 bool use_rasterize_on_demand, 421 bool use_rasterize_on_demand,
422 RenderingStatsInstrumentation* rendering_stats_instrumentation) 422 RenderingStatsInstrumentation* rendering_stats_instrumentation)
423 : client_(client), 423 : client_(client),
424 resource_pool_(ResourcePool::Create(resource_provider, 424 resource_pool_(resource_pool),
425 rasterizer->GetResourceTarget(),
426 rasterizer->GetResourceFormat())),
427 prioritized_tiles_dirty_(false), 425 prioritized_tiles_dirty_(false),
428 all_tiles_that_need_to_be_rasterized_have_memory_(true), 426 all_tiles_that_need_to_be_rasterized_have_memory_(true),
429 all_tiles_required_for_activation_have_memory_(true), 427 all_tiles_required_for_activation_have_memory_(true),
430 memory_required_bytes_(0), 428 memory_required_bytes_(0),
431 memory_nice_to_have_bytes_(0), 429 memory_nice_to_have_bytes_(0),
432 bytes_releasable_(0), 430 bytes_releasable_(0),
433 resources_releasable_(0), 431 resources_releasable_(0),
434 max_raster_usage_bytes_(max_raster_usage_bytes), 432 max_raster_usage_bytes_(max_raster_usage_bytes),
435 ever_exceeded_memory_budget_(false), 433 ever_exceeded_memory_budget_(false),
436 rendering_stats_instrumentation_(rendering_stats_instrumentation), 434 rendering_stats_instrumentation_(rendering_stats_instrumentation),
437 did_initialize_visible_tile_(false), 435 did_initialize_visible_tile_(false),
438 did_check_for_completed_tasks_since_last_schedule_tasks_(true), 436 did_check_for_completed_tasks_since_last_schedule_tasks_(true),
439 use_rasterize_on_demand_(use_rasterize_on_demand), 437 use_rasterize_on_demand_(use_rasterize_on_demand) {
440 resource_format_(rasterizer->GetResourceFormat()) {
441 Rasterizer* rasterizers[NUM_RASTERIZER_TYPES] = { 438 Rasterizer* rasterizers[NUM_RASTERIZER_TYPES] = {
442 rasterizer, // RASTERIZER_TYPE_DEFAULT 439 rasterizer, // RASTERIZER_TYPE_DEFAULT
443 gpu_rasterizer, // RASTERIZER_TYPE_GPU 440 gpu_rasterizer, // RASTERIZER_TYPE_GPU
444 }; 441 };
445 rasterizer_delegate_ = 442 rasterizer_delegate_ =
446 RasterizerDelegate::Create(this, rasterizers, arraysize(rasterizers)); 443 RasterizerDelegate::Create(this, rasterizers, arraysize(rasterizers));
447 } 444 }
448 445
449 TileManager::~TileManager() { 446 TileManager::~TileManager() {
450 // Reset global state and manage. This should cause 447 // Reset global state and manage. This should cause
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 } 713 }
717 } 714 }
718 715
719 void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { 716 void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) {
720 TRACE_EVENT0("cc", "TileManager::ManageTiles"); 717 TRACE_EVENT0("cc", "TileManager::ManageTiles");
721 718
722 // Update internal state. 719 // Update internal state.
723 if (state != global_state_) { 720 if (state != global_state_) {
724 global_state_ = state; 721 global_state_ = state;
725 prioritized_tiles_dirty_ = true; 722 prioritized_tiles_dirty_ = true;
726 // Soft limit is used for resource pool such that
727 // memory returns to soft limit after going over.
728 resource_pool_->SetResourceUsageLimits(
729 global_state_.soft_memory_limit_in_bytes,
730 global_state_.unused_memory_limit_in_bytes,
731 global_state_.num_resources_limit);
732 } 723 }
733 724
734 // We need to call CheckForCompletedTasks() once in-between each call 725 // We need to call CheckForCompletedTasks() once in-between each call
735 // to ScheduleTasks() to prevent canceled tasks from being scheduled. 726 // to ScheduleTasks() to prevent canceled tasks from being scheduled.
736 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { 727 if (!did_check_for_completed_tasks_since_last_schedule_tasks_) {
737 rasterizer_delegate_->CheckForCompletedTasks(); 728 rasterizer_delegate_->CheckForCompletedTasks();
738 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; 729 did_check_for_completed_tasks_since_last_schedule_tasks_ = true;
739 } 730 }
740 731
741 UpdatePrioritizedTileSetIfNeeded(); 732 UpdatePrioritizedTileSetIfNeeded();
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 b_tile->priority(b_pair.second), 1507 b_tile->priority(b_pair.second),
1517 false /* prioritize low res */); 1508 false /* prioritize low res */);
1518 } 1509 }
1519 1510
1520 NOTREACHED(); 1511 NOTREACHED();
1521 // Keep the compiler happy. 1512 // Keep the compiler happy.
1522 return false; 1513 return false;
1523 } 1514 }
1524 1515
1525 } // namespace cc 1516 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_manager_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698