Chromium Code Reviews| Index: build/android/pylib/device/device_utils.py |
| diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py |
| index 8064ce88cb28eccde7773258d5f56f29e21fc78f..f7a71c1ee96ba8e9c39760f8ac3c31421f347ac4 100644 |
| --- a/build/android/pylib/device/device_utils.py |
| +++ b/build/android/pylib/device/device_utils.py |
| @@ -19,6 +19,7 @@ import re |
| import shutil |
| import sys |
| import tempfile |
| +import threading |
| import time |
| import zipfile |
| @@ -1092,11 +1093,16 @@ class DeviceUtils(object): |
| return ret |
| def _ComputeStaleApks(self, package_name, host_apk_paths): |
| - host_checksums = md5sum.CalculateHostMd5Sums(host_apk_paths) |
| + host_checksums_holder = [None] |
| + def DoComputeHostChecksums(): |
|
jbudorick
2015/08/11 18:06:40
nit: I've generally been trying to keep local func
agrieve
2015/08/11 18:15:00
Done.
|
| + host_checksums_holder[0] = md5sum.CalculateHostMd5Sums(host_apk_paths) |
|
jbudorick
2015/08/11 18:06:40
nit: line break after function definition
agrieve
2015/08/11 18:15:00
Done.
|
| + host_thread = threading.Thread(target=DoComputeHostChecksums) |
|
jbudorick
2015/08/11 18:06:40
I'd prefer it if you used a timeout_retry thread:
agrieve
2015/08/11 18:15:00
Since this is a private helper, and all public met
jbudorick
2015/08/11 18:16:54
ah, right.
|
| + host_thread.start() |
| device_checksums = self._ComputeDeviceChecksumsForApks(package_name) |
| - stale_apks = [k for (k, v) in host_checksums.iteritems() |
| + host_thread.join() |
| + stale_apks = [k for (k, v) in host_checksums_holder[0].iteritems() |
| if v not in device_checksums] |
| - return stale_apks, set(host_checksums.values()) |
| + return stale_apks, set(host_checksums_holder[0].values()) |
| def _PushFilesImpl(self, host_device_tuples, files): |
| size = sum(host_utils.GetRecursiveDiskUsage(h) for h, _ in files) |