⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 252722 in webkit


Ignore:
Timestamp:
Nov 20, 2019, 5:25:19 PM (7 years ago)
Author:
Jonathan Bedard
Message:

run-webkit-tests: Do not create global SystemHost objects
https://bugs.webkit.org/show_bug.cgi?id=204426

Reviewed by Aakash Jain.

If created, SystemHost objects should be created on-demand, not globally
shared between all instances of a function.

  • Scripts/webkitpy/xcode/simulated_device.py:

(SimulatedDeviceManager.populate_available_devices):
(SimulatedDeviceManager.available_devices):
(SimulatedDeviceManager.device_by_filter):
(SimulatedDeviceManager._create_or_find_device_for_request):
(SimulatedDeviceManager._boot_device):
(SimulatedDeviceManager.device_count_for_type):
(SimulatedDeviceManager.initialize_devices):
(SimulatedDeviceManager.max_supported_simulators):
(SimulatedDeviceManager.swap):
(SimulatedDeviceManager.tear_down):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r252719 r252722  
     12019-11-20  Jonathan Bedard  <jbedard@apple.com>
     2
     3        run-webkit-tests: Do not create global SystemHost objects
     4        https://bugs.webkit.org/show_bug.cgi?id=204426
     5
     6        Reviewed by Aakash Jain.
     7
     8        If created, SystemHost objects should be created on-demand, not globally
     9        shared between all instances of a function.
     10
     11        * Scripts/webkitpy/xcode/simulated_device.py:
     12        (SimulatedDeviceManager.populate_available_devices):
     13        (SimulatedDeviceManager.available_devices):
     14        (SimulatedDeviceManager.device_by_filter):
     15        (SimulatedDeviceManager._create_or_find_device_for_request):
     16        (SimulatedDeviceManager._boot_device):
     17        (SimulatedDeviceManager.device_count_for_type):
     18        (SimulatedDeviceManager.initialize_devices):
     19        (SimulatedDeviceManager.max_supported_simulators):
     20        (SimulatedDeviceManager.swap):
     21        (SimulatedDeviceManager.tear_down):
     22
    1232019-11-20  Wenson Hsieh  <wenson_hsieh@apple.com>
    224
  • trunk/Tools/Scripts/webkitpy/xcode/simulated_device.py

    r251793 r252722  
    124124
    125125    @staticmethod
    126     def populate_available_devices(host=SystemHost()):
     126    def populate_available_devices(host=None):
     127        host = host or SystemHost()
    127128        if not host.platform.is_mac():
    128129            return
     
    158159
    159160    @staticmethod
    160     def available_devices(host=SystemHost()):
     161    def available_devices(host=None):
     162        host = host or SystemHost()
    161163        if SimulatedDeviceManager.AVAILABLE_DEVICES == []:
    162164            SimulatedDeviceManager.populate_available_devices(host)
     
    164166
    165167    @staticmethod
    166     def device_by_filter(filter, host=SystemHost()):
     168    def device_by_filter(filter, host=None):
     169        host = host or SystemHost()
    167170        result = []
    168171        for device in SimulatedDeviceManager.available_devices(host):
     
    250253
    251254    @staticmethod
    252     def _create_or_find_device_for_request(request, host=SystemHost(), name_base='Managed'):
     255    def _create_or_find_device_for_request(request, host=None, name_base='Managed'):
    253256        assert isinstance(request, DeviceRequest)
     257        host = host or SystemHost()
    254258
    255259        device = SimulatedDeviceManager._find_exisiting_device_for_request(request)
     
    334338
    335339    @staticmethod
    336     def _boot_device(device, host=SystemHost()):
     340    def _boot_device(device, host=None):
     341        host = host or SystemHost()
    337342        _log.debug(u"Booting device '{}'".format(device.udid))
    338343        device.platform_device.booted_by_script = True
     
    341346
    342347    @staticmethod
    343     def device_count_for_type(device_type, host=SystemHost(), use_booted_simulator=True, **kwargs):
     348    def device_count_for_type(device_type, host=None, use_booted_simulator=True, **kwargs):
     349        host = host or SystemHost()
    344350        if not host.platform.is_mac():
    345351            return 0
     
    355361
    356362    @staticmethod
    357     def initialize_devices(requests, host=SystemHost(), name_base='Managed', simulator_ui=True, timeout=SIMULATOR_BOOT_TIMEOUT, **kwargs):
     363    def initialize_devices(requests, host=None, name_base='Managed', simulator_ui=True, timeout=SIMULATOR_BOOT_TIMEOUT, **kwargs):
     364        host = host or SystemHost()
    358365        if SimulatedDeviceManager.INITIALIZED_DEVICES is not None:
    359366            return SimulatedDeviceManager.INITIALIZED_DEVICES
     
    411418    @staticmethod
    412419    @memoized
    413     def max_supported_simulators(host=SystemHost()):
     420    def max_supported_simulators(host=None):
     421        host = host or SystemHost()
    414422        if not host.platform.is_mac():
    415423            return 0
     
    439447
    440448    @staticmethod
    441     def swap(device, request, host=SystemHost(), name_base='Managed', timeout=SIMULATOR_BOOT_TIMEOUT):
     449    def swap(device, request, host=None, name_base='Managed', timeout=SIMULATOR_BOOT_TIMEOUT):
     450        host = host or SystemHost()
    442451        if SimulatedDeviceManager.INITIALIZED_DEVICES is None:
    443452            raise RuntimeError('Cannot swap when there are no initialized devices')
     
    462471
    463472    @staticmethod
    464     def tear_down(host=SystemHost(), timeout=SIMULATOR_BOOT_TIMEOUT):
     473    def tear_down(host=None, timeout=SIMULATOR_BOOT_TIMEOUT):
     474        host = host or SystemHost()
    465475        if SimulatedDeviceManager._managing_simulator_app:
    466476            host.executive.run_command(['killall', '-9', 'Simulator'], return_exit_code=True)
Note: See TracChangeset for help on using the changeset viewer.