| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from collections import namedtuple |
| 6 |
| 7 |
| 8 # TODO(wrengr): it's not clear why the ``priority`` is stored at all, |
| 9 # given that every use in this file discards it. ``Result.file_to_stack_infos`` |
| 10 # should just store pointers directly to the frames themselves rather |
| 11 # than needing this intermediate object. |
| 12 # TODO(http://crbug.com/644476): this class needs a better name. |
| 13 class FrameInfo(namedtuple('FrameInfo', ['frame', 'priority'])): |
| 14 """Represents a frame and information of the ``CallStack`` it belongs to.""" |
| 15 |
| 16 __slots__ = () |
| 17 |
| 18 def __str__(self): # pragma: no cover |
| 19 return '%s(frame = %s, priority = %d)' % ( |
| 20 self.__class__.__name__, str(self.frame), self.priority) |
| 21 |
| 22 |
| 23 class CrashMatch(namedtuple('CrashMatch', |
| 24 ['crashed_group', 'touched_files', 'frame_infos'])): |
| 25 |
| 26 """Represents a match between touched files with frames in stacktrace. |
| 27 |
| 28 The ``touched_files`` and ``frame_infos`` are matched under the same |
| 29 ``crashed_group``, for example, CrashedFile('file.cc') or |
| 30 CrashedDirectory('dir/'). |
| 31 """ |
| 32 __slots__ = () |
| 33 |
| 34 def __str__(self): # pragma: no cover |
| 35 return '%s(crashed_group = %s, touched_files = %s, frame_infos = %s)' % ( |
| 36 self.__class__.__name__, |
| 37 self.crashed_group.value, |
| 38 ', '.join([str(touched_file) for touched_file in self.touched_files]), |
| 39 ', '.join([str(frame_info) for frame_info in self.frame_infos])) |
| OLD | NEW |