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 FracasCrashAnalysis(CrashAnalysis): |
| 14 """Represents an analysis of a Chrome crash.""" | 14 """Represents an analysis of a Chrome crash.""" |
| 15 # Customized properties for Fracas crash. | 15 # Customized properties for Fracas crash. |
| 16 historic_metadata = ndb.JsonProperty(indexed=False) | 16 historical_metadata = ndb.JsonProperty(indexed=False) |
|
stgao
2016/06/13 21:25:51
Note: this change won't be backward-compatible.
Sharu Jiang
2016/06/21 00:28:14
Right, however I deleted some old data, so it shou
| |
| 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(FracasCrashAnalysis, self).Reset() |
| 21 self.historic_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 return ndb.Key('FracasCrashAnalysis', hashlib.sha1( |
| 27 json.dumps(crash_identifiers, sort_keys=True)).hexdigest()) | 27 json.dumps(crash_identifiers, sort_keys=True)).hexdigest()) |
| 28 | 28 |
| 29 @classmethod | 29 @classmethod |
| 30 def Get(cls, crash_identifiers): | 30 def Get(cls, crash_identifiers): |
| 31 return cls._CreateKey(crash_identifiers).get() | 31 return cls._CreateKey(crash_identifiers).get() |
| 32 | 32 |
| 33 @classmethod | 33 @classmethod |
| 34 def Create(cls, crash_identifiers): | 34 def Create(cls, crash_identifiers): |
| 35 analysis = cls(key=cls._CreateKey(crash_identifiers)) | 35 analysis = cls(key=cls._CreateKey(crash_identifiers)) |
| 36 return analysis | 36 return analysis |
| OLD | NEW |