| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 functools | 5 import functools |
| 6 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 import socket | 8 import socket |
| 9 import sys | 9 import sys |
| 10 | 10 |
| 11 from py_trace_event import trace_event |
| 12 |
| 11 from telemetry.core import exceptions | 13 from telemetry.core import exceptions |
| 12 from telemetry import decorators | 14 from telemetry import decorators |
| 13 from telemetry.internal.backends.chrome_inspector import devtools_http | 15 from telemetry.internal.backends.chrome_inspector import devtools_http |
| 14 from telemetry.internal.backends.chrome_inspector import inspector_console | 16 from telemetry.internal.backends.chrome_inspector import inspector_console |
| 15 from telemetry.internal.backends.chrome_inspector import inspector_memory | 17 from telemetry.internal.backends.chrome_inspector import inspector_memory |
| 16 from telemetry.internal.backends.chrome_inspector import inspector_page | 18 from telemetry.internal.backends.chrome_inspector import inspector_page |
| 17 from telemetry.internal.backends.chrome_inspector import inspector_runtime | 19 from telemetry.internal.backends.chrome_inspector import inspector_runtime |
| 18 from telemetry.internal.backends.chrome_inspector import inspector_websocket | 20 from telemetry.internal.backends.chrome_inspector import inspector_websocket |
| 19 from telemetry.internal.backends.chrome_inspector import websocket | 21 from telemetry.internal.backends.chrome_inspector import websocket |
| 20 | 22 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 | 38 |
| 37 return inner | 39 return inner |
| 38 | 40 |
| 39 | 41 |
| 40 class InspectorBackend(object): | 42 class InspectorBackend(object): |
| 41 """Class for communicating with a devtools client. | 43 """Class for communicating with a devtools client. |
| 42 | 44 |
| 43 The owner of an instance of this class is responsible for calling | 45 The owner of an instance of this class is responsible for calling |
| 44 Disconnect() before disposing of the instance. | 46 Disconnect() before disposing of the instance. |
| 45 """ | 47 """ |
| 48 |
| 49 __metaclass__ = trace_event.TracedMetaClass |
| 50 |
| 46 def __init__(self, app, devtools_client, context, timeout=120): | 51 def __init__(self, app, devtools_client, context, timeout=120): |
| 47 self._websocket = inspector_websocket.InspectorWebsocket() | 52 self._websocket = inspector_websocket.InspectorWebsocket() |
| 48 self._websocket.RegisterDomain( | 53 self._websocket.RegisterDomain( |
| 49 'Inspector', self._HandleInspectorDomainNotification) | 54 'Inspector', self._HandleInspectorDomainNotification) |
| 50 | 55 |
| 51 self._app = app | 56 self._app = app |
| 52 self._devtools_client = devtools_client | 57 self._devtools_client = devtools_client |
| 53 # Be careful when using the context object, since the data may be | 58 # Be careful when using the context object, since the data may be |
| 54 # outdated since this is never updated once InspectorBackend is | 59 # outdated since this is never updated once InspectorBackend is |
| 55 # created. Consider an updating strategy for this. (For an example | 60 # created. Consider an updating strategy for this. (For an example |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 msg = ( | 411 msg = ( |
| 407 'Received a socket error in the browser connection and the tab no ' | 412 'Received a socket error in the browser connection and the tab no ' |
| 408 'longer exists. The tab probably crashed.' | 413 'longer exists. The tab probably crashed.' |
| 409 ) | 414 ) |
| 410 error.AddDebuggingMessage(msg) | 415 error.AddDebuggingMessage(msg) |
| 411 error.AddDebuggingMessage('Debugger url: %s' % self.debugger_url) | 416 error.AddDebuggingMessage('Debugger url: %s' % self.debugger_url) |
| 412 | 417 |
| 413 @_HandleInspectorWebSocketExceptions | 418 @_HandleInspectorWebSocketExceptions |
| 414 def CollectGarbage(self): | 419 def CollectGarbage(self): |
| 415 self._page.CollectGarbage() | 420 self._page.CollectGarbage() |
| OLD | NEW |