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

Unified Diff: appengine/findit/crash/crash_match.py

Issue 2704843002: [Predator] Add TouchCrashedDirectory feature. (Closed)
Patch Set: . Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/findit/crash/crash_data.py ('k') | appengine/findit/crash/crash_util.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/crash/crash_match.py
diff --git a/appengine/findit/crash/crash_match.py b/appengine/findit/crash/crash_match.py
new file mode 100644
index 0000000000000000000000000000000000000000..5683367c50317b172a067f3efea52aae10112107
--- /dev/null
+++ b/appengine/findit/crash/crash_match.py
@@ -0,0 +1,39 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from collections import namedtuple
+
+
+# TODO(wrengr): it's not clear why the ``priority`` is stored at all,
+# given that every use in this file discards it. ``Result.file_to_stack_infos``
+# should just store pointers directly to the frames themselves rather
+# than needing this intermediate object.
+# TODO(http://crbug.com/644476): this class needs a better name.
+class FrameInfo(namedtuple('FrameInfo', ['frame', 'priority'])):
+ """Represents a frame and information of the ``CallStack`` it belongs to."""
+
+ __slots__ = ()
+
+ def __str__(self): # pragma: no cover
+ return '%s(frame = %s, priority = %d)' % (
+ self.__class__.__name__, str(self.frame), self.priority)
+
+
+class CrashMatch(namedtuple('CrashMatch',
+ ['crashed_group', 'touched_files', 'frame_infos'])):
+
+ """Represents a match between touched files with frames in stacktrace.
+
+ The ``touched_files`` and ``frame_infos`` are matched under the same
+ ``crashed_group``, for example, CrashedFile('file.cc') or
+ CrashedDirectory('dir/').
+ """
+ __slots__ = ()
+
+ def __str__(self): # pragma: no cover
+ return '%s(crashed_group = %s, touched_files = %s, frame_infos = %s)' % (
+ self.__class__.__name__,
+ self.crashed_group.value,
+ ', '.join([str(touched_file) for touched_file in self.touched_files]),
+ ', '.join([str(frame_info) for frame_info in self.frame_infos]))
« no previous file with comments | « appengine/findit/crash/crash_data.py ('k') | appengine/findit/crash/crash_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698