| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 scoped_refptr<Picture> base_picture = Picture::Create(tile); | 109 scoped_refptr<Picture> base_picture = Picture::Create(tile); |
| 110 pic_list.push_back(base_picture); | 110 pic_list.push_back(base_picture); |
| 111 } | 111 } |
| 112 | 112 |
| 113 for (PictureList::iterator pic = pic_list.begin(); | 113 for (PictureList::iterator pic = pic_list.begin(); |
| 114 pic != pic_list.end(); ++pic) { | 114 pic != pic_list.end(); ++pic) { |
| 115 if (!(*pic)->HasRecording()) { | 115 if (!(*pic)->HasRecording()) { |
| 116 modified_pile = true; | 116 modified_pile = true; |
| 117 TRACE_EVENT0(benchmark_instrumentation::kCategory, | 117 TRACE_EVENT0(benchmark_instrumentation::kCategory, |
| 118 benchmark_instrumentation::kRecordLoop); | 118 benchmark_instrumentation::kRecordLoop); |
| 119 base::TimeDelta total_duration = | |
| 120 base::TimeDelta::FromInternalValue(0); | |
| 121 base::TimeDelta best_duration = base::TimeDelta::FromInternalValue( | 119 base::TimeDelta best_duration = base::TimeDelta::FromInternalValue( |
| 122 std::numeric_limits<int64>::max()); | 120 std::numeric_limits<int64>::max()); |
| 123 for (int i = 0; i < repeat_count; i++) { | 121 for (int i = 0; i < repeat_count; i++) { |
| 124 base::TimeTicks start_time = stats_instrumentation->StartRecording(); | 122 base::TimeTicks start_time = stats_instrumentation->StartRecording(); |
| 125 (*pic)->Record(painter, tile_grid_info_); | 123 (*pic)->Record(painter, tile_grid_info_); |
| 126 base::TimeDelta duration = | 124 base::TimeDelta duration = |
| 127 stats_instrumentation->EndRecording(start_time); | 125 stats_instrumentation->EndRecording(start_time); |
| 128 total_duration += duration; | |
| 129 best_duration = std::min(duration, best_duration); | 126 best_duration = std::min(duration, best_duration); |
| 130 } | 127 } |
| 131 int painted_pixels = | 128 int recorded_pixel_count = |
| 132 (*pic)->LayerRect().width() * (*pic)->LayerRect().height(); | 129 (*pic)->LayerRect().width() * (*pic)->LayerRect().height(); |
| 133 stats_instrumentation->AddRecord(total_duration, | 130 stats_instrumentation->AddRecord(best_duration, recorded_pixel_count); |
| 134 best_duration, | 131 (*pic)->GatherPixelRefs(tile_grid_info_); |
| 135 painted_pixels); | |
| 136 (*pic)->GatherPixelRefs(tile_grid_info_, stats_instrumentation); | |
| 137 (*pic)->CloneForDrawing(num_raster_threads_); | 132 (*pic)->CloneForDrawing(num_raster_threads_); |
| 138 } | 133 } |
| 139 } | 134 } |
| 140 } | 135 } |
| 141 | 136 |
| 142 UpdateRecordedRegion(); | 137 UpdateRecordedRegion(); |
| 143 | 138 |
| 144 return modified_pile; | 139 return modified_pile; |
| 145 } | 140 } |
| 146 | 141 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 180 |
| 186 FullyContainedPredicate pred(picture_rect); | 181 FullyContainedPredicate pred(picture_rect); |
| 187 picture_list.erase(std::remove_if(picture_list.begin(), | 182 picture_list.erase(std::remove_if(picture_list.begin(), |
| 188 picture_list.end(), | 183 picture_list.end(), |
| 189 pred), | 184 pred), |
| 190 picture_list.end()); | 185 picture_list.end()); |
| 191 picture_list.push_back(Picture::Create(picture_rect)); | 186 picture_list.push_back(Picture::Create(picture_rect)); |
| 192 } | 187 } |
| 193 | 188 |
| 194 } // namespace cc | 189 } // namespace cc |
| OLD | NEW |