| 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 defaultdict | 5 from collections import defaultdict |
| 6 | 6 |
| 7 from common.diff import ChangeType | 7 from common.diff import ChangeType |
| 8 from common.git_repository import GitRepository | 8 from common.git_repository import GitRepository |
| 9 from common.http_client_appengine import HttpClientAppengine | 9 from common.http_client_appengine import HttpClientAppengine |
| 10 from crash import crash_util | 10 from crash import crash_util |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 Returns: | 229 Returns: |
| 230 List of dicts of culprit results, sorted by confidence from highest to | 230 List of dicts of culprit results, sorted by confidence from highest to |
| 231 lowest. | 231 lowest. |
| 232 """ | 232 """ |
| 233 if not regression_deps_rolls: | 233 if not regression_deps_rolls: |
| 234 return [] | 234 return [] |
| 235 | 235 |
| 236 # We are only interested in the deps in crash stack (the callstack that | 236 # We are only interested in the deps in crash stack (the callstack that |
| 237 # caused the crash). | 237 # caused the crash). |
| 238 stack_deps = GetDepsInCrashStack(stacktrace.GetCrashStack(), crashed_deps) | 238 stack_deps = GetDepsInCrashStack(stacktrace.crash_stack, crashed_deps) |
| 239 | 239 |
| 240 # Get dep and file to changelogs, stack_info and blame dicts. | 240 # Get dep and file to changelogs, stack_info and blame dicts. |
| 241 dep_to_file_to_changelogs, ignore_cls = GetChangeLogsForFilesGroupedByDeps( | 241 dep_to_file_to_changelogs, ignore_cls = GetChangeLogsForFilesGroupedByDeps( |
| 242 regression_deps_rolls, stack_deps) | 242 regression_deps_rolls, stack_deps) |
| 243 dep_to_file_to_stack_infos = GetStackInfosForFilesGroupedByDeps( | 243 dep_to_file_to_stack_infos = GetStackInfosForFilesGroupedByDeps( |
| 244 stacktrace, stack_deps) | 244 stacktrace, stack_deps) |
| 245 dep_to_file_to_blame = GetBlameForFilesGroupedByDeps(stacktrace, stack_deps) | 245 dep_to_file_to_blame = GetBlameForFilesGroupedByDeps(stacktrace, stack_deps) |
| 246 | 246 |
| 247 results = FindMatchResults(dep_to_file_to_changelogs, | 247 results = FindMatchResults(dep_to_file_to_changelogs, |
| 248 dep_to_file_to_stack_infos, | 248 dep_to_file_to_stack_infos, |
| 249 dep_to_file_to_blame, | 249 dep_to_file_to_blame, |
| 250 ignore_cls) | 250 ignore_cls) |
| 251 | 251 |
| 252 if not results: | 252 if not results: |
| 253 return [] | 253 return [] |
| 254 | 254 |
| 255 aggregator = Aggregator([TopFrameIndex(), MinDistance()]) | 255 aggregator = Aggregator([TopFrameIndex(), MinDistance()]) |
| 256 | 256 |
| 257 map(aggregator.ScoreAndReason, results) | 257 map(aggregator.ScoreAndReason, results) |
| 258 | 258 |
| 259 return sorted([result.ToDict() for result in results], | 259 return sorted([result.ToDict() for result in results], |
| 260 key=lambda r: -r['confidence']) | 260 key=lambda r: -r['confidence']) |
| OLD | NEW |