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

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart

Issue 221333004: Fix a few remaining synchronous uses of BuildDirectory.server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/barback/old_web_socket_api.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart b/sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart
index b0eaf12ad141aff4ae57fb55b7988e500319688a..46f28bb5ccec964718519b38964bf16ee7176fd5 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart
@@ -181,7 +181,7 @@ class OldWebSocketApi {
///
/// This does *not* currently check to ensure the asset actually exists. It
/// only maps what the corresponding asset *should* be for that URL.
- Map _urlToAssetId(Map command) {
+ Future<Map> _urlToAssetId(Map command) {
var urlString = _validateString(command, "url");
var url;
try {
@@ -195,25 +195,26 @@ class OldWebSocketApi {
// If a line number was given, map it to the output line.
var line = _validateOptionalInt(command, "line");
- var id = _environment.getAssetIdForUrl(url);
- if (id == null) {
- throw new _WebSocketException(_ErrorCode.NOT_SERVED,
- '"${url.host}:${url.port}" is not being served by pub.');
- }
+ return _environment.getAssetIdForUrl(url).then((id) {
+ if (id == null) {
+ throw new _WebSocketException(_ErrorCode.NOT_SERVED,
+ '"${url.host}:${url.port}" is not being served by pub.');
+ }
- // TODO(rnystrom): When this is hooked up to actually talk to barback to
- // see if assets exist, consider supporting implicit index.html at that
- // point.
+ // TODO(rnystrom): When this is hooked up to actually talk to barback to
+ // see if assets exist, consider supporting implicit index.html at that
+ // point.
- var result = {"package": id.package, "path": id.path};
+ var result = {"package": id.package, "path": id.path};
- // Map the line.
- // TODO(rnystrom): Right now, source maps are not supported and it just
- // passes through the original line. This lets the editor start using
- // this API before we've fully implemented it. See #12339 and #16061.
- if (line != null) result["line"] = line;
+ // Map the line.
+ // TODO(rnystrom): Right now, source maps are not supported and it just
+ // passes through the original line. This lets the editor start using
+ // this API before we've fully implemented it. See #12339 and #16061.
+ if (line != null) result["line"] = line;
- return result;
+ return result;
+ });
}
/// Given a path on the filesystem, returns the URLs served by pub that can be

Powered by Google App Engine
This is Rietveld 408576698