Index: tools/findit/blame.py |
diff --git a/tools/findit/blame.py b/tools/findit/blame.py |
index 30c54bd1887e0c454a1d8f5c700e27ad8e3c1881..9997bc0e1bd82f0ac42d7d4a93e37e6fdf9b5c09 100644 |
--- a/tools/findit/blame.py |
+++ b/tools/findit/blame.py |
@@ -2,7 +2,7 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-from threading import Lock, Thread |
+from threading import Lock |
from common import utils |
import crash_utils |
@@ -77,7 +77,7 @@ class BlameList(object): |
""" |
# Only return blame information for first 'top_n_frames' frames. |
stack_frames = callstack.GetTopNFrames(top_n_frames) |
- threads = [] |
+ tasks = [] |
# Iterate through frames in stack. |
for stack_frame in stack_frames: |
# If the component this line is from does not have a crash revision, |
@@ -102,17 +102,16 @@ class BlameList(object): |
range_start = int(component_object['old_revision']) |
range_end = int(component_object['new_revision']) |
- # Generate blame entry, one thread for one entry. |
- blame_thread = Thread( |
- target=self.__GenerateBlameEntry, |
- args=[repository_parser, stack_frame, crash_revision, |
- range_start, range_end]) |
- threads.append(blame_thread) |
- blame_thread.start() |
+ # Create a task to generate blame entry. |
+ tasks.append({ |
+ 'function': self.__GenerateBlameEntry, |
+ 'args': [repository_parser, stack_frame, crash_revision, |
+ range_start, range_end] |
+ }) |
+ |
+ # Run all the tasks. |
+ crash_utils.RunTasks(tasks) |
- # Join the results before returning. |
- for blame_thread in threads: |
- blame_thread.join() |
def __GenerateBlameEntry(self, repository_parser, stack_frame, |
crash_revision, range_start, range_end): |
@@ -124,6 +123,9 @@ class BlameList(object): |
file_path = stack_frame.file_path |
crashed_line_number = stack_frame.crashed_line_range[0] |
+ if file_path.startswith(component_path): |
+ file_path = file_path[len(component_path):] |
+ |
# Parse blame information. |
parsed_blame_info = repository_parser.ParseBlameInfo( |
component_path, file_path, crashed_line_number, crash_revision) |