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/resources/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "cc/debug/devtools_instrumentation.h" | 14 #include "cc/debug/devtools_instrumentation.h" |
15 #include "cc/debug/traced_value.h" | 15 #include "cc/debug/traced_value.h" |
16 #include "cc/resources/image_raster_worker_pool.h" | 16 #include "cc/resources/image_raster_worker_pool.h" |
17 #include "cc/resources/pixel_buffer_raster_worker_pool.h" | 17 #include "cc/resources/pixel_buffer_raster_worker_pool.h" |
18 #include "cc/resources/tile.h" | 18 #include "cc/resources/tile.h" |
19 #include "skia/ext/paint_simplifier.h" | |
19 #include "third_party/skia/include/core/SkCanvas.h" | 20 #include "third_party/skia/include/core/SkCanvas.h" |
20 #include "ui/gfx/rect_conversions.h" | 21 #include "ui/gfx/rect_conversions.h" |
21 | 22 |
22 namespace cc { | 23 namespace cc { |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
27 class DisableLCDTextFilter : public SkDrawFilter { | |
28 public: | |
29 // SkDrawFilter interface. | |
30 virtual bool filter(SkPaint* paint, SkDrawFilter::Type type) OVERRIDE { | |
31 if (type != SkDrawFilter::kText_Type) | |
32 return true; | |
33 | |
34 paint->setLCDRenderText(false); | |
35 return true; | |
36 } | |
37 }; | |
38 | |
26 // 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, |
27 // things we need soon, and eventually. | 40 // things we need soon, and eventually. |
28 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) { | 41 inline TileManagerBin BinFromTilePriority(const TilePriority& prio) { |
29 // The amount of time for which we want to have prepainting coverage. | 42 // The amount of time for which we want to have prepainting coverage. |
30 const float kPrepaintingWindowTimeSeconds = 1.0f; | 43 const float kPrepaintingWindowTimeSeconds = 1.0f; |
31 const float kBackflingGuardDistancePixels = 314.0f; | 44 const float kBackflingGuardDistancePixels = 314.0f; |
32 | 45 |
33 if (prio.time_to_visible_in_seconds == 0) | 46 if (prio.time_to_visible_in_seconds == 0) |
34 return NOW_BIN; | 47 return NOW_BIN; |
35 | 48 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 } | 399 } |
387 | 400 |
388 void TileManager::AddRequiredTileForActivation(Tile* tile) { | 401 void TileManager::AddRequiredTileForActivation(Tile* tile) { |
389 DCHECK(std::find(tiles_that_need_to_be_initialized_for_activation_.begin(), | 402 DCHECK(std::find(tiles_that_need_to_be_initialized_for_activation_.begin(), |
390 tiles_that_need_to_be_initialized_for_activation_.end(), | 403 tiles_that_need_to_be_initialized_for_activation_.end(), |
391 tile) == | 404 tile) == |
392 tiles_that_need_to_be_initialized_for_activation_.end()); | 405 tiles_that_need_to_be_initialized_for_activation_.end()); |
393 tiles_that_need_to_be_initialized_for_activation_.insert(tile); | 406 tiles_that_need_to_be_initialized_for_activation_.insert(tile); |
394 } | 407 } |
395 | 408 |
409 unsigned TileManager::DetermineRasterFlags(const Tile* tile) const { | |
reveman
2013/06/04 20:16:08
does this need to be a member function? if not, co
vmpstr
2013/06/04 22:26:04
It's a member because it's using Tile's friend Til
| |
410 DCHECK(tile); | |
411 DCHECK(tile->picture_pile()); | |
412 | |
413 unsigned raster_flags = 0; | |
414 if (tile->picture_pile()->can_use_lcd_text()) | |
415 raster_flags |= USE_LCD_TEXT; | |
416 | |
417 if (tile->managed_state().resolution != LOW_RESOLUTION) | |
418 raster_flags |= USE_HIGH_QUALITY; | |
419 return raster_flags; | |
420 } | |
421 | |
396 void TileManager::AssignGpuMemoryToTiles() { | 422 void TileManager::AssignGpuMemoryToTiles() { |
397 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles"); | 423 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles"); |
398 | 424 |
399 // Now give memory out to the tiles until we're out, and build | 425 // Now give memory out to the tiles until we're out, and build |
400 // the needs-to-be-rasterized queue. | 426 // the needs-to-be-rasterized queue. |
401 tiles_that_need_to_be_rasterized_.clear(); | 427 tiles_that_need_to_be_rasterized_.clear(); |
402 tiles_that_need_to_be_initialized_for_activation_.clear(); | 428 tiles_that_need_to_be_initialized_for_activation_.clear(); |
403 | 429 |
404 size_t bytes_releasable = 0; | 430 size_t bytes_releasable = 0; |
405 for (TileVector::const_iterator it = tiles_.begin(); | 431 for (TileVector::const_iterator it = tiles_.begin(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 FreeResourcesForTile(tile); | 466 FreeResourcesForTile(tile); |
441 continue; | 467 continue; |
442 } | 468 } |
443 | 469 |
444 size_t tile_bytes = 0; | 470 size_t tile_bytes = 0; |
445 | 471 |
446 // It costs to maintain a resource. | 472 // It costs to maintain a resource. |
447 if (tile_version.resource_) | 473 if (tile_version.resource_) |
448 tile_bytes += tile->bytes_consumed_if_allocated(); | 474 tile_bytes += tile->bytes_consumed_if_allocated(); |
449 | 475 |
476 unsigned current_raster_flags = tile_version.raster_flags_; | |
477 unsigned required_raster_flags = DetermineRasterFlags(tile); | |
478 | |
450 // It will cost to allocate a resource. | 479 // It will cost to allocate a resource. |
451 // Note that this is separate from the above condition, | 480 if (mts.raster_task.is_null() && |
452 // so that it's clear why we're adding memory. | 481 (!tile_version.resource_ || |
453 if (!tile_version.resource_ && mts.raster_task.is_null()) | 482 (current_raster_flags != required_raster_flags))) { |
454 tile_bytes += tile->bytes_consumed_if_allocated(); | 483 tile_bytes += tile->bytes_consumed_if_allocated(); |
484 } | |
455 | 485 |
456 // Tile is OOM. | 486 // Tile is OOM. |
457 if (tile_bytes > bytes_left) { | 487 if (tile_bytes > bytes_left) { |
458 tile->tile_version().set_rasterize_on_demand(); | 488 tile->tile_version().set_rasterize_on_demand(); |
459 if (mts.tree_bin[PENDING_TREE] == NOW_BIN) { | 489 if (mts.tree_bin[PENDING_TREE] == NOW_BIN) { |
460 tiles_requiring_memory_but_oomed.push_back(tile); | 490 tiles_requiring_memory_but_oomed.push_back(tile); |
461 bytes_oom_in_now_bin_on_pending_tree += tile_bytes; | 491 bytes_oom_in_now_bin_on_pending_tree += tile_bytes; |
462 } | 492 } |
463 FreeResourcesForTile(tile); | 493 FreeResourcesForTile(tile); |
464 higher_priority_tile_oomed = true; | 494 higher_priority_tile_oomed = true; |
465 continue; | 495 continue; |
466 } | 496 } |
467 | 497 |
468 tile_version.set_use_resource(); | 498 tile_version.set_use_resource(); |
469 bytes_left -= tile_bytes; | 499 bytes_left -= tile_bytes; |
470 | 500 |
471 // Tile shouldn't be rasterized if we've failed to assign | 501 // Tile shouldn't be rasterized if we've failed to assign |
472 // gpu memory to a higher priority tile. This is important for | 502 // gpu memory to a higher priority tile. This is important for |
473 // two reasons: | 503 // two reasons: |
474 // 1. Tile size should not impact raster priority. | 504 // 1. Tile size should not impact raster priority. |
475 // 2. Tile with unreleasable memory could otherwise incorrectly | 505 // 2. Tile with unreleasable memory could otherwise incorrectly |
476 // be added as it's not affected by |bytes_allocatable|. | 506 // be added as it's not affected by |bytes_allocatable|. |
477 if (higher_priority_tile_oomed) | 507 if (higher_priority_tile_oomed) |
478 continue; | 508 continue; |
479 | 509 |
480 if (!tile_version.resource_) | 510 if (!tile_version.resource_ || |
511 (current_raster_flags != required_raster_flags)) { | |
481 tiles_that_need_to_be_rasterized_.push_back(tile); | 512 tiles_that_need_to_be_rasterized_.push_back(tile); |
513 } | |
482 | 514 |
483 if (!tile_version.resource_ && tile->required_for_activation()) | 515 if (!tile_version.resource_ && tile->required_for_activation()) |
484 AddRequiredTileForActivation(tile); | 516 AddRequiredTileForActivation(tile); |
485 } | 517 } |
486 | 518 |
487 // In OOM situation, we iterate tiles_, remove the memory for active tree | 519 // In OOM situation, we iterate tiles_, remove the memory for active tree |
488 // and not the now bin. And give them to bytes_oom_in_now_bin_on_pending_tree | 520 // and not the now bin. And give them to bytes_oom_in_now_bin_on_pending_tree |
489 if (!tiles_requiring_memory_but_oomed.empty()) { | 521 if (!tiles_requiring_memory_but_oomed.empty()) { |
490 size_t bytes_freed = 0; | 522 size_t bytes_freed = 0; |
491 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 523 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
555 | 587 |
556 // Build a new task queue containing all task currently needed. Tasks | 588 // Build a new task queue containing all task currently needed. Tasks |
557 // are added in order of priority, highest priority task first. | 589 // are added in order of priority, highest priority task first. |
558 for (TileVector::iterator it = tiles_that_need_to_be_rasterized_.begin(); | 590 for (TileVector::iterator it = tiles_that_need_to_be_rasterized_.begin(); |
559 it != tiles_that_need_to_be_rasterized_.end(); | 591 it != tiles_that_need_to_be_rasterized_.end(); |
560 ++it) { | 592 ++it) { |
561 Tile* tile = *it; | 593 Tile* tile = *it; |
562 ManagedTileState& mts = tile->managed_state(); | 594 ManagedTileState& mts = tile->managed_state(); |
563 | 595 |
564 DCHECK(tile->tile_version().requires_resource()); | 596 DCHECK(tile->tile_version().requires_resource()); |
565 DCHECK(!tile->tile_version().resource_); | 597 DCHECK(!tile->tile_version().resource_ || |
598 (tile->tile_version().raster_flags_ != DetermineRasterFlags(tile))); | |
566 | 599 |
567 // Create raster task for this tile if necessary. | 600 // Create raster task for this tile if necessary. |
568 if (mts.raster_task.is_null()) | 601 if (mts.raster_task.is_null()) |
569 mts.raster_task = CreateRasterTask(tile); | 602 mts.raster_task = CreateRasterTask(tile); |
570 | 603 |
571 // Finally append raster task. | 604 // Finally append raster task. |
572 tasks.Append(mts.raster_task); | 605 tasks.Append(mts.raster_task); |
573 } | 606 } |
574 | 607 |
575 // Schedule running of |tasks|. This replaces any previously | 608 // Schedule running of |tasks|. This replaces any previously |
(...skipping 28 matching lines...) Expand all Loading... | |
604 TileManager::RasterTaskMetadata TileManager::GetRasterTaskMetadata( | 637 TileManager::RasterTaskMetadata TileManager::GetRasterTaskMetadata( |
605 const Tile& tile) const { | 638 const Tile& tile) const { |
606 RasterTaskMetadata metadata; | 639 RasterTaskMetadata metadata; |
607 const ManagedTileState& mts = tile.managed_state(); | 640 const ManagedTileState& mts = tile.managed_state(); |
608 metadata.is_tile_in_pending_tree_now_bin = | 641 metadata.is_tile_in_pending_tree_now_bin = |
609 mts.tree_bin[PENDING_TREE] == NOW_BIN; | 642 mts.tree_bin[PENDING_TREE] == NOW_BIN; |
610 metadata.tile_resolution = mts.resolution; | 643 metadata.tile_resolution = mts.resolution; |
611 metadata.layer_id = tile.layer_id(); | 644 metadata.layer_id = tile.layer_id(); |
612 metadata.tile_id = &tile; | 645 metadata.tile_id = &tile; |
613 metadata.source_frame_number = tile.source_frame_number(); | 646 metadata.source_frame_number = tile.source_frame_number(); |
647 metadata.raster_flags = DetermineRasterFlags(&tile); | |
614 return metadata; | 648 return metadata; |
615 } | 649 } |
616 | 650 |
617 RasterWorkerPool::RasterTask TileManager::CreateRasterTask(Tile* tile) { | 651 RasterWorkerPool::RasterTask TileManager::CreateRasterTask(Tile* tile) { |
618 TRACE_EVENT0("cc", "TileManager::CreateRasterTask"); | 652 TRACE_EVENT0("cc", "TileManager::CreateRasterTask"); |
619 | 653 |
620 scoped_ptr<ResourcePool::Resource> resource = | 654 scoped_ptr<ResourcePool::Resource> resource = |
621 resource_pool_->AcquireResource( | 655 resource_pool_->AcquireResource( |
622 tile->tile_size_.size(), | 656 tile->tile_size_.size(), |
623 tile->tile_version().resource_format_); | 657 tile->tile_version().resource_format_); |
(...skipping 25 matching lines...) Expand all Loading... | |
649 continue; | 683 continue; |
650 } | 684 } |
651 | 685 |
652 // Create and append new image decode task for this pixel ref. | 686 // Create and append new image decode task for this pixel ref. |
653 RasterWorkerPool::Task decode_task = CreateImageDecodeTask( | 687 RasterWorkerPool::Task decode_task = CreateImageDecodeTask( |
654 tile, pixel_ref); | 688 tile, pixel_ref); |
655 decode_tasks.Insert(decode_task); | 689 decode_tasks.Insert(decode_task); |
656 pending_decode_tasks_[id] = decode_task; | 690 pending_decode_tasks_[id] = decode_task; |
657 } | 691 } |
658 | 692 |
693 RasterTaskMetadata metadata = GetRasterTaskMetadata(*tile); | |
659 return RasterWorkerPool::RasterTask( | 694 return RasterWorkerPool::RasterTask( |
660 tile->picture_pile(), | 695 tile->picture_pile(), |
661 const_resource, | 696 const_resource, |
662 base::Bind(&TileManager::RunAnalyzeAndRasterTask, | 697 base::Bind(&TileManager::RunAnalyzeAndRasterTask, |
663 base::Bind(&TileManager::RunAnalyzeTask, | 698 base::Bind(&TileManager::RunAnalyzeTask, |
664 analysis, | 699 analysis, |
665 tile->content_rect(), | 700 tile->content_rect(), |
666 tile->contents_scale(), | 701 tile->contents_scale(), |
667 use_color_estimator_, | 702 use_color_estimator_, |
668 GetRasterTaskMetadata(*tile), | 703 metadata, |
669 rendering_stats_instrumentation_), | 704 rendering_stats_instrumentation_), |
670 base::Bind(&TileManager::RunRasterTask, | 705 base::Bind(&TileManager::RunRasterTask, |
671 analysis, | 706 analysis, |
672 tile->content_rect(), | 707 tile->content_rect(), |
673 tile->contents_scale(), | 708 tile->contents_scale(), |
674 GetRasterTaskMetadata(*tile), | 709 metadata, |
675 rendering_stats_instrumentation_)), | 710 rendering_stats_instrumentation_)), |
676 base::Bind(&TileManager::OnRasterTaskCompleted, | 711 base::Bind(&TileManager::OnRasterTaskCompleted, |
677 base::Unretained(this), | 712 base::Unretained(this), |
678 make_scoped_refptr(tile), | 713 make_scoped_refptr(tile), |
679 base::Passed(&resource), | 714 base::Passed(&resource), |
680 base::Owned(analysis)), | 715 base::Owned(analysis), |
716 metadata.raster_flags), | |
681 &decode_tasks); | 717 &decode_tasks); |
682 } | 718 } |
683 | 719 |
684 void TileManager::OnRasterTaskCompleted( | 720 void TileManager::OnRasterTaskCompleted( |
685 scoped_refptr<Tile> tile, | 721 scoped_refptr<Tile> tile, |
686 scoped_ptr<ResourcePool::Resource> resource, | 722 scoped_ptr<ResourcePool::Resource> resource, |
687 PicturePileImpl::Analysis* analysis, | 723 PicturePileImpl::Analysis* analysis, |
724 unsigned raster_flags, | |
688 bool was_canceled) { | 725 bool was_canceled) { |
689 TRACE_EVENT1("cc", "TileManager::OnRasterTaskCompleted", | 726 TRACE_EVENT1("cc", "TileManager::OnRasterTaskCompleted", |
690 "was_canceled", was_canceled); | 727 "was_canceled", was_canceled); |
691 | 728 |
692 ManagedTileState& mts = tile->managed_state(); | 729 ManagedTileState& mts = tile->managed_state(); |
693 DCHECK(!mts.raster_task.is_null()); | 730 DCHECK(!mts.raster_task.is_null()); |
694 mts.raster_task.Reset(); | 731 mts.raster_task.Reset(); |
695 | 732 |
696 if (was_canceled) { | 733 if (was_canceled) { |
697 resource_pool_->ReleaseResource(resource.Pass()); | 734 resource_pool_->ReleaseResource(resource.Pass()); |
698 return; | 735 return; |
699 } | 736 } |
700 | 737 |
738 if (tile->tile_version().resource_) { | |
739 resource_pool_->ReleaseResource(tile->tile_version().resource_.Pass()); | |
740 DCHECK(tile->tile_version().raster_flags_ != raster_flags); | |
741 tile->tile_version().raster_flags_ = INVALID_RASTER_FLAG; | |
742 } | |
743 | |
701 mts.picture_pile_analysis = *analysis; | 744 mts.picture_pile_analysis = *analysis; |
702 mts.picture_pile_analyzed = true; | 745 mts.picture_pile_analyzed = true; |
703 | 746 |
704 if (analysis->is_solid_color) { | 747 if (analysis->is_solid_color) { |
705 tile->tile_version().set_solid_color(analysis->solid_color); | 748 tile->tile_version().set_solid_color(analysis->solid_color); |
706 resource_pool_->ReleaseResource(resource.Pass()); | 749 resource_pool_->ReleaseResource(resource.Pass()); |
707 } else { | 750 } else { |
708 tile->tile_version().resource_ = resource.Pass(); | 751 tile->tile_version().resource_ = resource.Pass(); |
752 tile->tile_version().raster_flags_ = raster_flags; | |
753 | |
754 // If we already need a new version, schedule ManageTiles() call. | |
755 unsigned required_raster_flags = DetermineRasterFlags(tile.get()); | |
756 if (required_raster_flags != raster_flags) | |
757 client_->ScheduleManageTiles(); | |
reveman
2013/06/04 20:16:08
how will this work with https://codereview.chromiu
| |
709 } | 758 } |
710 | 759 |
711 DidFinishTileInitialization(tile.get()); | 760 DidFinishTileInitialization(tile.get()); |
712 } | 761 } |
713 | 762 |
714 void TileManager::DidFinishTileInitialization(Tile* tile) { | 763 void TileManager::DidFinishTileInitialization(Tile* tile) { |
715 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) | 764 if (tile->priority(ACTIVE_TREE).distance_to_visible_in_pixels == 0) |
716 did_initialize_visible_tile_ = true; | 765 did_initialize_visible_tile_ = true; |
717 if (tile->required_for_activation()) { | 766 if (tile->required_for_activation()) { |
718 // It's possible that a tile required for activation is not in this list | 767 // It's possible that a tile required for activation is not in this list |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
784 analysis->is_solid_color &= use_color_estimator; | 833 analysis->is_solid_color &= use_color_estimator; |
785 } | 834 } |
786 | 835 |
787 scoped_ptr<base::Value> TileManager::RasterTaskMetadata::AsValue() const { | 836 scoped_ptr<base::Value> TileManager::RasterTaskMetadata::AsValue() const { |
788 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); | 837 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); |
789 res->Set("tile_id", TracedValue::CreateIDRef(tile_id).release()); | 838 res->Set("tile_id", TracedValue::CreateIDRef(tile_id).release()); |
790 res->SetBoolean("is_tile_in_pending_tree_now_bin", | 839 res->SetBoolean("is_tile_in_pending_tree_now_bin", |
791 is_tile_in_pending_tree_now_bin); | 840 is_tile_in_pending_tree_now_bin); |
792 res->Set("resolution", TileResolutionAsValue(tile_resolution).release()); | 841 res->Set("resolution", TileResolutionAsValue(tile_resolution).release()); |
793 res->SetInteger("source_frame_number", source_frame_number); | 842 res->SetInteger("source_frame_number", source_frame_number); |
843 res->SetInteger("raster_flags", raster_flags); | |
794 return res.PassAs<base::Value>(); | 844 return res.PassAs<base::Value>(); |
795 } | 845 } |
796 | 846 |
797 // static | 847 // static |
798 bool TileManager::RunRasterTask( | 848 bool TileManager::RunRasterTask( |
799 PicturePileImpl::Analysis* analysis, | 849 PicturePileImpl::Analysis* analysis, |
800 gfx::Rect rect, | 850 gfx::Rect rect, |
801 float contents_scale, | 851 float contents_scale, |
802 const RasterTaskMetadata& metadata, | 852 const RasterTaskMetadata& metadata, |
803 RenderingStatsInstrumentation* stats_instrumentation, | 853 RenderingStatsInstrumentation* stats_instrumentation, |
804 SkDevice* device, | 854 SkDevice* device, |
805 PicturePileImpl* picture_pile) { | 855 PicturePileImpl* picture_pile) { |
806 TRACE_EVENT1( | 856 TRACE_EVENT1( |
807 "cc", "TileManager::RunRasterTask", | 857 "cc", "TileManager::RunRasterTask", |
808 "metadata", TracedValue::FromValue(metadata.AsValue().release())); | 858 "metadata", TracedValue::FromValue(metadata.AsValue().release())); |
809 devtools_instrumentation::ScopedLayerTask raster_task( | 859 devtools_instrumentation::ScopedLayerTask raster_task( |
810 devtools_instrumentation::kRasterTask, metadata.layer_id); | 860 devtools_instrumentation::kRasterTask, metadata.layer_id); |
811 | 861 |
812 DCHECK(picture_pile); | 862 DCHECK(picture_pile); |
813 DCHECK(analysis); | 863 DCHECK(analysis); |
814 DCHECK(device); | 864 DCHECK(device); |
815 | 865 |
816 if (analysis->is_solid_color) | 866 if (analysis->is_solid_color) |
817 return false; | 867 return false; |
818 | 868 |
819 SkCanvas canvas(device); | 869 SkCanvas canvas(device); |
820 | 870 |
871 skia::RefPtr<SkDrawFilter> draw_filter; | |
872 if ((metadata.raster_flags & USE_HIGH_QUALITY) == 0) | |
873 draw_filter = skia::AdoptRef(new skia::PaintSimplifier); | |
874 else if ((metadata.raster_flags & USE_LCD_TEXT) == 0) | |
875 draw_filter = skia::AdoptRef(new DisableLCDTextFilter); | |
876 | |
877 canvas.setDrawFilter(draw_filter.get()); | |
878 | |
821 if (stats_instrumentation->record_rendering_stats()) { | 879 if (stats_instrumentation->record_rendering_stats()) { |
822 PicturePileImpl::RasterStats raster_stats; | 880 PicturePileImpl::RasterStats raster_stats; |
823 picture_pile->RasterToBitmap(&canvas, rect, contents_scale, &raster_stats); | 881 picture_pile->RasterToBitmap(&canvas, rect, contents_scale, &raster_stats); |
824 stats_instrumentation->AddRaster( | 882 stats_instrumentation->AddRaster( |
825 raster_stats.total_rasterize_time, | 883 raster_stats.total_rasterize_time, |
826 raster_stats.best_rasterize_time, | 884 raster_stats.best_rasterize_time, |
827 raster_stats.total_pixels_rasterized, | 885 raster_stats.total_pixels_rasterized, |
828 metadata.is_tile_in_pending_tree_now_bin); | 886 metadata.is_tile_in_pending_tree_now_bin); |
829 | 887 |
830 HISTOGRAM_CUSTOM_COUNTS( | 888 HISTOGRAM_CUSTOM_COUNTS( |
831 "Renderer4.PictureRasterTimeUS", | 889 "Renderer4.PictureRasterTimeUS", |
832 raster_stats.total_rasterize_time.InMicroseconds(), | 890 raster_stats.total_rasterize_time.InMicroseconds(), |
833 0, | 891 0, |
834 100000, | 892 100000, |
835 100); | 893 100); |
836 } else { | 894 } else { |
837 picture_pile->RasterToBitmap(&canvas, rect, contents_scale, NULL); | 895 picture_pile->RasterToBitmap(&canvas, rect, contents_scale, NULL); |
838 } | 896 } |
839 | 897 |
840 return true; | 898 return true; |
841 } | 899 } |
842 | 900 |
843 } // namespace cc | 901 } // namespace cc |
OLD | NEW |