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

Unified Diff: tools/telemetry/telemetry/core/backends/chrome/extension_backend.py

Issue 555823002: Add __contains__ implementation to avoid a race in __get_item__. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/backends/chrome/extension_backend.py
diff --git a/tools/telemetry/telemetry/core/backends/chrome/extension_backend.py b/tools/telemetry/telemetry/core/backends/chrome/extension_backend.py
index a48088738cf02cf1f5a44c2629440c26a95ba58b..68a00a692206fe52a1bc31230adc36af61a8e743 100644
--- a/tools/telemetry/telemetry/core/backends/chrome/extension_backend.py
+++ b/tools/telemetry/telemetry/core/backends/chrome/extension_backend.py
@@ -25,6 +25,11 @@ class ExtensionBackendDict(collections.Mapping):
def __init__(self, browser_backend):
self._extension_backend_list = ExtensionBackendList(browser_backend)
+ def __contains__(self, extension_id):
+ return (extension_id in
+ (self.ContextIdToExtensionId(context_id)
+ for context_id in self._extension_backend_list))
+
def __getitem__(self, extension_id):
extensions = []
for i, context_id in enumerate(self._extension_backend_list):
« 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