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

Side by Side Diff: tools/telemetry/telemetry/core/web_contents.py

Issue 170283006: [Telemetry] Don't create a new Tab object at each navigation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused method Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 from telemetry.core import util 5 from telemetry.core import util
6 6
7 DEFAULT_WEB_CONTENTS_TIMEOUT = 90 7 DEFAULT_WEB_CONTENTS_TIMEOUT = 90
8 8
9 # TODO(achuith, dtu, nduca): Add unit tests specifically for WebContents, 9 # TODO(achuith, dtu, nduca): Add unit tests specifically for WebContents,
10 # independent of Tab. 10 # independent of Tab.
11 class WebContents(object): 11 class WebContents(object):
12 """Represents web contents in the browser""" 12 """Represents web contents in the browser"""
13 def __init__(self, inspector_backend): 13 def __init__(self, inspector_backend):
14 self._inspector_backend = inspector_backend 14 self._inspector_backend = inspector_backend
15 15
16 def __del__(self):
17 self.Disconnect()
18
19 def Disconnect(self):
20 self._inspector_backend.Disconnect()
21
22 def Close(self): 16 def Close(self):
23 """Closes this page. 17 """Closes this page.
24 18
25 Not all browsers or browser versions support this method. 19 Not all browsers or browser versions support this method.
26 Be sure to check browser.supports_tab_control.""" 20 Be sure to check browser.supports_tab_control."""
27 self._inspector_backend.Close() 21 self._inspector_backend.Close()
28 22
29 def WaitForDocumentReadyStateToBeComplete(self, 23 def WaitForDocumentReadyStateToBeComplete(self,
30 timeout=DEFAULT_WEB_CONTENTS_TIMEOUT): 24 timeout=DEFAULT_WEB_CONTENTS_TIMEOUT):
31 self.WaitForJavaScriptExpression( 25 self.WaitForJavaScriptExpression(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 return self._inspector_backend.timeline_model 80 return self._inspector_backend.timeline_model
87 81
88 def StartTimelineRecording(self): 82 def StartTimelineRecording(self):
89 self._inspector_backend.StartTimelineRecording() 83 self._inspector_backend.StartTimelineRecording()
90 84
91 def StopTimelineRecording(self): 85 def StopTimelineRecording(self):
92 self._inspector_backend.StopTimelineRecording() 86 self._inspector_backend.StopTimelineRecording()
93 87
94 def TakeJSHeapSnapshot(self, timeout=120): 88 def TakeJSHeapSnapshot(self, timeout=120):
95 return self._inspector_backend.TakeJSHeapSnapshot(timeout) 89 return self._inspector_backend.TakeJSHeapSnapshot(timeout)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698