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/picture_pile.h" | 5 #include "cc/resources/picture_pile.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 | 549 |
550 for (int i = 0; i < repeat_count; i++) { | 550 for (int i = 0; i < repeat_count; i++) { |
551 picture = Picture::Create(padded_record_rect, painter, tile_grid_info_, | 551 picture = Picture::Create(padded_record_rect, painter, tile_grid_info_, |
552 gather_pixel_refs, recording_mode); | 552 gather_pixel_refs, recording_mode); |
553 // Note the '&&' with previous is-suitable state. | 553 // Note the '&&' with previous is-suitable state. |
554 // This means that once a picture-pile becomes unsuitable for gpu | 554 // This means that once a picture-pile becomes unsuitable for gpu |
555 // rasterization due to some content, it will continue to be unsuitable | 555 // rasterization due to some content, it will continue to be unsuitable |
556 // even if that content is replaced by gpu-friendly content. | 556 // even if that content is replaced by gpu-friendly content. |
557 // This is an optimization to avoid iterating though all pictures in | 557 // This is an optimization to avoid iterating though all pictures in |
558 // the pile after each invalidation. | 558 // the pile after each invalidation. |
559 is_suitable_for_gpu_rasterization_ &= | 559 if (is_suitable_for_gpu_rasterization_) { |
560 picture->IsSuitableForGpuRasterization(); | 560 const char* reason = nullptr; |
| 561 is_suitable_for_gpu_rasterization_ &= |
| 562 picture->IsSuitableForGpuRasterization(&reason); |
| 563 |
| 564 if (!is_suitable_for_gpu_rasterization_) { |
| 565 TRACE_EVENT_INSTANT1("cc", "GPU Rasterization Veto", |
| 566 TRACE_EVENT_SCOPE_THREAD, "reason", reason); |
| 567 } |
| 568 } |
561 } | 569 } |
562 | 570 |
563 bool found_tile_for_recorded_picture = false; | 571 bool found_tile_for_recorded_picture = false; |
564 | 572 |
565 bool include_borders = true; | 573 bool include_borders = true; |
566 for (TilingData::Iterator it(&tiling_, padded_record_rect, include_borders); | 574 for (TilingData::Iterator it(&tiling_, padded_record_rect, include_borders); |
567 it; ++it) { | 575 it; ++it) { |
568 const PictureMapKey& key = it.index(); | 576 const PictureMapKey& key = it.index(); |
569 gfx::Rect tile = PaddedRect(key); | 577 gfx::Rect tile = PaddedRect(key); |
570 if (padded_record_rect.Contains(tile)) { | 578 if (padded_record_rect.Contains(tile)) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 const Picture* PicturePile::PictureInfo::GetPicture() const { | 771 const Picture* PicturePile::PictureInfo::GetPicture() const { |
764 return picture_.get(); | 772 return picture_.get(); |
765 } | 773 } |
766 | 774 |
767 float PicturePile::PictureInfo::GetInvalidationFrequency() const { | 775 float PicturePile::PictureInfo::GetInvalidationFrequency() const { |
768 return invalidation_history_.count() / | 776 return invalidation_history_.count() / |
769 static_cast<float>(INVALIDATION_FRAMES_TRACKED); | 777 static_cast<float>(INVALIDATION_FRAMES_TRACKED); |
770 } | 778 } |
771 | 779 |
772 } // namespace cc | 780 } // namespace cc |
OLD | NEW |