| 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 hashlib | |
| 6 import json | |
| 7 | |
| 8 from google.appengine.ext import ndb | 5 from google.appengine.ext import ndb |
| 9 | 6 |
| 10 from model.crash.crash_analysis import CrashAnalysis | 7 from model.crash.chrome_crash_analysis import ChromeCrashAnalysis |
| 11 | 8 |
| 12 | 9 |
| 13 class FracasCrashAnalysis(CrashAnalysis): | 10 class FracasCrashAnalysis(ChromeCrashAnalysis): |
| 14 """Represents an analysis of a Chrome crash.""" | 11 """Represents an analysis of a Chrome crash on Fracas.""" |
| 15 # Customized properties for Fracas crash. | 12 pass |
| 16 historical_metadata = ndb.JsonProperty(indexed=False) | |
| 17 channel = ndb.StringProperty(indexed=False) | |
| 18 | |
| 19 def Reset(self): | |
| 20 super(FracasCrashAnalysis, self).Reset() | |
| 21 self.historical_metadata = None | |
| 22 self.channel = None | |
| 23 | |
| 24 @staticmethod | |
| 25 def _CreateKey(crash_identifiers): | |
| 26 return ndb.Key('FracasCrashAnalysis', hashlib.sha1( | |
| 27 json.dumps(crash_identifiers, sort_keys=True)).hexdigest()) | |
| 28 | |
| 29 @classmethod | |
| 30 def Get(cls, crash_identifiers): | |
| 31 return cls._CreateKey(crash_identifiers).get() | |
| 32 | |
| 33 @classmethod | |
| 34 def Create(cls, crash_identifiers): | |
| 35 analysis = cls(key=cls._CreateKey(crash_identifiers)) | |
| 36 return analysis | |
| OLD | NEW |