| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import logging |
| 6 from collections import namedtuple |
| 7 |
| 8 from crash.chromecrash_parser import ChromeCrashParser |
| 9 from crash import detect_regression_range |
| 10 from crash.stacktrace import Stacktrace |
| 11 |
| 12 |
| 13 class CrashData(object): |
| 14 """An abstract class representing crash data sent by clients. |
| 15 |
| 16 This class is constructed from the raw data that clients sent to Predator, and |
| 17 do all necessary analysis to get all information that Predator library needs, |
| 18 which means all information for us to create ``CrashReport`` for Predator to |
| 19 analyze. |
| 20 |
| 21 Properties: |
| 22 identifiers (dict): The key value pairs to uniquely identify a |
| 23 ``CrashData``. |
| 24 crashed_version (str): The version of project in which the crash occurred. |
| 25 signature (str): The signature of the crash. |
| 26 platform (str): The platform name; e.g., 'win', 'mac', 'linux', 'android', |
| 27 'ios', etc. |
| 28 stacktrace (Stacktrace): Needs to be implemented. |
| 29 regression_range (pair or None): Needs to be implemented. |
| 30 dependencies (dict): Needs to be implemented. |
| 31 dependency_rolls (dict) Needs to be implemented. |
| 32 |
| 33 """ |
| 34 def __init__(self, crash_data): |
| 35 """ |
| 36 Args: |
| 37 crash_data (dict): Dicts sent through Pub/Sub by clients. Example: |
| 38 { |
| 39 'stack_trace': 'CRASHED [0x43507378...', |
| 40 # The Chrome version that produced the stack trace above. |
| 41 'chrome_version': '52.0.2743.41', |
| 42 # Client could provide customized data. |
| 43 'customized_data': { # client-specific data |
| 44 ... |
| 45 }, |
| 46 'platform': 'mac', # On which platform the crash occurs. |
| 47 'client_id': 'fracas', # Identify which client this request is from. |
| 48 'signature': '[ThreadWatcher UI hang] base::RunLoopBase::Run', |
| 49 'crash_identifiers': { # A list of key-value to identify a crash. |
| 50 ... |
| 51 } |
| 52 } |
| 53 """ |
| 54 self._identifiers = crash_data['crash_identifiers'] |
| 55 self._crashed_version = crash_data['chrome_version'] |
| 56 self._signature = crash_data['signature'] |
| 57 self._platform = crash_data['platform'] |
| 58 |
| 59 @property |
| 60 def identifiers(self): |
| 61 return self._identifiers |
| 62 |
| 63 @property |
| 64 def crashed_version(self): |
| 65 return self._crashed_version |
| 66 |
| 67 @property |
| 68 def signature(self): |
| 69 return self._signature |
| 70 |
| 71 @property |
| 72 def platform(self): |
| 73 return self._platform |
| 74 |
| 75 @platform.setter |
| 76 def platform(self, platform): |
| 77 self._platform = platform |
| 78 |
| 79 @property |
| 80 def stacktrace(self): |
| 81 raise NotImplementedError() |
| 82 |
| 83 @property |
| 84 def regression_range(self): |
| 85 raise NotImplementedError() |
| 86 |
| 87 @property |
| 88 def dependencies(self): |
| 89 raise NotImplementedError() |
| 90 |
| 91 @property |
| 92 def dependency_rolls(self): |
| 93 raise NotImplementedError() |
| OLD | NEW |