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

Unified Diff: sky/specs/style2.md

Issue 957563002: Specs: turns out my Expando-based WeakMap thing won't work :-( (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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
« 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: sky/specs/style2.md
diff --git a/sky/specs/style2.md b/sky/specs/style2.md
index f53498a25b0046ff35501a5bc13b869ae6f00e7c..7cf8ba22a1bc9f02dd6ff24f6eaf39351601a740 100644
--- a/sky/specs/style2.md
+++ b/sky/specs/style2.md
@@ -58,10 +58,14 @@ import 'dart:mirrors';
import 'dart:math';
class WeakMap<Key, Value> {
- Expando<Value> _map = new Expando<Value>();
+ // This is not actually a weak map right now, because Dart doesn't let us have weak references.
+ // We should fix that, or else we're going to keep alive every object you ever tear off through
+ // the StyleDeclaration API, even if you never use it again, until the StyleDeclaration object
+ // itself is GC'ed, which is likely when the element is GC'ed, which is likely never.
+ Map<Key, Value> _map = new Map<Key, Value>();
operator[](Key key) => _map[key];
operator[]=(Key key, Value value) => _map[key] = value;
- bool containsKey(Key key) => _map[key] != null;
+ bool containsKey(Key key) => _map.containsKey(key);
}
typedef void StringSetter(Symbol propertySymbol, StyleDeclaration declaration, String value);
« 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