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

Unified Diff: tools/telemetry/telemetry/core/backends/chrome/desktop_browser_backend.py

Issue 723403003: Shotdown browser cooperatively with taskill on win platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Tony's comment Created 6 years, 1 month 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: tools/telemetry/telemetry/core/backends/chrome/desktop_browser_backend.py
diff --git a/tools/telemetry/telemetry/core/backends/chrome/desktop_browser_backend.py b/tools/telemetry/telemetry/core/backends/chrome/desktop_browser_backend.py
index e4e0ff2bbbb15c44ea74196bf128bd57f4f93e09..f6e7210e412336eba288651a63dea6986f5349af 100644
--- a/tools/telemetry/telemetry/core/backends/chrome/desktop_browser_backend.py
+++ b/tools/telemetry/telemetry/core/backends/chrome/desktop_browser_backend.py
@@ -219,7 +219,7 @@ class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
return self._tmp_profile_dir
def IsBrowserRunning(self):
- return self._proc and self._proc.poll() == None
+ return self.browser.platform.IsProcessRunning(self._proc)
def GetStandardOutput(self):
if not self._tmp_output_file:
@@ -329,18 +329,14 @@ class DesktopBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
def Close(self):
super(DesktopBrowserBackend, self).Close()
- # Shutdown politely if the profile may be used again.
- if self._output_profile_path and self.IsBrowserRunning():
- self._proc.terminate()
- try:
- util.WaitFor(lambda: not self.IsBrowserRunning(), timeout=5)
- self._proc = None
- except util.TimeoutException:
- logging.warning('Failed to gracefully shutdown. Proceeding to kill.')
+ if self.IsBrowserRunning():
+ self.browser.platform.StopProcess(self._proc)
# Shutdown aggressively if the above failed or if the profile is temporary.
if self.IsBrowserRunning():
- self._proc.kill()
+ self.browser.platform.KillProcess(self._proc)
+ assert not self.IsBrowserRunning(), (
+ 'Failed to shutdown browser process with pid %s' % self._proc.pid)
self._proc = None
if self._crash_service:

Powered by Google App Engine
This is Rietveld 408576698