| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 from collections import namedtuple | 5 from collections import namedtuple |
| 6 | 6 |
| 7 | 7 |
| 8 # TODO(wrengr): we should change things to use integers with None as | 8 # TODO(wrengr): we should change things to use integers with None as |
| 9 # \"infinity\", rather than using floats. | 9 # \"infinity\", rather than using floats. |
| 10 # TODO(http://crbug.com/644476): this class needs a better name. | 10 # TODO(http://crbug.com/644476): this class needs a better name. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 stack_infos (list of StackInfo): List of the frames of this file | 115 stack_infos (list of StackInfo): List of the frames of this file |
| 116 together with their callstack priorities. | 116 together with their callstack priorities. |
| 117 blame (Blame): Blame oject of this file. | 117 blame (Blame): Blame oject of this file. |
| 118 """ | 118 """ |
| 119 suspect.file_to_stack_infos[file_path] = stack_infos | 119 suspect.file_to_stack_infos[file_path] = stack_infos |
| 120 | 120 |
| 121 if not blame: | 121 if not blame: |
| 122 return | 122 return |
| 123 | 123 |
| 124 min_distance = float('inf') | 124 min_distance = float('inf') |
| 125 min_distance_frame = stack_infos[0][0] | 125 min_distance_frame = stack_infos[0].frame |
| 126 for region in blame: | 126 for region in blame: |
| 127 if region.revision != suspect.changelog.revision: | 127 if region.revision != suspect.changelog.revision: |
| 128 continue | 128 continue |
| 129 | 129 |
| 130 region_start = region.start | 130 region_start = region.start |
| 131 region_end = region_start + region.count - 1 | 131 region_end = region_start + region.count - 1 |
| 132 for frame, _ in stack_infos: | 132 for frame, _ in stack_infos: |
| 133 frame_start = frame.crashed_line_numbers[0] | 133 frame_start = frame.crashed_line_numbers[0] |
| 134 frame_end = frame.crashed_line_numbers[-1] | 134 frame_end = frame.crashed_line_numbers[-1] |
| 135 distance = _DistanceBetweenLineRanges((frame_start, frame_end), | 135 distance = _DistanceBetweenLineRanges((frame_start, frame_end), |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 blame (Blame): Blame of the file. | 191 blame (Blame): Blame of the file. |
| 192 """ | 192 """ |
| 193 for changelog in changelogs: | 193 for changelog in changelogs: |
| 194 if self._ignore_cls and changelog.revision in self._ignore_cls: | 194 if self._ignore_cls and changelog.revision in self._ignore_cls: |
| 195 continue | 195 continue |
| 196 | 196 |
| 197 if changelog.revision not in self: | 197 if changelog.revision not in self: |
| 198 self[changelog.revision] = Suspect(changelog, dep_path) | 198 self[changelog.revision] = Suspect(changelog, dep_path) |
| 199 | 199 |
| 200 _UpdateSuspect(self[changelog.revision], file_path, stack_infos, blame) | 200 _UpdateSuspect(self[changelog.revision], file_path, stack_infos, blame) |
| OLD | NEW |