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

Unified Diff: sdk/lib/_internal/pub/lib/src/entrypoint.dart

Issue 600293002: Add some additional annotations for tracking pub performance. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 2 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: sdk/lib/_internal/pub/lib/src/entrypoint.dart
diff --git a/sdk/lib/_internal/pub/lib/src/entrypoint.dart b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
index f8717470fda2341c1c9246c9a99148151243979c..d900e8b87c1f8f9f27458c6e3b969c6bc6d8fdcf 100644
--- a/sdk/lib/_internal/pub/lib/src/entrypoint.dart
+++ b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
@@ -432,35 +432,34 @@ class Entrypoint {
/// If [result] is passed, this loads the graph from it without re-parsing the
/// lockfile or any pubspecs. Otherwise, before loading, this makes sure the
/// lockfile and dependencies are installed and up to date.
- Future<PackageGraph> loadPackageGraph([SolveResult result]) {
- if (_packageGraph != null) return new Future.value(_packageGraph);
+ Future<PackageGraph> loadPackageGraph([SolveResult result]) async {
+ if (_packageGraph != null) return _packageGraph;
- return new Future.sync(() {
+ var graph = await log.progress("Loading package graph", () async {
if (result != null) {
- return Future.wait(result.packages.map((id) {
- return cache.sources[id.source].getDirectory(id)
- .then((dir) => new Package(result.pubspecs[id.name], dir));
- })).then((packages) {
- return new PackageGraph(this, new LockFile(result.packages),
- new Map.fromIterable(packages, key: (package) => package.name));
- });
- } else {
- return ensureLockFileIsUpToDate().then((_) {
- return Future.wait(lockFile.packages.values.map((id) {
- var source = cache.sources[id.source];
- return source.getDirectory(id)
- .then((dir) => new Package.load(id.name, dir, cache.sources));
- })).then((packages) {
- var packageMap = new Map.fromIterable(packages, key: (p) => p.name);
- packageMap[root.name] = root;
- return new PackageGraph(this, lockFile, packageMap);
- });
- });
+ var packages = await Future.wait(result.packages.map((id) async {
+ var dir = await cache.sources[id.source].getDirectory(id);
+ return new Package(result.pubspecs[id.name], dir);
+ }));
+
+ return new PackageGraph(this, new LockFile(result.packages),
+ new Map.fromIterable(packages, key: (package) => package.name));
}
- }).then((graph) {
- _packageGraph = graph;
- return graph;
- });
+
+ await ensureLockFileIsUpToDate();
+ var packages = await Future.wait(lockFile.packages.values.map((id) async {
+ var source = cache.sources[id.source];
+ var dir = await source.getDirectory(id);
+ return new Package.load(id.name, dir, cache.sources);
+ }));
+
+ var packageMap = new Map.fromIterable(packages, key: (p) => p.name);
+ packageMap[root.name] = root;
+ return new PackageGraph(this, lockFile, packageMap);
+ }, fine: true);
+
+ _packageGraph = graph;
+ return graph;
}
/// Saves a list of concrete package versions to the `pubspec.lock` file.
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/barback/asset_environment.dart ('k') | sdk/lib/_internal/pub/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698