Chromium Code Reviews| 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 | 5 import hashlib |
| 6 import json | 6 import json |
| 7 | 7 |
| 8 from google.appengine.ext import ndb | 8 from google.appengine.ext import ndb |
| 9 | 9 |
| 10 from model.crash.crash_analysis import CrashAnalysis | 10 from model.crash.chrome_crash_analysis import ChromeCrashAnalysis |
| 11 | 11 |
| 12 | 12 |
| 13 class FracasCrashAnalysis(CrashAnalysis): | 13 class FracasCrashAnalysis(ChromeCrashAnalysis): |
| 14 """Represents an analysis of a Chrome crash.""" | 14 """Represents an analysis of a Chrome crash.""" |
|
stgao
2016/09/13 17:04:47
a Chrome crash on Fracas?
Sharu Jiang
2016/09/14 20:46:36
Done.
| |
| 15 # Customized properties for Fracas crash. | |
| 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 | 15 |
| 24 @staticmethod | 16 @staticmethod |
| 25 def _CreateKey(crash_identifiers): | 17 def _CreateKey(crash_identifiers): |
| 26 return ndb.Key('FracasCrashAnalysis', hashlib.sha1( | 18 return ndb.Key('FracasCrashAnalysis', hashlib.sha1( |
| 27 json.dumps(crash_identifiers, sort_keys=True)).hexdigest()) | 19 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 |