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

Unified Diff: packages/package_config/lib/src/packages_io_impl.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 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 | « packages/package_config/lib/src/packages_impl.dart ('k') | packages/package_config/lib/src/util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/package_config/lib/src/packages_io_impl.dart
diff --git a/packages/package_config/lib/src/packages_io_impl.dart b/packages/package_config/lib/src/packages_io_impl.dart
index 21b61fdab0591cc483d1af2d53cee5515f659d90..0e9474639420d7552a6f0d524cfd05f71b161121 100644
--- a/packages/package_config/lib/src/packages_io_impl.dart
+++ b/packages/package_config/lib/src/packages_io_impl.dart
@@ -14,15 +14,21 @@ import "packages_impl.dart";
/// A [Packages] implementation based on a local directory.
class FilePackagesDirectoryPackages extends PackagesBase {
final Directory _packageDir;
+ final Map<String, Uri> _packageToBaseUriMap = <String, Uri>{};
+
FilePackagesDirectoryPackages(this._packageDir);
- Uri getBase(String packageName) =>
- new Uri.file(path.join(_packageDir.path, packageName, '.'));
+ Uri getBase(String packageName) {
+ return _packageToBaseUriMap.putIfAbsent(packageName, () {
+ return new Uri.file(path.join(_packageDir.path, packageName, '.'));
+ });
+ }
Iterable<String> _listPackageNames() {
- return _packageDir.listSync()
- .where((e) => e is Directory)
- .map((e) => path.basename(e.path));
+ return _packageDir
+ .listSync()
+ .where((e) => e is Directory)
+ .map((e) => path.basename(e.path));
}
Iterable<String> get packages => _listPackageNames();
« no previous file with comments | « packages/package_config/lib/src/packages_impl.dart ('k') | packages/package_config/lib/src/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698