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

Side by Side Diff: telemetry/telemetry/internal/browser/browser.py

Issue 1818593002: [Telemetry] Always close browser backend in Close() (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 import logging 5 import logging
6 import sys 6 import sys
7 7
8 from catapult_base import cloud_storage # pylint: disable=import-error 8 from catapult_base import cloud_storage # pylint: disable=import-error
9 9
10 from telemetry.core import exceptions 10 from telemetry.core import exceptions
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 cpu_timestamp = self._platform_backend.GetCpuTimestamp() 215 cpu_timestamp = self._platform_backend.GetCpuTimestamp()
216 for process_type in result: 216 for process_type in result:
217 # Skip any process_types that are empty 217 # Skip any process_types that are empty
218 if not len(result[process_type]): 218 if not len(result[process_type]):
219 continue 219 continue
220 result[process_type].update(cpu_timestamp) 220 result[process_type].update(cpu_timestamp)
221 return result 221 return result
222 222
223 def Close(self): 223 def Close(self):
224 """Closes this browser.""" 224 """Closes this browser."""
225 if self._browser_backend.IsBrowserRunning(): 225 try:
226 self._platform_backend.WillCloseBrowser(self, self._browser_backend) 226 if self._browser_backend.IsBrowserRunning():
227 self._platform_backend.WillCloseBrowser(self, self._browser_backend)
227 228
228 self._browser_backend.profiling_controller_backend.WillCloseBrowser() 229 self._browser_backend.profiling_controller_backend.WillCloseBrowser()
229 if self._browser_backend.supports_uploading_logs: 230 if self._browser_backend.supports_uploading_logs:
230 try: 231 try:
231 self._browser_backend.UploadLogsToCloudStorage() 232 self._browser_backend.UploadLogsToCloudStorage()
232 except cloud_storage.CloudStorageError as e: 233 except cloud_storage.CloudStorageError as e:
233 logging.error('Cannot upload browser log: %s' % str(e)) 234 logging.error('Cannot upload browser log: %s' % str(e))
234 self._browser_backend.Close() 235 finally:
235 self.credentials = None 236 self._browser_backend.Close()
237 self.credentials = None
236 238
237 239
238 def GetStandardOutput(self): 240 def GetStandardOutput(self):
239 return self._browser_backend.GetStandardOutput() 241 return self._browser_backend.GetStandardOutput()
240 242
241 def GetStackTrace(self): 243 def GetStackTrace(self):
242 return self._browser_backend.GetStackTrace() 244 return self._browser_backend.GetStackTrace()
243 245
244 @property 246 @property
245 def supports_system_info(self): 247 def supports_system_info(self):
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 def supports_cpu_metrics(self): 279 def supports_cpu_metrics(self):
278 return self._browser_backend.supports_cpu_metrics 280 return self._browser_backend.supports_cpu_metrics
279 281
280 @property 282 @property
281 def supports_memory_metrics(self): 283 def supports_memory_metrics(self):
282 return self._browser_backend.supports_memory_metrics 284 return self._browser_backend.supports_memory_metrics
283 285
284 @property 286 @property
285 def supports_power_metrics(self): 287 def supports_power_metrics(self):
286 return self._browser_backend.supports_power_metrics 288 return self._browser_backend.supports_power_metrics
OLDNEW
« 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