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

Unified Diff: tools/findit/blame.py

Issue 510163002: [Findit] Fix blame for GIT and uptake bug fix. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reuse threads in a pool. Created 6 years, 4 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 | « no previous file | tools/findit/crash_utils.py » ('j') | tools/findit/crash_utils.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | tools/findit/crash_utils.py » ('j') | tools/findit/crash_utils.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698