| 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 |
| 11 #include "cc/base/region.h" | 11 #include "cc/base/region.h" |
| 12 #include "cc/debug/benchmark_instrumentation.h" | |
| 13 #include "cc/debug/rendering_stats_instrumentation.h" | 12 #include "cc/debug/rendering_stats_instrumentation.h" |
| 14 #include "cc/resources/picture_pile_impl.h" | 13 #include "cc/resources/picture_pile_impl.h" |
| 15 | 14 |
| 16 namespace { | 15 namespace { |
| 17 // Maximum number of pictures that can overlap before we collapse them into | 16 // Maximum number of pictures that can overlap before we collapse them into |
| 18 // a larger one. | 17 // a larger one. |
| 19 const size_t kMaxOverlapping = 2; | 18 const size_t kMaxOverlapping = 2; |
| 20 // Maximum percentage area of the base picture another picture in the picture | 19 // Maximum percentage area of the base picture another picture in the picture |
| 21 // list can be. If higher, we destroy the list and recreate from scratch. | 20 // list can be. If higher, we destroy the list and recreate from scratch. |
| 22 const float kResetThreshold = 0.7f; | 21 const float kResetThreshold = 0.7f; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 -buffer_pixels(), | 106 -buffer_pixels(), |
| 108 -buffer_pixels()); | 107 -buffer_pixels()); |
| 109 scoped_refptr<Picture> base_picture = Picture::Create(tile); | 108 scoped_refptr<Picture> base_picture = Picture::Create(tile); |
| 110 pic_list.push_back(base_picture); | 109 pic_list.push_back(base_picture); |
| 111 } | 110 } |
| 112 | 111 |
| 113 for (PictureList::iterator pic = pic_list.begin(); | 112 for (PictureList::iterator pic = pic_list.begin(); |
| 114 pic != pic_list.end(); ++pic) { | 113 pic != pic_list.end(); ++pic) { |
| 115 if (!(*pic)->HasRecording()) { | 114 if (!(*pic)->HasRecording()) { |
| 116 modified_pile = true; | 115 modified_pile = true; |
| 117 TRACE_EVENT0(benchmark_instrumentation::kCategory, | |
| 118 benchmark_instrumentation::kRecordLoop); | |
| 119 base::TimeDelta best_duration = base::TimeDelta::FromInternalValue( | 116 base::TimeDelta best_duration = base::TimeDelta::FromInternalValue( |
| 120 std::numeric_limits<int64>::max()); | 117 std::numeric_limits<int64>::max()); |
| 121 for (int i = 0; i < repeat_count; i++) { | 118 for (int i = 0; i < repeat_count; i++) { |
| 122 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 119 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
| 123 (*pic)->Record(painter, tile_grid_info_); | 120 (*pic)->Record(painter, tile_grid_info_); |
| 124 base::TimeDelta duration = | 121 base::TimeDelta duration = |
| 125 stats_instrumentation->EndRecording(start_time); | 122 stats_instrumentation->EndRecording(start_time); |
| 126 best_duration = std::min(duration, best_duration); | 123 best_duration = std::min(duration, best_duration); |
| 127 } | 124 } |
| 128 int recorded_pixel_count = | 125 int recorded_pixel_count = |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 177 |
| 181 FullyContainedPredicate pred(picture_rect); | 178 FullyContainedPredicate pred(picture_rect); |
| 182 picture_list.erase(std::remove_if(picture_list.begin(), | 179 picture_list.erase(std::remove_if(picture_list.begin(), |
| 183 picture_list.end(), | 180 picture_list.end(), |
| 184 pred), | 181 pred), |
| 185 picture_list.end()); | 182 picture_list.end()); |
| 186 picture_list.push_back(Picture::Create(picture_rect)); | 183 picture_list.push_back(Picture::Create(picture_rect)); |
| 187 } | 184 } |
| 188 | 185 |
| 189 } // namespace cc | 186 } // namespace cc |
| OLD | NEW |