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

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 19462008: Interpose an Expando cache on reflectClass(). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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: runtime/lib/mirrors_impl.dart
===================================================================
--- runtime/lib/mirrors_impl.dart (revision 25169)
+++ runtime/lib/mirrors_impl.dart (working copy)
@@ -1120,7 +1120,14 @@
static ClassMirror makeLocalClassMirror(Type key)
native "Mirrors_makeLocalClassMirror";
+ static Expando<ClassMirror> classMirrorCache = new Expando();
Ivan Posva 2013/07/18 20:41:46 If you don't mind, can you please give this Expand
rmacnak 2013/07/18 20:49:29 Done.
static ClassMirror reflectClass(Type key) {
- return makeLocalClassMirror(key);
+ var classMirror = classMirrorCache[key];
+ if (classMirror != null) {
Ivan Posva 2013/07/18 20:41:46 How about avoiding duplicate returns: if (classMi
rmacnak 2013/07/18 20:49:29 Done.
+ return classMirror;
+ }
+ classMirror = makeLocalClassMirror(key);
+ classMirrorCache[key] = classMirror;
+ return classMirror;
}
}
« 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