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

Unified Diff: tools/perf/profile_creators/profile_extender.py

Issue 1822043004: Do not close network controller in ProfileExtender if it was not opened there. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase changes Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/profile_creators/profile_extender.py
diff --git a/tools/perf/profile_creators/profile_extender.py b/tools/perf/profile_creators/profile_extender.py
index 5c2a9df6aac8914be10f333cf0bc603265df07da..6b34ae5efe0dc93c3575b2b19d9e91fa6f625350 100644
--- a/tools/perf/profile_creators/profile_extender.py
+++ b/tools/perf/profile_creators/profile_extender.py
@@ -38,6 +38,10 @@ class ProfileExtender(object):
# This member is initialized during SetUpBrowser().
self._browser = None
+ # We only need to close network controller if we opened it before.
+ # If it was already open, we should not close it.
+ self._should_close_network_controller = False
+
def Run(self):
"""Creates or extends the profile."""
raise NotImplementedError()
@@ -109,7 +113,8 @@ class ProfileExtender(object):
super class implementation.
"""
if self._browser:
- self._browser.platform.network_controller.Close()
+ if self._should_close_network_controller:
+ self._browser.platform.network_controller.Close()
self._browser.Close()
self._browser = None
@@ -135,8 +140,10 @@ class ProfileExtender(object):
wpr_mode = wpr_modes.WPR_REPLAY
network_controller = possible_browser.platform.network_controller
- network_controller.Open(wpr_mode, finder_options.browser_options.netsim,
- finder_options.browser_options.extra_wpr_args)
+ if not network_controller.is_open:
+ self._should_close_network_controller = True
+ network_controller.Open(wpr_mode, finder_options.browser_options.netsim,
+ finder_options.browser_options.extra_wpr_args)
network_controller.StartReplay(
wpr_archive_path, make_javascript_deterministic=True)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698