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

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

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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
« no previous file with comments | « cc/resources/picture_pile.h ('k') | cc/resources/recording_source.h » ('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/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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 CreatePictures(painter, recording_mode, record_rects); 208 CreatePictures(painter, recording_mode, record_rects);
209 209
210 DetermineIfSolidColor(); 210 DetermineIfSolidColor();
211 211
212 has_any_recordings_ = true; 212 has_any_recordings_ = true;
213 DCHECK(CanRasterSlowTileCheck(recorded_viewport_)); 213 DCHECK(CanRasterSlowTileCheck(recorded_viewport_));
214 return true; 214 return true;
215 } 215 }
216 216
217 void PicturePile::DidMoveToNewCompositor() {
218 for (auto& map_pair : picture_map_)
219 map_pair.second.ResetInvalidationHistory();
220 }
221
217 bool PicturePile::ApplyInvalidationAndResize(const gfx::Rect& interest_rect, 222 bool PicturePile::ApplyInvalidationAndResize(const gfx::Rect& interest_rect,
218 Region* invalidation, 223 Region* invalidation,
219 const gfx::Size& layer_size, 224 const gfx::Size& layer_size,
220 int frame_number) { 225 int frame_number) {
221 bool updated = false; 226 bool updated = false;
222 227
223 Region synthetic_invalidation; 228 Region synthetic_invalidation;
224 gfx::Size old_tiling_size = GetSize(); 229 gfx::Size old_tiling_size = GetSize();
225 if (old_tiling_size != layer_size) { 230 if (old_tiling_size != layer_size) {
226 tiling_.SetTilingSize(layer_size); 231 tiling_.SetTilingSize(layer_size);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 745
741 // We only need recording if we don't have a picture. Furthermore, we only 746 // We only need recording if we don't have a picture. Furthermore, we only
742 // need a recording if we're within frequent invalidation distance threshold 747 // need a recording if we're within frequent invalidation distance threshold
743 // or the invalidation is not frequent enough (below invalidation frequency 748 // or the invalidation is not frequent enough (below invalidation frequency
744 // threshold). 749 // threshold).
745 return !picture_.get() && 750 return !picture_.get() &&
746 ((distance_to_visible <= kFrequentInvalidationDistanceThreshold) || 751 ((distance_to_visible <= kFrequentInvalidationDistanceThreshold) ||
747 (GetInvalidationFrequency() < kInvalidationFrequencyThreshold)); 752 (GetInvalidationFrequency() < kInvalidationFrequencyThreshold));
748 } 753 }
749 754
755 void PicturePile::PictureInfo::ResetInvalidationHistory() {
756 invalidation_history_.reset();
757 last_frame_number_ = 0;
758 }
759
750 void PicturePile::SetBufferPixels(int new_buffer_pixels) { 760 void PicturePile::SetBufferPixels(int new_buffer_pixels) {
751 if (new_buffer_pixels == buffer_pixels()) 761 if (new_buffer_pixels == buffer_pixels())
752 return; 762 return;
753 763
754 Clear(); 764 Clear();
755 tiling_.SetBorderTexels(new_buffer_pixels); 765 tiling_.SetBorderTexels(new_buffer_pixels);
756 } 766 }
757 767
758 void PicturePile::PictureInfo::SetPicture(scoped_refptr<Picture> picture) { 768 void PicturePile::PictureInfo::SetPicture(scoped_refptr<Picture> picture) {
759 picture_ = picture; 769 picture_ = picture;
760 } 770 }
761 771
762 const Picture* PicturePile::PictureInfo::GetPicture() const { 772 const Picture* PicturePile::PictureInfo::GetPicture() const {
763 return picture_.get(); 773 return picture_.get();
764 } 774 }
765 775
766 float PicturePile::PictureInfo::GetInvalidationFrequency() const { 776 float PicturePile::PictureInfo::GetInvalidationFrequency() const {
767 return invalidation_history_.count() / 777 return invalidation_history_.count() /
768 static_cast<float>(INVALIDATION_FRAMES_TRACKED); 778 static_cast<float>(INVALIDATION_FRAMES_TRACKED);
769 } 779 }
770 780
771 } // namespace cc 781 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile.h ('k') | cc/resources/recording_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698