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

Unified Diff: third_party/WebKit/Source/bindings/scripts/v8_utilities.py

Issue 2029423002: Clean up V8 bindings template code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 7 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: third_party/WebKit/Source/bindings/scripts/v8_utilities.py
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
index 98e1e74a31d245341d9ff5ff32fabfc33f306fcf..8c2932615ada7bf97e89194d4001991041f5342a 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_utilities.py
@@ -112,6 +112,17 @@ def uncapitalize(name):
return name[0].lower() + name[1:]
+def unique_by(dict_list, key):
+ """Returns elements from a list of dictionaries with unique values for the named key."""
+ keys_seen = set()
+ filtered_list = []
+ for item in dict_list:
+ if item.get(key) not in keys_seen:
+ filtered_list.append(item)
+ keys_seen.add(item.get(key))
+ return filtered_list
+
+
################################################################################
# C++
################################################################################

Powered by Google App Engine
This is Rietveld 408576698