Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1290)

Side by Side Diff: appengine/findit/crash/changelist_classifier.py

Issue 2562623004: Making CallStack immutable, so it can be hashable (Closed)
Patch Set: Addressing nits Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 logging 5 import logging
6 from collections import defaultdict 6 from collections import defaultdict
7 from collections import namedtuple 7 from collections import namedtuple
8 8
9 from common import chrome_dependency_fetcher 9 from common import chrome_dependency_fetcher
10 from crash import crash_util 10 from crash import crash_util
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 """ 51 """
52 if not report.regression_range: 52 if not report.regression_range:
53 logging.warning('ChangelistClassifier.__call__: Missing regression range ' 53 logging.warning('ChangelistClassifier.__call__: Missing regression range '
54 'for report: %s', str(report)) 54 'for report: %s', str(report))
55 return [] 55 return []
56 last_good_version, first_bad_version = report.regression_range 56 last_good_version, first_bad_version = report.regression_range
57 logging.info('ChangelistClassifier.__call__: Regression range %s:%s', 57 logging.info('ChangelistClassifier.__call__: Regression range %s:%s',
58 last_good_version, first_bad_version) 58 last_good_version, first_bad_version)
59 59
60 # Restrict analysis to just the top n frames in each callstack. 60 # Restrict analysis to just the top n frames in each callstack.
61 # TODO(wrengr): move this to be a Stacktrace method?
62 stacktrace = Stacktrace([ 61 stacktrace = Stacktrace([
63 CallStack(stack.priority, 62 stack.SliceFrames(None, self.top_n_frames)
64 format_type=stack.format_type,
65 language_type=stack.language_type,
66 frame_list=stack[:self.top_n_frames])
67 for stack in report.stacktrace]) 63 for stack in report.stacktrace])
68 64
69 # We are only interested in the deps in crash stack (the callstack that 65 # We are only interested in the deps in crash stack (the callstack that
70 # caused the crash). 66 # caused the crash).
71 # TODO(wrengr): we may want to receive the crash deps as an argument, 67 # TODO(wrengr): we may want to receive the crash deps as an argument,
72 # so that when this method is called via Findit.FindCulprit, we avoid 68 # so that when this method is called via Findit.FindCulprit, we avoid
73 # doing redundant work creating it. 69 # doing redundant work creating it.
74 stack_deps = GetDepsInCrashStack( 70 stack_deps = GetDepsInCrashStack(
75 report.stacktrace.crash_stack, 71 report.stacktrace.crash_stack,
76 chrome_dependency_fetcher.ChromeDependencyFetcher( 72 chrome_dependency_fetcher.ChromeDependencyFetcher(
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 repository.repo_url = stack_deps[dep].repo_url 299 repository.repo_url = stack_deps[dep].repo_url
304 blame = repository.GetBlame(touched_file_path, 300 blame = repository.GetBlame(touched_file_path,
305 stack_deps[dep].revision) 301 stack_deps[dep].revision)
306 302
307 # Generate/update each result(changelog) in changelogs, blame is used 303 # Generate/update each result(changelog) in changelogs, blame is used
308 # to calculate distance between touched lines and crashed lines in file. 304 # to calculate distance between touched lines and crashed lines in file.
309 match_results.GenerateMatchResults( 305 match_results.GenerateMatchResults(
310 touched_file_path, dep, stack_infos, changelogs, blame) 306 touched_file_path, dep, stack_infos, changelogs, blame)
311 307
312 return match_results.values() 308 return match_results.values()
OLDNEW
« no previous file with comments | « appengine/findit/crash/callstack_filters.py ('k') | appengine/findit/crash/chromecrash_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698