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

Unified Diff: systrace/profile_chrome/chrome_startup_tracing_agent.py

Issue 2297403003: Use Systrace tracing controller in profile_chrome (Closed) Base URL: https://chromium.googlesource.com/external/github.com/catapult-project/catapult.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: systrace/profile_chrome/chrome_startup_tracing_agent.py
diff --git a/systrace/profile_chrome/chrome_startup_tracing_agent.py b/systrace/profile_chrome/chrome_startup_tracing_agent.py
index 44ae1211609ecedd3fc3e190f00371c30f0ac4bb..506dac55f9f1dd8d84bddb0f05512a41ef479ab6 100644
--- a/systrace/profile_chrome/chrome_startup_tracing_agent.py
+++ b/systrace/profile_chrome/chrome_startup_tracing_agent.py
@@ -60,6 +60,7 @@ class ChromeStartupTracingAgent(tracing_agents.TracingAgent):
def StartAgentTracing(self, config, timeout=None):
self._SetupTracing()
self._logcat_monitor.Start()
+ return True
@py_utils.Timeout(tracing_agents.START_STOP_TIMEOUT)
def StopAgentTracing(self, timeout=None):
@@ -68,6 +69,7 @@ class ChromeStartupTracingAgent(tracing_agents.TracingAgent):
self._trace_finish_re).group(1)
finally:
self._TearDownTracing()
+ return True
@py_utils.Timeout(tracing_agents.GET_RESULTS_TIMEOUT)
def GetResults(self, timeout=None):
@@ -85,15 +87,29 @@ class ChromeStartupTracingAgent(tracing_agents.TracingAgent):
return False
def RecordClockSyncMarker(self, sync_id, did_record_sync_marker_callback):
+ # pylint: disable=unused-argument
assert self.SupportsExplicitClockSync(), ('Clock sync marker cannot be '
'recorded since explicit clock sync is not supported.')
class ChromeStartupConfig(tracing_agents.TracingConfig):
- def __init__(self):
+ def __init__(self, device, package_info, cold, url, chrome_categories,
+ chrome_startup):
tracing_agents.TracingConfig.__init__(self)
+ self.device = device
+ self.package_info = package_info
+ self.cold = cold
+ self.url = url
+ self.chrome_categories = chrome_categories
+ self.chrome_startup = chrome_startup
+def try_create_agent(config):
+ if config.chrome_startup:
+ return ChromeStartupTracingAgent(config.device, config.package_info,
+ config.cold, config.url)
+ return False
Sami 2016/09/01 12:15:59 I think it would be more pythonic to either return
washingtonp 2016/09/01 17:44:41 Done.
+
def add_options(parser):
options = optparse.OptionGroup(parser, 'Chrome startup tracing')
options.add_option('--url', help='URL to visit on startup. Default: '
@@ -103,8 +119,10 @@ def add_options(parser):
options.add_option('--cold', help='Flush the OS page cache before starting '
'the browser. Note that this require a device with root '
'access.', default=False, action='store_true')
+ options.chrome_startup = True
Sami 2016/09/01 12:15:59 I wouldn't expect a function called add_options to
washingtonp 2016/09/01 17:44:41 Done.
return options
def get_config(options):
- # pylint: disable=unused-argument
- return ChromeStartupConfig()
+ return ChromeStartupConfig(options.device, options.package_info,
+ options.cold, options.url,
+ options.chrome_categories, options.chrome_startup)

Powered by Google App Engine
This is Rietveld 408576698