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

Side by Side Diff: tools/telemetry/telemetry/core/platform.py

Issue 1263063003: Revert of Create classes_util API, change discover to return a list instead of a dict. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 # Copyright 2012 The Chromium Authors. All rights reserved. 1 # Copyright 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 import logging as real_logging 4 import logging as real_logging
5 import os 5 import os
6 6
7 from telemetry.core import discover
7 from telemetry.core import network_controller 8 from telemetry.core import network_controller
8 from telemetry.core import tracing_controller 9 from telemetry.core import tracing_controller
9 from telemetry.core import util 10 from telemetry.core import util
10 from telemetry.internal.platform import platform_backend as platform_backend_mod ule 11 from telemetry.internal.platform import platform_backend as platform_backend_mod ule
11 from telemetry.util import classes_util
12 12
13 13
14 _host_platform = None 14 _host_platform = None
15 # Remote platform is a dictionary from device ids to remote platform instances. 15 # Remote platform is a dictionary from device ids to remote platform instances.
16 _remote_platforms = {} 16 _remote_platforms = {}
17 17
18 18
19 def _InitHostPlatformIfNeeded(): 19 def _InitHostPlatformIfNeeded():
20 global _host_platform 20 global _host_platform
21 if _host_platform: 21 if _host_platform:
(...skipping 10 matching lines...) Expand all
32 32
33 33
34 def GetHostPlatform(): 34 def GetHostPlatform():
35 _InitHostPlatformIfNeeded() 35 _InitHostPlatformIfNeeded()
36 return _host_platform 36 return _host_platform
37 37
38 38
39 def _IterAllPlatformBackendClasses(): 39 def _IterAllPlatformBackendClasses():
40 platform_dir = os.path.dirname( 40 platform_dir = os.path.dirname(
41 os.path.realpath(platform_backend_module.__file__)) 41 os.path.realpath(platform_backend_module.__file__))
42 return classes_util.DiscoverClasses( 42 return discover.DiscoverClasses(
43 platform_dir, util.GetTelemetryDir(), 43 platform_dir, util.GetTelemetryDir(),
44 platform_backend_module.PlatformBackend) 44 platform_backend_module.PlatformBackend).itervalues()
45 45
46 46
47 def GetPlatformForDevice(device, finder_options, logging=real_logging): 47 def GetPlatformForDevice(device, finder_options, logging=real_logging):
48 """ Returns a platform instance for the device. 48 """ Returns a platform instance for the device.
49 Args: 49 Args:
50 device: a device.Device instance. 50 device: a device.Device instance.
51 """ 51 """
52 if device.guid in _remote_platforms: 52 if device.guid in _remote_platforms:
53 return _remote_platforms[device.guid] 53 return _remote_platforms[device.guid]
54 try: 54 try:
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 309
310 Args: 310 Args:
311 proc: a process object returned from subprocess.Popen. 311 proc: a process object returned from subprocess.Popen.
312 app_name: on Windows, is the prefix of the application's window 312 app_name: on Windows, is the prefix of the application's window
313 class name that should be searched for. This helps ensure 313 class name that should be searched for. This helps ensure
314 that only the application's windows are closed. 314 that only the application's windows are closed.
315 315
316 Returns True if it is believed the attempt succeeded. 316 Returns True if it is believed the attempt succeeded.
317 """ 317 """
318 return self._platform_backend.CooperativelyShutdown(proc, app_name) 318 return self._platform_backend.CooperativelyShutdown(proc, app_name)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698