| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 Args: | 249 Args: |
| 250 model (CrashAnalysis): The model containing the stack_trace string | 250 model (CrashAnalysis): The model containing the stack_trace string |
| 251 to be parsed. | 251 to be parsed. |
| 252 | 252 |
| 253 Returns: | 253 Returns: |
| 254 On success, returns a Stacktrace object; on failure, returns None. | 254 On success, returns a Stacktrace object; on failure, returns None. |
| 255 """ | 255 """ |
| 256 stacktrace = self._stacktrace_parser.Parse( | 256 stacktrace = self._stacktrace_parser.Parse( |
| 257 model.stack_trace, | 257 model.stack_trace, |
| 258 chrome_dependency_fetcher.ChromeDependencyFetcher( | 258 chrome_dependency_fetcher.ChromeDependencyFetcher( |
| 259 self._repository | 259 self._repository).GetDependency( |
| 260 ).GetDependency( | |
| 261 model.crashed_version, | 260 model.crashed_version, |
| 262 model.platform), | 261 model.platform), |
| 263 model.signature) | 262 model.signature) |
| 264 if not stacktrace: | 263 if not stacktrace: |
| 265 logging.warning('Failed to parse the stacktrace %s', model.stack_trace) | 264 logging.warning('Failed to parse the stacktrace %s', model.stack_trace) |
| 266 return None | 265 return None |
| 267 | 266 |
| 268 return stacktrace | 267 return stacktrace |
| 269 | 268 |
| 270 # TODO(wrengr): This is only called by ``CrashAnalysisPipeline.run``; | 269 # TODO(wrengr): This is only called by ``CrashAnalysisPipeline.run``; |
| 271 # we should be able to adjust things so that we only need to take in | 270 # we should be able to adjust things so that we only need to take in |
| 272 # ``crash_identifiers``, or a CrashReport, rather than taking in the | 271 # ``crash_identifiers``, or a CrashReport, rather than taking in the |
| 273 # whole model. And/or, we should just inline this there. | 272 # whole model. And/or, we should just inline this there. |
| 274 # TODO(http://crbug.com/659346): coverage tests for this class, not | 273 # TODO(http://crbug.com/659346): coverage tests for this class, not |
| 275 # just for FinditForFracas. | 274 # just for FinditForFracas. |
| 276 def FindCulprit(self, model): # pragma: no cover | 275 def FindCulprit(self, model): # pragma: no cover |
| 277 """Given a CrashAnalysis ndb.Model, return a Culprit.""" | 276 """Given a CrashAnalysis ndb.Model, return a Culprit.""" |
| 278 stacktrace = self.ParseStacktrace(model) | 277 stacktrace = self.ParseStacktrace(model) |
| 279 if stacktrace is None: | 278 if stacktrace is None: |
| 280 return None | 279 return None |
| 281 | 280 |
| 282 return self._predator.FindCulprit(CrashReport( | 281 return self._predator.FindCulprit(CrashReport( |
| 283 crashed_version = model.crashed_version, | 282 crashed_version = model.crashed_version, |
| 284 signature = model.signature, | 283 signature = model.signature, |
| 285 platform = model.platform, | 284 platform = model.platform, |
| 286 stacktrace = stacktrace, | 285 stacktrace = stacktrace, |
| 287 regression_range = model.regression_range)) | 286 regression_range = model.regression_range)) |
| OLD | NEW |