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

Side by Side Diff: build/android/pylib/forwarder.py

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # pylint: disable=W0212 5 # pylint: disable=W0212
6 6
7 import fcntl 7 import fcntl
8 import logging 8 import logging
9 import os 9 import os
10 import psutil 10 import psutil
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 pid_with_start_time = pid_file.readline() 263 pid_with_start_time = pid_file.readline()
264 if pid_with_start_time: 264 if pid_with_start_time:
265 (pid, process_start_time) = pid_with_start_time.split(':') 265 (pid, process_start_time) = pid_with_start_time.split(':')
266 if pid == str(pid_for_lock): 266 if pid == str(pid_for_lock):
267 if process_start_time == str(_GetProcessStartTime(pid_for_lock)): 267 if process_start_time == str(_GetProcessStartTime(pid_for_lock)):
268 return 268 return
269 self._KillHostLocked() 269 self._KillHostLocked()
270 pid_file.seek(0) 270 pid_file.seek(0)
271 pid_file.write( 271 pid_file.write(
272 '%s:%s' % (pid_for_lock, str(_GetProcessStartTime(pid_for_lock)))) 272 '%s:%s' % (pid_for_lock, str(_GetProcessStartTime(pid_for_lock))))
273 pid_file.truncate()
273 274
274 def _InitDeviceLocked(self, device, tool): 275 def _InitDeviceLocked(self, device, tool):
275 """Initializes the device_forwarder daemon for a specific device (once). 276 """Initializes the device_forwarder daemon for a specific device (once).
276 277
277 Note that the global lock must be acquired before calling this method. This 278 Note that the global lock must be acquired before calling this method. This
278 method kills any existing device_forwarder daemon on the device that could 279 method kills any existing device_forwarder daemon on the device that could
279 be stale, pushes the latest version of the daemon (to the device) and starts 280 be stale, pushes the latest version of the daemon (to the device) and starts
280 it. 281 it.
281 282
282 Args: 283 Args:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 """ 328 """
328 logging.info('Killing device_forwarder.') 329 logging.info('Killing device_forwarder.')
329 Forwarder._instance._initialized_devices.discard(str(device)) 330 Forwarder._instance._initialized_devices.discard(str(device))
330 if not device.FileExists(Forwarder._DEVICE_FORWARDER_PATH): 331 if not device.FileExists(Forwarder._DEVICE_FORWARDER_PATH):
331 return 332 return
332 333
333 cmd = '%s %s --kill-server' % (tool.GetUtilWrapper(), 334 cmd = '%s %s --kill-server' % (tool.GetUtilWrapper(),
334 Forwarder._DEVICE_FORWARDER_PATH) 335 Forwarder._DEVICE_FORWARDER_PATH)
335 device.old_interface.GetAndroidToolStatusAndOutput( 336 device.old_interface.GetAndroidToolStatusAndOutput(
336 cmd, lib_path=Forwarder._DEVICE_FORWARDER_FOLDER) 337 cmd, lib_path=Forwarder._DEVICE_FORWARDER_FOLDER)
OLDNEW
« no previous file with comments | « build/android/pylib/device/device_utils_test.py ('k') | build/android/pylib/gtest/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698