1 2<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 3<html><head><title>Python: module telemetry.internal.backends.chrome_inspector.devtools_client_backend</title> 4<meta charset="utf-8"> 5</head><body bgcolor="#f0f0f8"> 6 7<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> 8<tr bgcolor="#7799ee"> 9<td valign=bottom> <br> 10<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="telemetry.html"><font color="#ffffff">telemetry</font></a>.<a href="telemetry.internal.html"><font color="#ffffff">internal</font></a>.<a href="telemetry.internal.backends.html"><font color="#ffffff">backends</font></a>.<a href="telemetry.internal.backends.chrome_inspector.html"><font color="#ffffff">chrome_inspector</font></a>.devtools_client_backend</strong></big></big></font></td 11><td align=right valign=bottom 12><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="../telemetry/internal/backends/chrome_inspector/devtools_client_backend.py">telemetry/internal/backends/chrome_inspector/devtools_client_backend.py</a></font></td></tr></table> 13 <p><tt># Copyright 2014 The Chromium Authors. All rights reserved.<br> 14# Use of this source code is governed by a BSD-style license that can be<br> 15# found in the LICENSE file.</tt></p> 16<p> 17<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 18<tr bgcolor="#aa55cc"> 19<td colspan=3 valign=bottom> <br> 20<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> 21 22<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> 23<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="telemetry.internal.backends.browser_backend.html">telemetry.internal.backends.browser_backend</a><br> 24<a href="telemetry.internal.platform.tracing_agent.chrome_tracing_agent.html">telemetry.internal.platform.tracing_agent.chrome_tracing_agent</a><br> 25<a href="telemetry.internal.platform.tracing_agent.chrome_tracing_devtools_manager.html">telemetry.internal.platform.tracing_agent.chrome_tracing_devtools_manager</a><br> 26<a href="telemetry.decorators.html">telemetry.decorators</a><br> 27</td><td width="25%" valign=top><a href="telemetry.internal.backends.chrome_inspector.devtools_http.html">telemetry.internal.backends.chrome_inspector.devtools_http</a><br> 28<a href="telemetry.core.exceptions.html">telemetry.core.exceptions</a><br> 29<a href="telemetry.internal.backends.chrome_inspector.inspector_backend.html">telemetry.internal.backends.chrome_inspector.inspector_backend</a><br> 30<a href="telemetry.internal.backends.chrome_inspector.inspector_websocket.html">telemetry.internal.backends.chrome_inspector.inspector_websocket</a><br> 31</td><td width="25%" valign=top><a href="logging.html">logging</a><br> 32<a href="telemetry.internal.backends.chrome_inspector.memory_backend.html">telemetry.internal.backends.chrome_inspector.memory_backend</a><br> 33<a href="re.html">re</a><br> 34<a href="socket.html">socket</a><br> 35</td><td width="25%" valign=top><a href="sys.html">sys</a><br> 36<a href="telemetry.timeline.trace_data.html">telemetry.timeline.trace_data</a><br> 37<a href="telemetry.internal.backends.chrome_inspector.tracing_backend.html">telemetry.internal.backends.chrome_inspector.tracing_backend</a><br> 38<a href="telemetry.internal.backends.chrome_inspector.websocket.html">telemetry.internal.backends.chrome_inspector.websocket</a><br> 39</td></tr></table></td></tr></table><p> 40<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 41<tr bgcolor="#ee77aa"> 42<td colspan=3 valign=bottom> <br> 43<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> 44 45<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> 46<td width="100%"><dl> 47<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> 48</font></dt><dd> 49<dl> 50<dt><font face="helvetica, arial"><a href="telemetry.internal.backends.chrome_inspector.devtools_client_backend.html#DevToolsClientBackend">DevToolsClientBackend</a> 51</font></dt></dl> 52</dd> 53<dt><font face="helvetica, arial"><a href="telemetry.core.exceptions.html#Error">telemetry.core.exceptions.Error</a>(<a href="exceptions.html#Exception">exceptions.Exception</a>) 54</font></dt><dd> 55<dl> 56<dt><font face="helvetica, arial"><a href="telemetry.internal.backends.chrome_inspector.devtools_client_backend.html#TabNotFoundError">TabNotFoundError</a> 57</font></dt></dl> 58</dd> 59</dl> 60 <p> 61<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 62<tr bgcolor="#ffc8d8"> 63<td colspan=3 valign=bottom> <br> 64<font color="#000000" face="helvetica, arial"><a name="DevToolsClientBackend">class <strong>DevToolsClientBackend</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> 65 66<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> 67<td colspan=2><tt>An <a href="__builtin__.html#object">object</a> that communicates with Chrome's devtools.<br> 68 <br> 69This class owns a map of InspectorBackends. It is responsible for creating<br> 70them and destroying them.<br> </tt></td></tr> 71<tr><td> </td> 72<td width="100%">Methods defined here:<br> 73<dl><dt><a name="DevToolsClientBackend-ActivateTab"><strong>ActivateTab</strong></a>(self, tab_id, timeout)</dt><dd><tt>Activates the tab with the given id.<br> 74 <br> 75Raises:<br> 76 devtools_http.DevToolsClientConnectionError<br> 77 <a href="#TabNotFoundError">TabNotFoundError</a></tt></dd></dl> 78 79<dl><dt><a name="DevToolsClientBackend-Close"><strong>Close</strong></a>(self)</dt></dl> 80 81<dl><dt><a name="DevToolsClientBackend-CloseTab"><strong>CloseTab</strong></a>(self, tab_id, timeout)</dt><dd><tt>Closes the tab with the given id.<br> 82 <br> 83Raises:<br> 84 devtools_http.DevToolsClientConnectionError<br> 85 <a href="#TabNotFoundError">TabNotFoundError</a></tt></dd></dl> 86 87<dl><dt><a name="DevToolsClientBackend-DumpMemory"><strong>DumpMemory</strong></a>(self, timeout<font color="#909090">=30</font>)</dt><dd><tt>Dumps memory.<br> 88 <br> 89Returns:<br> 90 GUID of the generated dump if successful, None otherwise.<br> 91 <br> 92Raises:<br> 93 TracingTimeoutException: If more than |timeout| seconds has passed<br> 94 since the last time any data is received.<br> 95 TracingUnrecoverableException: If there is a websocket error.<br> 96 TracingUnexpectedResponseException: If the response contains an error<br> 97 or does not contain the expected result.</tt></dd></dl> 98 99<dl><dt><a name="DevToolsClientBackend-GetChromeBranchNumber"><strong>GetChromeBranchNumber</strong></a>(*args, **kwargs)</dt></dl> 100 101<dl><dt><a name="DevToolsClientBackend-GetUpdatedInspectableContexts"><strong>GetUpdatedInspectableContexts</strong></a>(self)</dt><dd><tt>Returns an updated instance of _DevToolsContextMapBackend.</tt></dd></dl> 102 103<dl><dt><a name="DevToolsClientBackend-GetUrl"><strong>GetUrl</strong></a>(self, tab_id)</dt><dd><tt>Returns the URL of the tab with |tab_id|, as reported by devtools.<br> 104 <br> 105Raises:<br> 106 devtools_http.DevToolsClientConnectionError</tt></dd></dl> 107 108<dl><dt><a name="DevToolsClientBackend-IsAlive"><strong>IsAlive</strong></a>(self)</dt><dd><tt>Whether the DevTools server is available and connectable.</tt></dd></dl> 109 110<dl><dt><a name="DevToolsClientBackend-IsChromeTracingSupported"><strong>IsChromeTracingSupported</strong></a>(self)</dt></dl> 111 112<dl><dt><a name="DevToolsClientBackend-IsInspectable"><strong>IsInspectable</strong></a>(self, tab_id)</dt><dd><tt>Whether the tab with |tab_id| is inspectable, as reported by devtools.<br> 113 <br> 114Raises:<br> 115 devtools_http.DevToolsClientConnectionError</tt></dd></dl> 116 117<dl><dt><a name="DevToolsClientBackend-RequestNewTab"><strong>RequestNewTab</strong></a>(self, timeout)</dt><dd><tt>Creates a new tab.<br> 118 <br> 119Returns:<br> 120 A JSON string as returned by DevTools. Example:<br> 121 {<br> 122 "description": "",<br> 123 "devtoolsFrontendUrl":<br> 124 "/devtools/inspector.html?ws=host:port/devtools/page/id-string",<br> 125 "id": "id-string",<br> 126 "title": "Page Title",<br> 127 "type": "page",<br> 128 "url": "url",<br> 129 "webSocketDebuggerUrl": "ws://host:port/devtools/page/id-string"<br> 130 }<br> 131 <br> 132Raises:<br> 133 devtools_http.DevToolsClientConnectionError</tt></dd></dl> 134 135<dl><dt><a name="DevToolsClientBackend-SetMemoryPressureNotificationsSuppressed"><strong>SetMemoryPressureNotificationsSuppressed</strong></a>(self, suppressed, timeout<font color="#909090">=30</font>)</dt><dd><tt>Enable/disable suppressing memory pressure notifications.<br> 136 <br> 137Args:<br> 138 suppressed: If true, memory pressure notifications will be suppressed.<br> 139 timeout: The timeout in seconds.<br> 140 <br> 141Raises:<br> 142 MemoryTimeoutException: If more than |timeout| seconds has passed<br> 143 since the last time any data is received.<br> 144 MemoryUnrecoverableException: If there is a websocket error.<br> 145 MemoryUnexpectedResponseException: If the response contains an error<br> 146 or does not contain the expected result.</tt></dd></dl> 147 148<dl><dt><a name="DevToolsClientBackend-SimulateMemoryPressureNotification"><strong>SimulateMemoryPressureNotification</strong></a>(self, pressure_level, timeout<font color="#909090">=30</font>)</dt><dd><tt>Simulate a memory pressure notification.<br> 149 <br> 150Args:<br> 151 pressure level: The memory pressure level of the notification ('moderate'<br> 152 or 'critical').<br> 153 timeout: The timeout in seconds.<br> 154 <br> 155Raises:<br> 156 MemoryTimeoutException: If more than |timeout| seconds has passed<br> 157 since the last time any data is received.<br> 158 MemoryUnrecoverableException: If there is a websocket error.<br> 159 MemoryUnexpectedResponseException: If the response contains an error<br> 160 or does not contain the expected result.</tt></dd></dl> 161 162<dl><dt><a name="DevToolsClientBackend-StartChromeTracing"><strong>StartChromeTracing</strong></a>(self, trace_options, custom_categories<font color="#909090">=None</font>, timeout<font color="#909090">=10</font>)</dt><dd><tt>Args:<br> 163 trace_options: An tracing_options.TracingOptions instance.<br> 164 custom_categories: An optional string containing a list of<br> 165 comma separated categories that will be traced<br> 166 instead of the default category set. Example: use<br> 167 "webkit,cc,disabled-by-default-cc.debug" to trace only<br> 168 those three event categories.</tt></dd></dl> 169 170<dl><dt><a name="DevToolsClientBackend-StopChromeTracing"><strong>StopChromeTracing</strong></a>(self, trace_data_builder, timeout<font color="#909090">=30</font>)</dt></dl> 171 172<dl><dt><a name="DevToolsClientBackend-__init__"><strong>__init__</strong></a>(self, devtools_port, remote_devtools_port, app_backend)</dt><dd><tt>Creates a new <a href="#DevToolsClientBackend">DevToolsClientBackend</a>.<br> 173 <br> 174A DevTools agent must exist on the given devtools_port.<br> 175 <br> 176Args:<br> 177 devtools_port: The port to use to connect to DevTools agent.<br> 178 remote_devtools_port: In some cases (e.g., app running on<br> 179 Android device, devtools_port is the forwarded port on the<br> 180 host platform. We also need to know the remote_devtools_port<br> 181 so that we can uniquely identify the DevTools agent.<br> 182 app_backend: For the app that contains the DevTools agent.</tt></dd></dl> 183 184<hr> 185Data descriptors defined here:<br> 186<dl><dt><strong>__dict__</strong></dt> 187<dd><tt>dictionary for instance variables (if defined)</tt></dd> 188</dl> 189<dl><dt><strong>__weakref__</strong></dt> 190<dd><tt>list of weak references to the object (if defined)</tt></dd> 191</dl> 192<dl><dt><strong>is_tracing_running</strong></dt> 193</dl> 194<dl><dt><strong>remote_port</strong></dt> 195</dl> 196<dl><dt><strong>support_startup_tracing</strong></dt> 197</dl> 198<dl><dt><strong>supports_overriding_memory_pressure_notifications</strong></dt> 199</dl> 200<dl><dt><strong>supports_tracing</strong></dt> 201</dl> 202</td></tr></table> <p> 203<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 204<tr bgcolor="#ffc8d8"> 205<td colspan=3 valign=bottom> <br> 206<font color="#000000" face="helvetica, arial"><a name="TabNotFoundError">class <strong>TabNotFoundError</strong></a>(<a href="telemetry.core.exceptions.html#Error">telemetry.core.exceptions.Error</a>)</font></td></tr> 207 208<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> 209<td width="100%"><dl><dt>Method resolution order:</dt> 210<dd><a href="telemetry.internal.backends.chrome_inspector.devtools_client_backend.html#TabNotFoundError">TabNotFoundError</a></dd> 211<dd><a href="telemetry.core.exceptions.html#Error">telemetry.core.exceptions.Error</a></dd> 212<dd><a href="exceptions.html#Exception">exceptions.Exception</a></dd> 213<dd><a href="exceptions.html#BaseException">exceptions.BaseException</a></dd> 214<dd><a href="__builtin__.html#object">__builtin__.object</a></dd> 215</dl> 216<hr> 217Methods inherited from <a href="telemetry.core.exceptions.html#Error">telemetry.core.exceptions.Error</a>:<br> 218<dl><dt><a name="TabNotFoundError-AddDebuggingMessage"><strong>AddDebuggingMessage</strong></a>(self, msg)</dt><dd><tt>Adds a message to the description of the exception.<br> 219 <br> 220Many Telemetry exceptions arise from failures in another application. These<br> 221failures are difficult to pinpoint. This method allows Telemetry classes to<br> 222append useful debugging information to the exception. This method also logs<br> 223information about the location from where it was called.</tt></dd></dl> 224 225<dl><dt><a name="TabNotFoundError-__init__"><strong>__init__</strong></a>(self, msg<font color="#909090">=''</font>)</dt></dl> 226 227<dl><dt><a name="TabNotFoundError-__str__"><strong>__str__</strong></a>(self)</dt></dl> 228 229<hr> 230Data descriptors inherited from <a href="telemetry.core.exceptions.html#Error">telemetry.core.exceptions.Error</a>:<br> 231<dl><dt><strong>__weakref__</strong></dt> 232<dd><tt>list of weak references to the object (if defined)</tt></dd> 233</dl> 234<hr> 235Data and other attributes inherited from <a href="exceptions.html#Exception">exceptions.Exception</a>:<br> 236<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#TabNotFoundError-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl> 237 238<hr> 239Methods inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 240<dl><dt><a name="TabNotFoundError-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#TabNotFoundError-__delattr__">__delattr__</a>('name') <==> del x.name</tt></dd></dl> 241 242<dl><dt><a name="TabNotFoundError-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#TabNotFoundError-__getattribute__">__getattribute__</a>('name') <==> x.name</tt></dd></dl> 243 244<dl><dt><a name="TabNotFoundError-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#TabNotFoundError-__getitem__">__getitem__</a>(y) <==> x[y]</tt></dd></dl> 245 246<dl><dt><a name="TabNotFoundError-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#TabNotFoundError-__getslice__">__getslice__</a>(i, j) <==> x[i:j]<br> 247 <br> 248Use of negative indices is not supported.</tt></dd></dl> 249 250<dl><dt><a name="TabNotFoundError-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> 251 252<dl><dt><a name="TabNotFoundError-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#TabNotFoundError-__repr__">__repr__</a>() <==> repr(x)</tt></dd></dl> 253 254<dl><dt><a name="TabNotFoundError-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#TabNotFoundError-__setattr__">__setattr__</a>('name', value) <==> x.name = value</tt></dd></dl> 255 256<dl><dt><a name="TabNotFoundError-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> 257 258<dl><dt><a name="TabNotFoundError-__unicode__"><strong>__unicode__</strong></a>(...)</dt></dl> 259 260<hr> 261Data descriptors inherited from <a href="exceptions.html#BaseException">exceptions.BaseException</a>:<br> 262<dl><dt><strong>__dict__</strong></dt> 263</dl> 264<dl><dt><strong>args</strong></dt> 265</dl> 266<dl><dt><strong>message</strong></dt> 267</dl> 268</td></tr></table></td></tr></table><p> 269<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 270<tr bgcolor="#eeaa77"> 271<td colspan=3 valign=bottom> <br> 272<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> 273 274<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> 275<td width="100%"><dl><dt><a name="-IsDevToolsAgentAvailable"><strong>IsDevToolsAgentAvailable</strong></a>(port, app_backend)</dt><dd><tt>Returns True if a DevTools agent is available on the given port.</tt></dd></dl> 276</td></tr></table><p> 277<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> 278<tr bgcolor="#55aa55"> 279<td colspan=3 valign=bottom> <br> 280<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> 281 282<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> 283<td width="100%"><strong>BROWSER_INSPECTOR_WEBSOCKET_URL</strong> = 'ws://127.0.0.1:%i/devtools/browser'</td></tr></table> 284</body></html>