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

Unified Diff: tools/telemetry/telemetry/core/backends/chrome/tab_list_backend.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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/backends/chrome/tab_list_backend.py
diff --git a/tools/telemetry/telemetry/core/backends/chrome/tab_list_backend.py b/tools/telemetry/telemetry/core/backends/chrome/tab_list_backend.py
index 45fc3edd9bf9809c2ce31a4db3a331df1e5101e3..cdc5cb3a69a53dd8d642c53a5fc82608cbfc1559 100644
--- a/tools/telemetry/telemetry/core/backends/chrome/tab_list_backend.py
+++ b/tools/telemetry/telemetry/core/backends/chrome/tab_list_backend.py
@@ -1,14 +1,15 @@
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
import json
import urllib2
-import weakref
-from telemetry.core import util
from telemetry.core import tab
+from telemetry.core import util
from telemetry.core.backends.chrome import inspector_backend
+
class TabListBackend(object):
def __init__(self, browser_backend):
self._browser_backend = browser_backend
@@ -16,7 +17,7 @@ class TabListBackend(object):
# Stores web socket debugger URLs in iteration order.
self._tab_list = []
# Maps debugger URLs to Tab objects.
- self._tab_dict = weakref.WeakValueDictionary()
+ self._tab_dict = {}
dtu 2014/02/19 23:39:27 Yay! Hey, we didn't know about it at the time, bu
def Init(self):
self._UpdateTabList()
@@ -68,10 +69,8 @@ class TabListBackend(object):
def GetTabUrl(self, debugger_url):
tab_info = self._FindTabInfo(debugger_url)
- # TODO(hartmanng): crbug.com/166886 (uncomment the following assert and
- # remove the extra None check when _ListTabs is fixed):
- # assert tab_info is not None
- return tab_info['url'] if tab_info else None
+ assert tab_info is not None
+ return tab_info['url']
def __iter__(self):
self._UpdateTabList()

Powered by Google App Engine
This is Rietveld 408576698