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.crash_analysis import CrashAnalysis |
| 11 | 11 |
| 12 | 12 |
| 13 class FracasCrashAnalysis(CrashAnalysis): | 13 class ChromeCrashAnalysis(CrashAnalysis): |
| 14 """Represents an analysis of a Chrome crash.""" | 14 """Represents an analysis of a Chrome crash (Cracas and Fracas).""" |
|
wrengr (wrong one)
2016/09/10 00:22:06
nit: Crash should be capitalized
Sharu Jiang
2016/09/14 20:46:36
Done.
| |
| 15 # Customized properties for Fracas crash. | 15 # Customized properties for Fracas crash. |
| 16 historical_metadata = ndb.JsonProperty(indexed=False) | 16 historical_metadata = ndb.JsonProperty(indexed=False) |
| 17 channel = ndb.StringProperty(indexed=False) | 17 channel = ndb.StringProperty(indexed=False) |
| 18 | 18 |
| 19 def Reset(self): | 19 def Reset(self): |
| 20 super(FracasCrashAnalysis, self).Reset() | 20 super(ChromeCrashAnalysis, self).Reset() |
| 21 self.historical_metadata = None | 21 self.historical_metadata = None |
| 22 self.channel = None | 22 self.channel = None |
| 23 | 23 |
| 24 @staticmethod | 24 @staticmethod |
| 25 def _CreateKey(crash_identifiers): | 25 def _CreateKey(crash_identifiers): |
| 26 return ndb.Key('FracasCrashAnalysis', hashlib.sha1( | 26 raise NotImplementedError() |
| 27 json.dumps(crash_identifiers, sort_keys=True)).hexdigest()) | |
| 28 | 27 |
| 29 @classmethod | 28 @classmethod |
| 30 def Get(cls, crash_identifiers): | 29 def Get(cls, crash_identifiers): |
| 31 return cls._CreateKey(crash_identifiers).get() | 30 return cls._CreateKey(crash_identifiers).get() |
| 32 | 31 |
| 33 @classmethod | 32 @classmethod |
| 34 def Create(cls, crash_identifiers): | 33 def Create(cls, crash_identifiers): |
| 35 analysis = cls(key=cls._CreateKey(crash_identifiers)) | 34 analysis = cls(key=cls._CreateKey(crash_identifiers)) |
| 36 return analysis | 35 return analysis |
|
wrengr (wrong one)
2016/09/10 00:22:06
It's not part of your diff, but while you're at it
Sharu Jiang
2016/09/14 20:46:36
Done.
| |
| OLD | NEW |