| 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 import copy | 5 import copy |
| 6 import logging | 6 import logging |
| 7 | 7 |
| 8 from google.appengine.ext import ndb | 8 from google.appengine.ext import ndb |
| 9 | 9 |
| 10 from common import appengine_util | 10 from common import appengine_util |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 Args: | 200 Args: |
| 201 model (CrashAnalysis): The model containing the stack_trace string | 201 model (CrashAnalysis): The model containing the stack_trace string |
| 202 to be parsed. | 202 to be parsed. |
| 203 | 203 |
| 204 Returns: | 204 Returns: |
| 205 On success, returns a Stacktrace object; on failure, returns None. | 205 On success, returns a Stacktrace object; on failure, returns None. |
| 206 """ | 206 """ |
| 207 stacktrace = self._stacktrace_parser.Parse( | 207 stacktrace = self._stacktrace_parser.Parse( |
| 208 model.stack_trace, | 208 model.stack_trace, |
| 209 chrome_dependency_fetcher.ChromeDependencyFetcher( | 209 chrome_dependency_fetcher.ChromeDependencyFetcher( |
| 210 self._repository | 210 self._repository).GetDependency( |
| 211 ).GetDependency( | |
| 212 model.crashed_version, | 211 model.crashed_version, |
| 213 model.platform), | 212 model.platform), |
| 214 model.signature) | 213 model.signature) |
| 215 if not stacktrace: | 214 if not stacktrace: |
| 216 logging.warning('Failed to parse the stacktrace %s', model.stack_trace) | 215 logging.warning('Failed to parse the stacktrace %s', model.stack_trace) |
| 217 return None | 216 return None |
| 218 | 217 |
| 219 return stacktrace | 218 return stacktrace |
| 220 | 219 |
| 221 # TODO(wrengr): This is only called by ``CrashAnalysisPipeline.run``; | 220 # TODO(wrengr): This is only called by ``CrashAnalysisPipeline.run``; |
| 222 # we should be able to adjust things so that we only need to take in | 221 # we should be able to adjust things so that we only need to take in |
| 223 # ``crash_identifiers``, or a CrashReport, rather than taking in the | 222 # ``crash_identifiers``, or a CrashReport, rather than taking in the |
| 224 # whole model. And/or, we should just inline this there. | 223 # whole model. And/or, we should just inline this there. |
| 225 # TODO(http://crbug.com/659346): coverage tests for this class, not | 224 # TODO(http://crbug.com/659346): coverage tests for this class, not |
| 226 # just for FinditForFracas. | 225 # just for FinditForFracas. |
| 227 def FindCulprit(self, model): # pragma: no cover | 226 def FindCulprit(self, model): # pragma: no cover |
| 228 """Given a CrashAnalysis ndb.Model, return a Culprit.""" | 227 """Given a CrashAnalysis ndb.Model, return a Culprit.""" |
| 229 stacktrace = self.ParseStacktrace(model) | 228 stacktrace = self.ParseStacktrace(model) |
| 230 if stacktrace is None: | 229 if stacktrace is None: |
| 231 return None | 230 return None |
| 232 | 231 |
| 233 return self._predator.FindCulprit(CrashReport( | 232 return self._predator.FindCulprit(CrashReport( |
| 234 crashed_version = model.crashed_version, | 233 crashed_version = model.crashed_version, |
| 235 signature = model.signature, | 234 signature = model.signature, |
| 236 platform = model.platform, | 235 platform = model.platform, |
| 237 stacktrace = stacktrace, | 236 stacktrace = stacktrace, |
| 238 regression_range = model.regression_range)) | 237 regression_range = model.regression_range)) |
| OLD | NEW |