| 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 """This module is interfacas between clients-specific code and core. | 5 """This module is interfacas between clients-specific code and core. |
| 6 | 6 |
| 7 Note, fracas and cracas are almost identical and fracas is an intermidiate | 7 Note, fracas and cracas are almost identical and fracas is an intermidiate |
| 8 state while transfering to cracas, so they can be handled in the same code path | 8 state while transfering to cracas, so they can be handled in the same code path |
| 9 and can be refered to as chromecrash.""" | 9 and can be refered to as chromecrash.""" |
| 10 | 10 |
| 11 import copy | 11 import copy |
| 12 import json | 12 import json |
| 13 import logging | 13 import logging |
| 14 | 14 |
| 15 from google.appengine.ext import ndb | 15 from google.appengine.ext import ndb |
| 16 | 16 |
| 17 from common import appengine_util | 17 from common import appengine_util |
| 18 from common import time_util | 18 from common import time_util |
| 19 from crash import findit_for_chromecrash | 19 from crash import findit_for_chromecrash |
| 20 from crash.type_enums import CrashClient | 20 from crash.type_enums import CrashClient |
| 21 from model import analysis_status | 21 from model import analysis_status |
| 22 from model.crash.crash_config import CrashConfig | 22 from model.crash.crash_config import CrashConfig |
| 23 from model.crash.fracas_crash_analysis import FracasCrashAnalysis | 23 from model.crash.fracas_crash_analysis import FracasCrashAnalysis |
| 24 from model.crash.cracas_crash_analysis import CracasCrashAnalysis |
| 24 | 25 |
| 25 _FINDIT_FRACAS_FEEDBACK_URL_TEMPLATE = '%s/crash/fracas-result-feedback?key=%s' | 26 _FINDIT_FRACAS_FEEDBACK_URL_TEMPLATE = '%s/crash/fracas-result-feedback?key=%s' |
| 26 | 27 |
| 27 | 28 |
| 28 def CheckPolicyForClient(crash_identifiers, chrome_version, signature, | 29 def CheckPolicyForClient(crash_identifiers, chrome_version, signature, |
| 29 client_id, platform, stack_trace, customized_data): | 30 client_id, platform, stack_trace, customized_data): |
| 30 """Checks if the args pass the client policy or not, update the parameters | 31 """Checks if the args pass the client policy or not, update the parameters |
| 31 if needed.""" | 32 if needed.""" |
| 32 crash_config = CrashConfig.Get() | 33 crash_config = CrashConfig.Get() |
| 33 | 34 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 64 | 65 |
| 65 return True, (crash_identifiers, chrome_version, signature, client_id, | 66 return True, (crash_identifiers, chrome_version, signature, client_id, |
| 66 platform, stack_trace, customized_data) | 67 platform, stack_trace, customized_data) |
| 67 | 68 |
| 68 | 69 |
| 69 def GetAnalysisForClient(crash_identifiers, client_id): | 70 def GetAnalysisForClient(crash_identifiers, client_id): |
| 70 analysis = None | 71 analysis = None |
| 71 if client_id == CrashClient.FRACAS: | 72 if client_id == CrashClient.FRACAS: |
| 72 analysis = FracasCrashAnalysis.Get(crash_identifiers) | 73 analysis = FracasCrashAnalysis.Get(crash_identifiers) |
| 73 elif client_id == CrashClient.CRACAS: # pragma: no cover. | 74 elif client_id == CrashClient.CRACAS: # pragma: no cover. |
| 74 # TODO(katesonia): Add CracasCrashAnalysis model. | 75 analysis = CracasCrashAnalysis.Get(crash_identifiers) |
| 75 pass | |
| 76 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 76 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 77 # TODO(katesonia): Add ClusterfuzzCrashAnalysis model. | 77 # TODO(katesonia): Add ClusterfuzzCrashAnalysis model. |
| 78 pass | 78 pass |
| 79 | 79 |
| 80 return analysis | 80 return analysis |
| 81 | 81 |
| 82 | 82 |
| 83 def ResetAnalysis(analysis, crash_identifiers, chrome_version, signature, | 83 def ResetAnalysis(analysis, crash_identifiers, chrome_version, signature, |
| 84 client_id, platform, stack_trace, customized_data): | 84 client_id, platform, stack_trace, customized_data): |
| 85 """Resets analysis and returns if analysis get successfully reset or not.""" | 85 """Resets analysis and returns if analysis get successfully reset or not.""" |
| 86 if not analysis: | 86 if not analysis: |
| 87 # A new analysis is needed if there is no analysis. | 87 # A new analysis is needed if there is no analysis. |
| 88 if client_id == CrashClient.FRACAS: | 88 if client_id == CrashClient.FRACAS: |
| 89 analysis = FracasCrashAnalysis.Create(crash_identifiers) | 89 analysis = FracasCrashAnalysis.Create(crash_identifiers) |
| 90 elif client_id == CrashClient.CRACAS: # pragma: no cover. | 90 elif client_id == CrashClient.CRACAS: # pragma: no cover. |
| 91 # TODO(katesonia): define CracasCrashAnalysis. | 91 analysis = CracasCrashAnalysis.Create(crash_identifiers) |
| 92 return False | |
| 93 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 92 elif client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 94 # TODO(katesonia): define ClusterfuzzCrashAnalysis. | 93 # TODO(katesonia): define ClusterfuzzCrashAnalysis. |
| 95 return False | 94 return False |
| 96 else: | 95 else: |
| 97 # The client id is not supported. | 96 # The client id is not supported. |
| 98 return False | 97 return False |
| 99 | 98 |
| 100 analysis.Reset() | 99 analysis.Reset() |
| 101 | 100 |
| 102 # Set common properties. | 101 # Set common properties. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 if (analysis.client_id == CrashClient.FRACAS or | 152 if (analysis.client_id == CrashClient.FRACAS or |
| 154 analysis.client_id == CrashClient.CRACAS): | 153 analysis.client_id == CrashClient.CRACAS): |
| 155 result, tags = findit_for_chromecrash.FindCulpritForChromeCrash( | 154 result, tags = findit_for_chromecrash.FindCulpritForChromeCrash( |
| 156 analysis.signature, analysis.platform, analysis.stack_trace, | 155 analysis.signature, analysis.platform, analysis.stack_trace, |
| 157 analysis.crashed_version, analysis.historical_metadata) | 156 analysis.crashed_version, analysis.historical_metadata) |
| 158 elif analysis.client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. | 157 elif analysis.client_id == CrashClient.CLUSTERFUZZ: # pragma: no cover. |
| 159 # TODO(katesonia): Implement findit_for_clusterfuzz. | 158 # TODO(katesonia): Implement findit_for_clusterfuzz. |
| 160 pass | 159 pass |
| 161 | 160 |
| 162 return result, tags | 161 return result, tags |
| OLD | NEW |