Commit e331ef6c authored by jbudorick's avatar jbudorick Committed by Commit bot

[Android] Always enable multiprocessing mode in the forwarder.

BUG=379378

Review URL: https://codereview.chromium.org/1023063005

Cr-Commit-Position: refs/heads/master@{#321597}
parent d4d4a120
......@@ -51,17 +51,11 @@ class Forwarder(object):
_DEVICE_FORWARDER_PATH = (constants.TEST_EXECUTABLE_DIR +
'/forwarder/device_forwarder')
_LOCK_PATH = '/tmp/chrome.forwarder.lock'
_MULTIPROCESSING_ENV_VAR = 'CHROME_FORWARDER_USE_MULTIPROCESSING'
# Defined in host_forwarder_main.cc
_HOST_FORWARDER_LOG = '/tmp/host_forwarder_log'
_instance = None
@staticmethod
def UseMultiprocessing():
"""Tells the forwarder that multiprocessing is used."""
os.environ[Forwarder._MULTIPROCESSING_ENV_VAR] = '1'
@staticmethod
def Map(port_pairs, device, tool=None):
"""Runs the forwarder.
......@@ -245,13 +239,10 @@ class Forwarder(object):
def _GetPidForLock():
"""Returns the PID used for host_forwarder initialization.
In case multi-process sharding is used, the PID of the "sharder" is used.
The "sharder" is the initial process that forks that is the parent process.
By default, multi-processing is not used. In that case the PID of the
current process is returned.
The PID of the "sharder" is used to handle multiprocessing. The "sharder"
is the initial process that forks that is the parent process.
"""
use_multiprocessing = Forwarder._MULTIPROCESSING_ENV_VAR in os.environ
return os.getpgrp() if use_multiprocessing else os.getpid()
return os.getpgrp()
def _InitHostLocked(self):
"""Initializes the host forwarder daemon.
......
......@@ -72,7 +72,6 @@ def Setup(test_options):
# Before running the tests, kill any leftover server.
test_environment.CleanupLeftoverProcesses()
forwarder.Forwarder.UseMultiprocessing()
# We want to keep device affinity, so return all devices ever seen.
all_devices = _GetAllDevices()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment