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

Side by Side Diff: cc/tile_manager.cc

Issue 12217105: cc: Check for completed raster tasks at interval. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
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/tile_manager.h" 5 #include "cc/tile_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 12 matching lines...) Expand all
23 23
24 // If we raster too fast we become upload bound, and pending 24 // If we raster too fast we become upload bound, and pending
25 // uploads consume memory. For maximum upload throughput, we would 25 // uploads consume memory. For maximum upload throughput, we would
26 // want to allow for upload_throughput * pipeline_time of pending 26 // want to allow for upload_throughput * pipeline_time of pending
27 // uploads, after which we are just wasting memory. Since we don't 27 // uploads, after which we are just wasting memory. Since we don't
28 // know our upload throughput yet, this just caps our memory usage. 28 // know our upload throughput yet, this just caps our memory usage.
29 #if defined(OS_ANDROID) 29 #if defined(OS_ANDROID)
30 // For reference, the Nexus10 can upload 1MB in about 2.5ms. 30 // For reference, the Nexus10 can upload 1MB in about 2.5ms.
31 // Assuming a three frame deep pipeline this implies ~20MB. 31 // Assuming a three frame deep pipeline this implies ~20MB.
32 const int kMaxPendingUploadBytes = 20 * 1024 * 1024; 32 const int kMaxPendingUploadBytes = 20 * 1024 * 1024;
33 const int kMaxPendingRasterBytes = 2 * 1024 * 1024;
33 #else 34 #else
34 const int kMaxPendingUploadBytes = 100 * 1024 * 1024; 35 const int kMaxPendingUploadBytes = 100 * 1024 * 1024;
36 const int kMaxPendingRasterBytes = 10 * 1024 * 1024;
35 #endif 37 #endif
36 38
37 // Determine bin based on three categories of tiles: things we need now, 39 // Determine bin based on three categories of tiles: things we need now,
38 // things we need soon, and eventually. 40 // things we need soon, and eventually.
39 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) { 41 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) {
40 if (!prio.is_live) 42 if (!prio.is_live)
41 return NEVER_BIN; 43 return NEVER_BIN;
42 44
43 // The amount of time for which we want to have prepainting coverage. 45 // The amount of time for which we want to have prepainting coverage.
44 const double prepainting_window_time_seconds = 1.0; 46 const double prepainting_window_time_seconds = 1.0;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 TileManager::TileManager( 117 TileManager::TileManager(
116 TileManagerClient* client, 118 TileManagerClient* client,
117 ResourceProvider* resource_provider, 119 ResourceProvider* resource_provider,
118 size_t num_raster_threads, 120 size_t num_raster_threads,
119 bool use_cheapness_estimator) 121 bool use_cheapness_estimator)
120 : client_(client), 122 : client_(client),
121 resource_pool_(ResourcePool::Create(resource_provider)), 123 resource_pool_(ResourcePool::Create(resource_provider)),
122 raster_worker_pool_(RasterWorkerPool::Create(num_raster_threads)), 124 raster_worker_pool_(RasterWorkerPool::Create(num_raster_threads)),
123 manage_tiles_pending_(false), 125 manage_tiles_pending_(false),
124 manage_tiles_call_count_(0), 126 manage_tiles_call_count_(0),
125 bytes_pending_set_pixels_(0),
126 ever_exceeded_memory_budget_(false), 127 ever_exceeded_memory_budget_(false),
128 bytes_pending_raster_(0),
129 bytes_pending_upload_(0),
127 record_rendering_stats_(false), 130 record_rendering_stats_(false),
128 use_cheapness_estimator_(use_cheapness_estimator) { 131 use_cheapness_estimator_(use_cheapness_estimator) {
129 for (int i = 0; i < NUM_STATES; ++i) { 132 for (int i = 0; i < NUM_STATES; ++i) {
130 for (int j = 0; j < NUM_TREES; ++j) { 133 for (int j = 0; j < NUM_TREES; ++j) {
131 for (int k = 0; k < NUM_BINS; ++k) 134 for (int k = 0; k < NUM_BINS; ++k)
132 raster_state_count_[i][j][k] = 0; 135 raster_state_count_[i][j][k] = 0;
133 } 136 }
134 } 137 }
135 } 138 }
136 139
137 TileManager::~TileManager() { 140 TileManager::~TileManager() {
138 // Reset global state and manage. This should cause 141 // Reset global state and manage. This should cause
139 // our memory usage to drop to zero. 142 // our memory usage to drop to zero.
140 global_state_ = GlobalStateThatImpactsTilePriority(); 143 global_state_ = GlobalStateThatImpactsTilePriority();
141 AssignGpuMemoryToTiles(); 144 AssignGpuMemoryToTiles();
142 // This should finish all pending tasks and release any uninitialized 145 // This should finish all pending tasks and release any uninitialized
143 // resources. 146 // resources.
144 raster_worker_pool_.reset(); 147 raster_worker_pool_.reset();
145 CheckForCompletedTileUploads(); 148 CheckForCompletedTileUploads();
146 DCHECK(tiles_with_pending_set_pixels_.size() == 0); 149 DCHECK(tiles_with_pending_upload_.size() == 0);
147 DCHECK(tiles_.size() == 0); 150 DCHECK(tiles_.size() == 0);
148 } 151 }
149 152
150 void TileManager::SetGlobalState( 153 void TileManager::SetGlobalState(
151 const GlobalStateThatImpactsTilePriority& global_state) { 154 const GlobalStateThatImpactsTilePriority& global_state) {
152 global_state_ = global_state; 155 global_state_ = global_state;
153 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); 156 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes);
154 ScheduleManageTiles(); 157 ScheduleManageTiles();
155 } 158 }
156 159
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 340
338 // Assign gpu memory and determine what tiles need to be rasterized. 341 // Assign gpu memory and determine what tiles need to be rasterized.
339 AssignGpuMemoryToTiles(); 342 AssignGpuMemoryToTiles();
340 343
341 TRACE_EVENT_INSTANT1("cc", "DidManage", "state", ValueToString(AsValue())); 344 TRACE_EVENT_INSTANT1("cc", "DidManage", "state", ValueToString(AsValue()));
342 345
343 // Finally, kick the rasterizer. 346 // Finally, kick the rasterizer.
344 DispatchMoreTasks(); 347 DispatchMoreTasks();
345 } 348 }
346 349
350 void TileManager::CheckForCompletedRasterTasks() {
351 int pending_upload_count = tiles_with_pending_upload_.size();
352
353 // Check for completed tasks and dispatch replies.
354 raster_worker_pool_->CheckForCompletedTasks();
355
356 // Flush if we began new uploads.
357 if (tiles_with_pending_upload_.size() != pending_upload_count)
358 resource_pool_->resource_provider()->shallowFlushIfSupported();
359
360 DispatchMoreTasks();
361
362 // Schedule another check if we still have pending raster tasks.
363 if (bytes_pending_raster_)
364 client_->ScheduleCheckForCompletedRasterTasks();
365 }
366
347 void TileManager::CheckForCompletedTileUploads() { 367 void TileManager::CheckForCompletedTileUploads() {
348 while (!tiles_with_pending_set_pixels_.empty()) { 368 while (!tiles_with_pending_upload_.empty()) {
349 Tile* tile = tiles_with_pending_set_pixels_.front(); 369 Tile* tile = tiles_with_pending_upload_.front();
350 DCHECK(tile->managed_state().resource); 370 DCHECK(tile->managed_state().resource);
351 371
352 // Set pixel tasks complete in the order they are posted. 372 // Set pixel tasks complete in the order they are posted.
353 if (!resource_pool_->resource_provider()->didSetPixelsComplete( 373 if (!resource_pool_->resource_provider()->didSetPixelsComplete(
354 tile->managed_state().resource->id())) { 374 tile->managed_state().resource->id())) {
355 break; 375 break;
356 } 376 }
357 377
358 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0 && 378 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0 &&
359 tile->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) 379 tile->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION)
360 client_->DidUploadVisibleHighResolutionTile(); 380 client_->DidUploadVisibleHighResolutionTile();
361 381
362 // It's now safe to release the pixel buffer. 382 // It's now safe to release the pixel buffer.
363 resource_pool_->resource_provider()->releasePixelBuffer( 383 resource_pool_->resource_provider()->releasePixelBuffer(
364 tile->managed_state().resource->id()); 384 tile->managed_state().resource->id());
365 385
366 DidFinishTileInitialization(tile); 386 DidFinishTileInitialization(tile);
367 387
368 bytes_pending_set_pixels_ -= tile->bytes_consumed_if_allocated(); 388 bytes_pending_upload_ -= tile->bytes_consumed_if_allocated();
369 DidTileRasterStateChange(tile, IDLE_STATE); 389 DidTileRasterStateChange(tile, IDLE_STATE);
370 tiles_with_pending_set_pixels_.pop(); 390 tiles_with_pending_upload_.pop();
371 } 391 }
372 392
373 DispatchMoreTasks(); 393 DispatchMoreTasks();
374 } 394 }
375 395
376 void TileManager::GetMemoryStats( 396 void TileManager::GetMemoryStats(
377 size_t* memoryRequiredBytes, 397 size_t* memoryRequiredBytes,
378 size_t* memoryNiceToHaveBytes, 398 size_t* memoryNiceToHaveBytes,
379 size_t* memoryUsedBytes) const { 399 size_t* memoryUsedBytes) const {
380 *memoryRequiredBytes = 0; 400 *memoryRequiredBytes = 0;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 459
440 bool TileManager::HasPendingWorkScheduled(WhichTree tree) const { 460 bool TileManager::HasPendingWorkScheduled(WhichTree tree) const {
441 // Always true when ManageTiles() call is pending. 461 // Always true when ManageTiles() call is pending.
442 if (manage_tiles_pending_) 462 if (manage_tiles_pending_)
443 return true; 463 return true;
444 464
445 for (int i = 0; i < NUM_STATES; ++i) { 465 for (int i = 0; i < NUM_STATES; ++i) {
446 switch (i) { 466 switch (i) {
447 case WAITING_FOR_RASTER_STATE: 467 case WAITING_FOR_RASTER_STATE:
448 case RASTER_STATE: 468 case RASTER_STATE:
449 case SET_PIXELS_STATE: 469 case UPLOAD_STATE:
450 for (int j = 0; j < NEVER_BIN; ++j) { 470 for (int j = 0; j < NEVER_BIN; ++j) {
451 if (raster_state_count_[i][tree][j]) 471 if (raster_state_count_[i][tree][j])
452 return true; 472 return true;
453 } 473 }
454 break; 474 break;
455 case IDLE_STATE: 475 case IDLE_STATE:
456 break; 476 break;
457 default: 477 default:
458 NOTREACHED(); 478 NOTREACHED();
459 } 479 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 566 }
547 567
548 void TileManager::FreeResourcesForTile(Tile* tile) { 568 void TileManager::FreeResourcesForTile(Tile* tile) {
549 ManagedTileState& managed_tile_state = tile->managed_state(); 569 ManagedTileState& managed_tile_state = tile->managed_state();
550 DCHECK(managed_tile_state.can_be_freed); 570 DCHECK(managed_tile_state.can_be_freed);
551 if (managed_tile_state.resource) 571 if (managed_tile_state.resource)
552 resource_pool_->ReleaseResource(managed_tile_state.resource.Pass()); 572 resource_pool_->ReleaseResource(managed_tile_state.resource.Pass());
553 } 573 }
554 574
555 bool TileManager::CanDispatchRasterTask(Tile* tile) { 575 bool TileManager::CanDispatchRasterTask(Tile* tile) {
556 if (raster_worker_pool_->IsBusy()) 576 size_t new_raster_bytes_pending = bytes_pending_raster_;
577 new_raster_bytes_pending += tile->bytes_consumed_if_allocated();
578 if (new_raster_bytes_pending > kMaxPendingRasterBytes)
557 return false; 579 return false;
558 size_t new_bytes_pending = bytes_pending_set_pixels_; 580
559 new_bytes_pending += tile->bytes_consumed_if_allocated(); 581 size_t new_upload_bytes_pending = bytes_pending_upload_;
brianderson 2013/02/12 01:44:31 Shouldn't this be: size_t new_upload_bytes_pending
reveman 2013/02/12 02:29:52 makes sense.
560 return new_bytes_pending <= kMaxPendingUploadBytes; 582 new_upload_bytes_pending += tile->bytes_consumed_if_allocated();
583 if (new_upload_bytes_pending > kMaxPendingUploadBytes)
584 return false;
585
586 return true;
561 } 587 }
562 588
563 void TileManager::DispatchMoreTasks() { 589 void TileManager::DispatchMoreTasks() {
564 // Because tiles in the image decoding list have higher priorities, we 590 // Because tiles in the image decoding list have higher priorities, we
565 // need to process those tiles first before we start to handle the tiles 591 // need to process those tiles first before we start to handle the tiles
566 // in the need_to_be_rasterized queue. 592 // in the need_to_be_rasterized queue.
567 for(TileList::iterator it = tiles_with_image_decoding_tasks_.begin(); 593 for(TileList::iterator it = tiles_with_image_decoding_tasks_.begin();
568 it != tiles_with_image_decoding_tasks_.end(); ) { 594 it != tiles_with_image_decoding_tasks_.end(); ) {
569 DispatchImageDecodeTasksForTile(*it); 595 DispatchImageDecodeTasksForTile(*it);
570 ManagedTileState& managed_state = (*it)->managed_state(); 596 ManagedTileState& managed_state = (*it)->managed_state();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 if (pending_decode_tasks_.end() != pending_decode_tasks_.find( 650 if (pending_decode_tasks_.end() != pending_decode_tasks_.find(
625 (*it)->getGenerationID())) { 651 (*it)->getGenerationID())) {
626 ++it; 652 ++it;
627 continue; 653 continue;
628 } 654 }
629 // TODO(qinmin): passing correct image size to PrepareToDecode(). 655 // TODO(qinmin): passing correct image size to PrepareToDecode().
630 if ((*it)->PrepareToDecode(skia::LazyPixelRef::PrepareParams())) { 656 if ((*it)->PrepareToDecode(skia::LazyPixelRef::PrepareParams())) {
631 rendering_stats_.totalDeferredImageCacheHitCount++; 657 rendering_stats_.totalDeferredImageCacheHitCount++;
632 pending_pixel_refs.erase(it++); 658 pending_pixel_refs.erase(it++);
633 } else { 659 } else {
634 if (raster_worker_pool_->IsBusy()) 660 if (!CanDispatchRasterTask(tile))
635 return; 661 return;
636 DispatchOneImageDecodeTask(tile, *it); 662 DispatchOneImageDecodeTask(tile, *it);
637 ++it; 663 ++it;
638 } 664 }
639 } 665 }
640 } 666 }
641 667
642 void TileManager::DispatchOneImageDecodeTask( 668 void TileManager::DispatchOneImageDecodeTask(
643 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref) { 669 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref) {
644 TRACE_EVENT0("cc", "TileManager::DispatchOneImageDecodeTask"); 670 TRACE_EVENT0("cc", "TileManager::DispatchOneImageDecodeTask");
645 uint32_t pixel_ref_id = pixel_ref->getGenerationID(); 671 uint32_t pixel_ref_id = pixel_ref->getGenerationID();
646 DCHECK(pending_decode_tasks_.end() == 672 DCHECK(pending_decode_tasks_.end() ==
647 pending_decode_tasks_.find(pixel_ref_id)); 673 pending_decode_tasks_.find(pixel_ref_id));
648 pending_decode_tasks_[pixel_ref_id] = pixel_ref; 674 pending_decode_tasks_[pixel_ref_id] = pixel_ref;
649 675
650 raster_worker_pool_->PostTaskAndReply( 676 raster_worker_pool_->PostTaskAndReply(
651 base::Bind(&TileManager::RunImageDecodeTask, pixel_ref), 677 base::Bind(&TileManager::RunImageDecodeTask, pixel_ref),
652 base::Bind(&TileManager::OnImageDecodeTaskCompleted, 678 base::Bind(&TileManager::OnImageDecodeTaskCompleted,
653 base::Unretained(this), 679 base::Unretained(this),
654 tile, 680 tile,
655 pixel_ref_id)); 681 pixel_ref_id));
682
683 client_->ScheduleCheckForCompletedRasterTasks();
656 } 684 }
657 685
658 void TileManager::OnImageDecodeTaskCompleted( 686 void TileManager::OnImageDecodeTaskCompleted(
659 scoped_refptr<Tile> tile, uint32_t pixel_ref_id) { 687 scoped_refptr<Tile> tile, uint32_t pixel_ref_id) {
660 TRACE_EVENT0("cc", "TileManager::OnImageDecodeTaskCompleted"); 688 TRACE_EVENT0("cc", "TileManager::OnImageDecodeTaskCompleted");
661 pending_decode_tasks_.erase(pixel_ref_id); 689 pending_decode_tasks_.erase(pixel_ref_id);
662 690
663 for (TileList::iterator it = tiles_with_image_decoding_tasks_.begin(); 691 for (TileList::iterator it = tiles_with_image_decoding_tasks_.begin();
664 it != tiles_with_image_decoding_tasks_.end(); ++it) { 692 it != tiles_with_image_decoding_tasks_.end(); ++it) {
665 std::list<skia::LazyPixelRef*>& pixel_refs = 693 std::list<skia::LazyPixelRef*>& pixel_refs =
666 (*it)->managed_state().pending_pixel_refs; 694 (*it)->managed_state().pending_pixel_refs;
667 for (std::list<skia::LazyPixelRef*>::iterator pixel_it = 695 for (std::list<skia::LazyPixelRef*>::iterator pixel_it =
668 pixel_refs.begin(); pixel_it != pixel_refs.end(); ++pixel_it) { 696 pixel_refs.begin(); pixel_it != pixel_refs.end(); ++pixel_it) {
669 if (pixel_ref_id == (*pixel_it)->getGenerationID()) { 697 if (pixel_ref_id == (*pixel_it)->getGenerationID()) {
670 pixel_refs.erase(pixel_it); 698 pixel_refs.erase(pixel_it);
671 break; 699 break;
672 } 700 }
673 } 701 }
674 } 702 }
675
676 DispatchMoreTasks();
677 } 703 }
678 704
679 scoped_ptr<ResourcePool::Resource> TileManager::PrepareTileForRaster( 705 scoped_ptr<ResourcePool::Resource> TileManager::PrepareTileForRaster(
680 Tile* tile) { 706 Tile* tile) {
681 ManagedTileState& managed_tile_state = tile->managed_state(); 707 ManagedTileState& managed_tile_state = tile->managed_state();
682 DCHECK(managed_tile_state.can_use_gpu_memory); 708 DCHECK(managed_tile_state.can_use_gpu_memory);
683 scoped_ptr<ResourcePool::Resource> resource = 709 scoped_ptr<ResourcePool::Resource> resource =
684 resource_pool_->AcquireResource(tile->tile_size_.size(), tile->format_); 710 resource_pool_->AcquireResource(tile->tile_size_.size(), tile->format_);
685 resource_pool_->resource_provider()->acquirePixelBuffer(resource->id()); 711 resource_pool_->resource_provider()->acquirePixelBuffer(resource->id());
686 712
(...skipping 15 matching lines...) Expand all
702 resource_pool_->resource_provider()->mapPixelBuffer( 728 resource_pool_->resource_provider()->mapPixelBuffer(
703 resource_id), 729 resource_id),
704 tile->content_rect_, 730 tile->content_rect_,
705 tile->contents_scale(), 731 tile->contents_scale(),
706 use_cheapness_estimator_), 732 use_cheapness_estimator_),
707 base::Bind(&TileManager::OnRasterTaskCompleted, 733 base::Bind(&TileManager::OnRasterTaskCompleted,
708 base::Unretained(this), 734 base::Unretained(this),
709 tile, 735 tile,
710 base::Passed(&resource), 736 base::Passed(&resource),
711 manage_tiles_call_count_)); 737 manage_tiles_call_count_));
738
739 bytes_pending_raster_ += tile->bytes_consumed_if_allocated();
740 client_->ScheduleCheckForCompletedRasterTasks();
712 } 741 }
713 742
714 void TileManager::PerformOneRaster(Tile* tile) { 743 void TileManager::PerformOneRaster(Tile* tile) {
715 scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile); 744 scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile);
716 ResourceProvider::ResourceId resource_id = resource->id(); 745 ResourceProvider::ResourceId resource_id = resource->id();
717 746
718 PerformRaster(resource_pool_->resource_provider()->mapPixelBuffer( 747 PerformRaster(resource_pool_->resource_provider()->mapPixelBuffer(
719 resource_id), 748 resource_id),
720 tile->content_rect_, 749 tile->content_rect_,
721 tile->contents_scale(), 750 tile->contents_scale(),
(...skipping 30 matching lines...) Expand all
752 // The component order may be bgra if we're uploading bgra pixels to rgba 781 // The component order may be bgra if we're uploading bgra pixels to rgba
753 // texture. Mark contents as swizzled if image component order is 782 // texture. Mark contents as swizzled if image component order is
754 // different than texture format. 783 // different than texture format.
755 managed_tile_state.contents_swizzled = 784 managed_tile_state.contents_swizzled =
756 !PlatformColor::sameComponentOrder(tile->format_); 785 !PlatformColor::sameComponentOrder(tile->format_);
757 786
758 // Tile resources can't be freed until upload has completed. 787 // Tile resources can't be freed until upload has completed.
759 managed_tile_state.can_be_freed = false; 788 managed_tile_state.can_be_freed = false;
760 789
761 resource_pool_->resource_provider()->beginSetPixels(resource->id()); 790 resource_pool_->resource_provider()->beginSetPixels(resource->id());
762 resource_pool_->resource_provider()->shallowFlushIfSupported();
763 managed_tile_state.resource = resource.Pass(); 791 managed_tile_state.resource = resource.Pass();
764 792
765 bytes_pending_set_pixels_ += tile->bytes_consumed_if_allocated(); 793 bytes_pending_upload_ += tile->bytes_consumed_if_allocated();
766 DidTileRasterStateChange(tile, SET_PIXELS_STATE); 794 DidTileRasterStateChange(tile, UPLOAD_STATE);
767 tiles_with_pending_set_pixels_.push(tile); 795 tiles_with_pending_upload_.push(tile);
768 } else { 796 } else {
769 resource_pool_->resource_provider()->releasePixelBuffer(resource->id()); 797 resource_pool_->resource_provider()->releasePixelBuffer(resource->id());
770 resource_pool_->ReleaseResource(resource.Pass()); 798 resource_pool_->ReleaseResource(resource.Pass());
771 managed_tile_state.resource_is_being_initialized = false; 799 managed_tile_state.resource_is_being_initialized = false;
772 DidTileRasterStateChange(tile, IDLE_STATE); 800 DidTileRasterStateChange(tile, IDLE_STATE);
773 } 801 }
774 } 802 }
775 803
776 void TileManager::OnRasterTaskCompleted( 804 void TileManager::OnRasterTaskCompleted(
777 scoped_refptr<Tile> tile, 805 scoped_refptr<Tile> tile,
778 scoped_ptr<ResourcePool::Resource> resource, 806 scoped_ptr<ResourcePool::Resource> resource,
779 int manage_tiles_call_count_when_dispatched) { 807 int manage_tiles_call_count_when_dispatched) {
808 bytes_pending_raster_ -= tile->bytes_consumed_if_allocated();
780 OnRasterCompleted(tile, resource.Pass(), 809 OnRasterCompleted(tile, resource.Pass(),
781 manage_tiles_call_count_when_dispatched); 810 manage_tiles_call_count_when_dispatched);
782 DispatchMoreTasks();
783 } 811 }
784 812
785 void TileManager::DidFinishTileInitialization(Tile* tile) { 813 void TileManager::DidFinishTileInitialization(Tile* tile) {
786 ManagedTileState& managed_tile_state = tile->managed_state(); 814 ManagedTileState& managed_tile_state = tile->managed_state();
787 DCHECK(managed_tile_state.resource); 815 DCHECK(managed_tile_state.resource);
788 managed_tile_state.resource_is_being_initialized = false; 816 managed_tile_state.resource_is_being_initialized = false;
789 managed_tile_state.can_be_freed = true; 817 managed_tile_state.can_be_freed = true;
790 } 818 }
791 819
792 void TileManager::DidTileRasterStateChange(Tile* tile, TileRasterState state) { 820 void TileManager::DidTileRasterStateChange(Tile* tile, TileRasterState state) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 decode_begin_time = base::TimeTicks::Now(); 913 decode_begin_time = base::TimeTicks::Now();
886 pixel_ref->Decode(); 914 pixel_ref->Decode();
887 if (stats) { 915 if (stats) {
888 stats->totalDeferredImageDecodeCount++; 916 stats->totalDeferredImageDecodeCount++;
889 stats->totalDeferredImageDecodeTime += 917 stats->totalDeferredImageDecodeTime +=
890 base::TimeTicks::Now() - decode_begin_time; 918 base::TimeTicks::Now() - decode_begin_time;
891 } 919 }
892 } 920 }
893 921
894 } // namespace cc 922 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698