| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_base.h" | 5 #include "cc/resources/picture_pile_base.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 invalidation_history_ <<= (frame_number - last_frame_number_); | 219 invalidation_history_ <<= (frame_number - last_frame_number_); |
| 220 last_frame_number_ = frame_number; | 220 last_frame_number_ = frame_number; |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool PicturePileBase::PictureInfo::Invalidate(int frame_number) { | 223 bool PicturePileBase::PictureInfo::Invalidate(int frame_number) { |
| 224 AdvanceInvalidationHistory(frame_number); | 224 AdvanceInvalidationHistory(frame_number); |
| 225 invalidation_history_.set(0); | 225 invalidation_history_.set(0); |
| 226 | 226 |
| 227 bool did_invalidate = !!picture_.get(); | 227 bool did_invalidate = !!picture_.get(); |
| 228 picture_ = NULL; | 228 picture_ = nullptr; |
| 229 return did_invalidate; | 229 return did_invalidate; |
| 230 } | 230 } |
| 231 | 231 |
| 232 bool PicturePileBase::PictureInfo::NeedsRecording(int frame_number, | 232 bool PicturePileBase::PictureInfo::NeedsRecording(int frame_number, |
| 233 int distance_to_visible) { | 233 int distance_to_visible) { |
| 234 AdvanceInvalidationHistory(frame_number); | 234 AdvanceInvalidationHistory(frame_number); |
| 235 | 235 |
| 236 // We only need recording if we don't have a picture. Furthermore, we only | 236 // We only need recording if we don't have a picture. Furthermore, we only |
| 237 // need a recording if we're within frequent invalidation distance threshold | 237 // need a recording if we're within frequent invalidation distance threshold |
| 238 // or the invalidation is not frequent enough (below invalidation frequency | 238 // or the invalidation is not frequent enough (below invalidation frequency |
| (...skipping 10 matching lines...) Expand all Loading... |
| 249 const Picture* PicturePileBase::PictureInfo::GetPicture() const { | 249 const Picture* PicturePileBase::PictureInfo::GetPicture() const { |
| 250 return picture_.get(); | 250 return picture_.get(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 float PicturePileBase::PictureInfo::GetInvalidationFrequency() const { | 253 float PicturePileBase::PictureInfo::GetInvalidationFrequency() const { |
| 254 return invalidation_history_.count() / | 254 return invalidation_history_.count() / |
| 255 static_cast<float>(INVALIDATION_FRAMES_TRACKED); | 255 static_cast<float>(INVALIDATION_FRAMES_TRACKED); |
| 256 } | 256 } |
| 257 | 257 |
| 258 } // namespace cc | 258 } // namespace cc |
| OLD | NEW |