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

Unified Diff: tools/findit/blame.py

Issue 525433003: [Findit] Use a thread pool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert print. Created 6 years, 3 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') | no next file with comments »
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 67ca30e8f7163a27f4fd56267ff02feb5597205b..6acb20fabe46a55f92ee3c7e6432aa722601e625 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,14 @@ 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()
-
- # Join the results before returning.
- for blame_thread in threads:
- blame_thread.join()
+ # 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)
def __GenerateBlameEntry(self, repository_parser, stack_frame,
crash_revision, range_start, range_end):
« no previous file with comments | « no previous file | tools/findit/crash_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698