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: |