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

Side by Side Diff: cc/tile_manager.cc

Issue 12194015: cc: Rasterize cheap tiles immediately (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Trace event for cheap rasters that weren't. 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
« cc/tile_manager.h ('K') | « cc/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/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 16 matching lines...) Expand all
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 #else 33 #else
34 const int kMaxPendingUploadBytes = 100 * 1024 * 1024; 34 const int kMaxPendingUploadBytes = 100 * 1024 * 1024;
35 #endif 35 #endif
36 36
37 // Limit the total number of cheap tile rasterizations we are allowed to perform
38 // during a single frame as well as the time spent rasterizing.
39 // TODO(skyostil): Determine these limits more dynamically.
40 const int kMaxCheapRasterCount = 6;
41 const int kMaxCheapRasterMilliseconds = 6;
42
43 // Expected time for a cheap tile raster. Only used for tracing.
44 const int kExpectedCheapRasterMilliseconds = 2;
nduca 2013/02/06 08:34:57 I've been working off of 1. Why 2?
Sami 2013/02/06 15:25:14 Tom was telling me his heuristic gave 1 ms rasters
45
37 // Determine bin based on three categories of tiles: things we need now, 46 // Determine bin based on three categories of tiles: things we need now,
38 // things we need soon, and eventually. 47 // things we need soon, and eventually.
39 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) { 48 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) {
40 if (!prio.is_live) 49 if (!prio.is_live)
41 return NEVER_BIN; 50 return NEVER_BIN;
42 51
43 // The amount of time for which we want to have prepainting coverage. 52 // The amount of time for which we want to have prepainting coverage.
44 const double prepainting_window_time_seconds = 1.0; 53 const double prepainting_window_time_seconds = 1.0;
45 const double backfling_guard_distance_pixels = 314.0; 54 const double backfling_guard_distance_pixels = 314.0;
46 55
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 118
110 ManagedTileState::~ManagedTileState() { 119 ManagedTileState::~ManagedTileState() {
111 DCHECK(!resource); 120 DCHECK(!resource);
112 DCHECK(!resource_is_being_initialized); 121 DCHECK(!resource_is_being_initialized);
113 } 122 }
114 123
115 TileManager::TileManager( 124 TileManager::TileManager(
116 TileManagerClient* client, 125 TileManagerClient* client,
117 ResourceProvider* resource_provider, 126 ResourceProvider* resource_provider,
118 size_t num_raster_threads, 127 size_t num_raster_threads,
119 bool record_rendering_stats) 128 bool record_rendering_stats,
129 bool use_cheapness_estimator)
120 : client_(client), 130 : client_(client),
121 resource_pool_(ResourcePool::Create(resource_provider)), 131 resource_pool_(ResourcePool::Create(resource_provider)),
122 raster_worker_pool_(RasterWorkerPool::Create(num_raster_threads, record_re ndering_stats)), 132 raster_worker_pool_(RasterWorkerPool::Create(num_raster_threads, record_re ndering_stats)),
123 manage_tiles_pending_(false), 133 manage_tiles_pending_(false),
124 manage_tiles_call_count_(0), 134 manage_tiles_call_count_(0),
125 bytes_pending_set_pixels_(0), 135 bytes_pending_set_pixels_(0),
126 ever_exceeded_memory_budget_(false), 136 ever_exceeded_memory_budget_(false),
127 record_rendering_stats_(record_rendering_stats) { 137 record_rendering_stats_(record_rendering_stats),
138 use_cheapness_estimator_(use_cheapness_estimator),
139 cheap_raster_count_(0) {
128 for (int i = 0; i < NUM_STATES; ++i) { 140 for (int i = 0; i < NUM_STATES; ++i) {
129 for (int j = 0; j < NUM_TREES; ++j) { 141 for (int j = 0; j < NUM_TREES; ++j) {
130 for (int k = 0; k < NUM_BINS; ++k) 142 for (int k = 0; k < NUM_BINS; ++k)
131 raster_state_count_[i][j][k] = 0; 143 raster_state_count_[i][j][k] = 0;
132 } 144 }
133 } 145 }
134 } 146 }
135 147
136 TileManager::~TileManager() { 148 TileManager::~TileManager() {
137 // Reset global state and manage. This should cause 149 // Reset global state and manage. This should cause
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 DidFinishTileInitialization(tile); 345 DidFinishTileInitialization(tile);
334 346
335 bytes_pending_set_pixels_ -= tile->bytes_consumed_if_allocated(); 347 bytes_pending_set_pixels_ -= tile->bytes_consumed_if_allocated();
336 DidTileRasterStateChange(tile, IDLE_STATE); 348 DidTileRasterStateChange(tile, IDLE_STATE);
337 tiles_with_pending_set_pixels_.pop(); 349 tiles_with_pending_set_pixels_.pop();
338 } 350 }
339 351
340 DispatchMoreTasks(); 352 DispatchMoreTasks();
341 } 353 }
342 354
355 void TileManager::ResetCheapRasterBudget() {
356 cheap_raster_count_ = 0;
357 cheap_raster_time_ = base::TimeDelta();
358 }
359
343 void TileManager::GetMemoryStats( 360 void TileManager::GetMemoryStats(
344 size_t* memoryRequiredBytes, 361 size_t* memoryRequiredBytes,
345 size_t* memoryNiceToHaveBytes, 362 size_t* memoryNiceToHaveBytes,
346 size_t* memoryUsedBytes) const { 363 size_t* memoryUsedBytes) const {
347 *memoryRequiredBytes = 0; 364 *memoryRequiredBytes = 0;
348 *memoryNiceToHaveBytes = 0; 365 *memoryNiceToHaveBytes = 0;
349 *memoryUsedBytes = 0; 366 *memoryUsedBytes = 0;
350 for(size_t i = 0; i < tiles_.size(); i++) { 367 for(size_t i = 0; i < tiles_.size(); i++) {
351 const Tile* tile = tiles_[i]; 368 const Tile* tile = tiles_[i];
352 const ManagedTileState& mts = tile->managed_state(); 369 const ManagedTileState& mts = tile->managed_state();
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 tiles_that_need_to_be_rasterized_.end()); 519 tiles_that_need_to_be_rasterized_.end());
503 } 520 }
504 521
505 void TileManager::FreeResourcesForTile(Tile* tile) { 522 void TileManager::FreeResourcesForTile(Tile* tile) {
506 ManagedTileState& managed_tile_state = tile->managed_state(); 523 ManagedTileState& managed_tile_state = tile->managed_state();
507 DCHECK(managed_tile_state.can_be_freed); 524 DCHECK(managed_tile_state.can_be_freed);
508 if (managed_tile_state.resource) 525 if (managed_tile_state.resource)
509 resource_pool_->ReleaseResource(managed_tile_state.resource.Pass()); 526 resource_pool_->ReleaseResource(managed_tile_state.resource.Pass());
510 } 527 }
511 528
512 bool TileManager::CanDispatchRasterTask(Tile* tile) { 529 bool TileManager::CanDispatchRasterTask(Tile* tile) const {
513 if (raster_worker_pool_->IsBusy()) 530 if (raster_worker_pool_->IsBusy())
514 return false; 531 return false;
515 size_t new_bytes_pending = bytes_pending_set_pixels_; 532 size_t new_bytes_pending = bytes_pending_set_pixels_;
516 new_bytes_pending += tile->bytes_consumed_if_allocated(); 533 new_bytes_pending += tile->bytes_consumed_if_allocated();
517 return new_bytes_pending <= kMaxPendingUploadBytes; 534 return new_bytes_pending <= kMaxPendingUploadBytes;
518 } 535 }
519 536
537 bool TileManager::CanPerformCheapRaster(Tile* tile) const {
538 if (!use_cheapness_estimator_)
539 return false;
540 if (global_state_.tree_priority == SMOOTHNESS_TAKES_PRIORITY) {
nduca 2013/02/06 08:34:57 I'm not convinced of this part. Please remove and
Sami 2013/02/06 15:25:14 Okay, let's keep things simple.
541 TRACE_EVENT_INSTANT0(
542 "cc", "TileManager::CanPerformCheapRaster smoothness");
543 return false;
544 }
545 // TODO(skyostil): Use synchronous uploads for inline rasters.
nduca 2013/02/06 08:34:57 dont see why this todo is relevant here... sync up
Sami 2013/02/06 15:25:14 It's referring to the check against the total allo
546 size_t new_bytes_pending = bytes_pending_set_pixels_;
547 new_bytes_pending += tile->bytes_consumed_if_allocated();
548 if (new_bytes_pending > kMaxPendingUploadBytes)
549 return false;
550 if (cheap_raster_count_ >= kMaxCheapRasterCount) {
551 TRACE_EVENT_INSTANT0(
552 "cc", "TileManager::CanPerformCheapRaster too many rasters");
553 return false;
554 }
555 base::TimeDelta maxCheapRasterTime =
reveman 2013/02/05 20:59:13 nit: max_cheap_raster_time please
Sami 2013/02/06 15:25:14 Done (moved to lthi).
556 base::TimeDelta::FromMilliseconds(kMaxCheapRasterMilliseconds);
557 if (cheap_raster_time_ >= maxCheapRasterTime) {
reveman 2013/02/05 20:59:13 would we get better accuracy if we recorded a "che
Sami 2013/02/06 15:25:14 Good point, we could easily use more real time if
558 TRACE_EVENT_INSTANT0(
559 "cc", "TileManager::CanPerformCheapRaster out of time");
560 return false;
561 }
562 if (!tile->picture_pile()->IsCheapInRect(tile->content_rect_,
563 tile->contents_scale())) {
564 TRACE_EVENT_INSTANT0("cc", "TileManager::CanPerformCheapRaster not cheap");
nduca 2013/02/06 08:34:57 please remove and integrate with what vlad did in
Sami 2013/02/06 15:25:14 Done.
565 return false;
566 }
567 return true;
568 }
569
520 void TileManager::DispatchMoreTasks() { 570 void TileManager::DispatchMoreTasks() {
521 // Because tiles in the image decoding list have higher priorities, we 571 // Because tiles in the image decoding list have higher priorities, we
522 // need to process those tiles first before we start to handle the tiles 572 // need to process those tiles first before we start to handle the tiles
523 // in the need_to_be_rasterized queue. 573 // in the need_to_be_rasterized queue.
524 for(TileList::iterator it = tiles_with_image_decoding_tasks_.begin(); 574 for(TileList::iterator it = tiles_with_image_decoding_tasks_.begin();
525 it != tiles_with_image_decoding_tasks_.end(); ) { 575 it != tiles_with_image_decoding_tasks_.end(); ) {
526 DispatchImageDecodeTasksForTile(*it); 576 DispatchImageDecodeTasksForTile(*it);
527 ManagedTileState& managed_state = (*it)->managed_state(); 577 ManagedTileState& managed_state = (*it)->managed_state();
528 if (managed_state.pending_pixel_refs.empty()) { 578 if (managed_state.pending_pixel_refs.empty()) {
529 if (!CanDispatchRasterTask(*it)) 579 if (!CanDispatchRasterTask(*it))
530 return; 580 return;
531 DispatchOneRasterTask(*it); 581 DispatchOneRasterTask(*it);
reveman 2013/02/05 20:59:13 how about these tiles? are tiles with images never
Sami 2013/02/06 15:25:14 Oops, I think I misread this code earlier as only
532 tiles_with_image_decoding_tasks_.erase(it++); 582 tiles_with_image_decoding_tasks_.erase(it++);
533 } else { 583 } else {
534 ++it; 584 ++it;
535 } 585 }
536 } 586 }
537 587
538 // Process all tiles in the need_to_be_rasterized queue. If a tile has 588 // Process all tiles in the need_to_be_rasterized queue. If a tile has
539 // image decoding tasks, put it to the back of the image decoding list. 589 // image decoding tasks, put it to the back of the image decoding list.
540 while (!tiles_that_need_to_be_rasterized_.empty()) { 590 while (!tiles_that_need_to_be_rasterized_.empty()) {
541 Tile* tile = tiles_that_need_to_be_rasterized_.back(); 591 Tile* tile = tiles_that_need_to_be_rasterized_.back();
542 DispatchImageDecodeTasksForTile(tile); 592 DispatchImageDecodeTasksForTile(tile);
543 ManagedTileState& managed_state = tile->managed_state(); 593 ManagedTileState& managed_state = tile->managed_state();
544 if (!managed_state.pending_pixel_refs.empty()) { 594 if (!managed_state.pending_pixel_refs.empty()) {
545 tiles_with_image_decoding_tasks_.push_back(tile); 595 tiles_with_image_decoding_tasks_.push_back(tile);
596 } else if (CanPerformCheapRaster(tile)) {
597 cheap_raster_count_++;
598 DCHECK(cheap_raster_count_ <= kMaxCheapRasterCount);
599 base::TimeTicks begin_time = base::TimeTicks::Now();
reveman 2013/02/05 20:59:13 we recently made sure not to call base::TimeTicks:
Sami 2013/02/06 15:25:14 I'm not sure how else to keep track of time spent
600 PerformOneRaster(tile);
601 base::TimeTicks end_time = base::TimeTicks::Now();
602 base::TimeDelta duration = end_time - begin_time;
603 base::TimeDelta expectedCheapRasterTime =
reveman 2013/02/05 20:59:13 nit: expected_cheap_raster_time
Sami 2013/02/06 15:25:14 Done (moved to lthi).
604 base::TimeDelta::FromMilliseconds(kExpectedCheapRasterMilliseconds);
nduca 2013/02/06 08:34:57 is this duplicative? you've got the same boookeepi
Sami 2013/02/06 15:25:14 Yeah, no need for this now that Vlad's patch lande
605 if (duration > expectedCheapRasterTime) {
606 TRACE_EVENT_INSTANT0(
607 "cc", "TileManager::DispatchMoreTasks raster was not cheap");
608 }
609 cheap_raster_time_ += duration;
546 } else { 610 } else {
547 if (!CanDispatchRasterTask(tile)) 611 if (!CanDispatchRasterTask(tile))
548 return; 612 return;
549 DispatchOneRasterTask(tile); 613 DispatchOneRasterTask(tile);
550 } 614 }
551 tiles_that_need_to_be_rasterized_.pop_back(); 615 tiles_that_need_to_be_rasterized_.pop_back();
552 } 616 }
553 } 617 }
554 618
555 void TileManager::GatherPixelRefsForTile(Tile* tile) { 619 void TileManager::GatherPixelRefsForTile(Tile* tile) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 if (pixel_ref_id == (*pixel_it)->getGenerationID()) { 690 if (pixel_ref_id == (*pixel_it)->getGenerationID()) {
627 pixel_refs.erase(pixel_it); 691 pixel_refs.erase(pixel_it);
628 break; 692 break;
629 } 693 }
630 } 694 }
631 } 695 }
632 696
633 DispatchMoreTasks(); 697 DispatchMoreTasks();
634 } 698 }
635 699
636 void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) { 700 scoped_ptr<ResourcePool::Resource> TileManager::PrepareTileForRaster(
637 TRACE_EVENT0("cc", "TileManager::DispatchOneRasterTask"); 701 Tile* tile) {
638 ManagedTileState& managed_tile_state = tile->managed_state(); 702 ManagedTileState& managed_tile_state = tile->managed_state();
639 DCHECK(managed_tile_state.can_use_gpu_memory); 703 DCHECK(managed_tile_state.can_use_gpu_memory);
640 scoped_ptr<ResourcePool::Resource> resource = 704 scoped_ptr<ResourcePool::Resource> resource =
641 resource_pool_->AcquireResource(tile->tile_size_.size(), tile->format_); 705 resource_pool_->AcquireResource(tile->tile_size_.size(), tile->format_);
642 resource_pool_->resource_provider()->acquirePixelBuffer(resource->id()); 706 resource_pool_->resource_provider()->acquirePixelBuffer(resource->id());
643 707
644 managed_tile_state.resource_is_being_initialized = true; 708 managed_tile_state.resource_is_being_initialized = true;
645 managed_tile_state.can_be_freed = false; 709 managed_tile_state.can_be_freed = false;
646 710
647 DidTileRasterStateChange(tile, RASTER_STATE); 711 DidTileRasterStateChange(tile, RASTER_STATE);
712 return resource.Pass();
713 }
648 714
715 void TileManager::DispatchOneRasterTask(scoped_refptr<Tile> tile) {
716 TRACE_EVENT0("cc", "TileManager::DispatchOneRasterTask");
717 scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile);
649 ResourceProvider::ResourceId resource_id = resource->id(); 718 ResourceProvider::ResourceId resource_id = resource->id();
650 719
651 raster_worker_pool_->PostRasterTaskAndReply( 720 raster_worker_pool_->PostRasterTaskAndReply(
652 tile->picture_pile(), 721 tile->picture_pile(),
653 base::Bind(&TileManager::RunRasterTask, 722 base::Bind(&TileManager::PerformRaster,
654 resource_pool_->resource_provider()->mapPixelBuffer( 723 resource_pool_->resource_provider()->mapPixelBuffer(
655 resource_id), 724 resource_id),
656 tile->content_rect_, 725 tile->content_rect_,
657 tile->contents_scale()), 726 tile->contents_scale()),
658 base::Bind(&TileManager::OnRasterTaskCompleted, 727 base::Bind(&TileManager::OnRasterTaskCompleted,
659 base::Unretained(this), 728 base::Unretained(this),
660 tile, 729 tile,
661 base::Passed(&resource), 730 base::Passed(&resource),
662 manage_tiles_call_count_)); 731 manage_tiles_call_count_));
663 } 732 }
664 733
665 void TileManager::OnRasterTaskCompleted( 734 void TileManager::PerformOneRaster(Tile* tile) {
735 scoped_ptr<ResourcePool::Resource> resource = PrepareTileForRaster(tile);
736 ResourceProvider::ResourceId resource_id = resource->id();
737
738 PerformRaster(resource_pool_->resource_provider()->mapPixelBuffer(
739 resource_id),
740 tile->content_rect_,
741 tile->contents_scale(),
742 tile->picture_pile(),
743 &rendering_stats_);
744
745 OnRasterCompleted(tile, resource.Pass(), manage_tiles_call_count_);
746 }
747
748 void TileManager::OnRasterCompleted(
666 scoped_refptr<Tile> tile, 749 scoped_refptr<Tile> tile,
667 scoped_ptr<ResourcePool::Resource> resource, 750 scoped_ptr<ResourcePool::Resource> resource,
668 int manage_tiles_call_count_when_dispatched) { 751 int manage_tiles_call_count_when_dispatched) {
669 TRACE_EVENT0("cc", "TileManager::OnRasterTaskCompleted"); 752 TRACE_EVENT0("cc", "TileManager::OnRasterCompleted");
670 753
671 // Release raster resources. 754 // Release raster resources.
672 resource_pool_->resource_provider()->unmapPixelBuffer(resource->id()); 755 resource_pool_->resource_provider()->unmapPixelBuffer(resource->id());
673 756
674 ManagedTileState& managed_tile_state = tile->managed_state(); 757 ManagedTileState& managed_tile_state = tile->managed_state();
675 managed_tile_state.can_be_freed = true; 758 managed_tile_state.can_be_freed = true;
676 759
677 // Tile can be freed after the completion of the raster task. Call 760 // Tile can be freed after the completion of the raster task. Call
678 // AssignGpuMemoryToTiles() to re-assign gpu memory to highest priority 761 // AssignGpuMemoryToTiles() to re-assign gpu memory to highest priority
679 // tiles if ManageTiles() was called since task was dispatched. The result 762 // tiles if ManageTiles() was called since task was dispatched. The result
(...skipping 20 matching lines...) Expand all
700 783
701 bytes_pending_set_pixels_ += tile->bytes_consumed_if_allocated(); 784 bytes_pending_set_pixels_ += tile->bytes_consumed_if_allocated();
702 DidTileRasterStateChange(tile, SET_PIXELS_STATE); 785 DidTileRasterStateChange(tile, SET_PIXELS_STATE);
703 tiles_with_pending_set_pixels_.push(tile); 786 tiles_with_pending_set_pixels_.push(tile);
704 } else { 787 } else {
705 resource_pool_->resource_provider()->releasePixelBuffer(resource->id()); 788 resource_pool_->resource_provider()->releasePixelBuffer(resource->id());
706 resource_pool_->ReleaseResource(resource.Pass()); 789 resource_pool_->ReleaseResource(resource.Pass());
707 managed_tile_state.resource_is_being_initialized = false; 790 managed_tile_state.resource_is_being_initialized = false;
708 DidTileRasterStateChange(tile, IDLE_STATE); 791 DidTileRasterStateChange(tile, IDLE_STATE);
709 } 792 }
793 }
710 794
795 void TileManager::OnRasterTaskCompleted(
796 scoped_refptr<Tile> tile,
797 scoped_ptr<ResourcePool::Resource> resource,
798 int manage_tiles_call_count_when_dispatched) {
799 OnRasterCompleted(tile, resource.Pass(),
800 manage_tiles_call_count_when_dispatched);
711 DispatchMoreTasks(); 801 DispatchMoreTasks();
712 } 802 }
713 803
714 void TileManager::DidFinishTileInitialization(Tile* tile) { 804 void TileManager::DidFinishTileInitialization(Tile* tile) {
715 ManagedTileState& managed_tile_state = tile->managed_state(); 805 ManagedTileState& managed_tile_state = tile->managed_state();
716 DCHECK(managed_tile_state.resource); 806 DCHECK(managed_tile_state.resource);
717 managed_tile_state.resource_is_being_initialized = false; 807 managed_tile_state.resource_is_being_initialized = false;
718 managed_tile_state.can_be_freed = true; 808 managed_tile_state.can_be_freed = true;
719 } 809 }
720 810
(...skipping 22 matching lines...) Expand all
743 --raster_state_count_[mts.raster_state][tree][mts.tree_bin[tree]]; 833 --raster_state_count_[mts.raster_state][tree][mts.tree_bin[tree]];
744 DCHECK_GE(raster_state_count_[mts.raster_state][tree][mts.tree_bin[tree]], 0); 834 DCHECK_GE(raster_state_count_[mts.raster_state][tree][mts.tree_bin[tree]], 0);
745 835
746 // Increment count for new bin. 836 // Increment count for new bin.
747 ++raster_state_count_[mts.raster_state][tree][bin]; 837 ++raster_state_count_[mts.raster_state][tree][bin];
748 838
749 mts.tree_bin[tree] = bin; 839 mts.tree_bin[tree] = bin;
750 } 840 }
751 841
752 // static 842 // static
753 void TileManager::RunRasterTask(uint8* buffer, 843 void TileManager::PerformRaster(uint8* buffer,
754 const gfx::Rect& rect, 844 const gfx::Rect& rect,
755 float contents_scale, 845 float contents_scale,
756 PicturePileImpl* picture_pile, 846 PicturePileImpl* picture_pile,
757 RenderingStats* stats) { 847 RenderingStats* stats) {
758 TRACE_EVENT0("cc", "TileManager::RunRasterTask"); 848 TRACE_EVENT0("cc", "TileManager::PerformRaster");
759 DCHECK(picture_pile); 849 DCHECK(picture_pile);
760 DCHECK(buffer); 850 DCHECK(buffer);
761 SkBitmap bitmap; 851 SkBitmap bitmap;
762 bitmap.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height()); 852 bitmap.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height());
763 bitmap.setPixels(buffer); 853 bitmap.setPixels(buffer);
764 SkDevice device(bitmap); 854 SkDevice device(bitmap);
765 SkCanvas canvas(&device); 855 SkCanvas canvas(&device);
766 856
767 base::TimeTicks begin_time; 857 base::TimeTicks begin_time;
768 if (stats) 858 if (stats)
(...skipping 22 matching lines...) Expand all
791 decode_begin_time = base::TimeTicks::Now(); 881 decode_begin_time = base::TimeTicks::Now();
792 pixel_ref->Decode(); 882 pixel_ref->Decode();
793 if (stats) { 883 if (stats) {
794 stats->totalDeferredImageDecodeCount++; 884 stats->totalDeferredImageDecodeCount++;
795 stats->totalDeferredImageDecodeTime += 885 stats->totalDeferredImageDecodeTime +=
796 base::TimeTicks::Now() - decode_begin_time; 886 base::TimeTicks::Now() - decode_begin_time;
797 } 887 }
798 } 888 }
799 889
800 } // namespace cc 890 } // namespace cc
OLDNEW
« cc/tile_manager.h ('K') | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698