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

Unified Diff: dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/pubserve/PubServeResourceResolver.java

Issue 371253002: Version 1.5.7 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.5/
Patch Set: Created 6 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
Index: dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/pubserve/PubServeResourceResolver.java
===================================================================
--- dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/pubserve/PubServeResourceResolver.java (revision 38051)
+++ dart/editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/pubserve/PubServeResourceResolver.java (working copy)
@@ -104,23 +104,27 @@
return url;
}
- CountDownLatch latch = new CountDownLatch(1);
final String[] done = new String[1];
- try {
- PubServeManager.getManager().sendGetUrlCommand(resource, new UrlForFileCallback(latch, done));
- } catch (IOException e) {
- DartCore.logError(e);
- return done[0];
+ if (PubServeManager.getManager().isServing()) {
+ CountDownLatch latch = new CountDownLatch(1);
+ try {
+ PubServeManager.getManager().sendGetUrlCommand(
+ resource,
+ new UrlForFileCallback(latch, done));
+ } catch (IOException e) {
+ DartCore.logError(e);
+ return done[0];
+ }
+ try {
+ latch.await(3000, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ // do nothing
+ }
+ if (done[0] != null) {
+ resourceToUrl.put(resource.getFullPath().toString(), done[0]);
+ }
}
- try {
- latch.await(5000, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- // do nothing
- }
- if (done[0] != null) {
- resourceToUrl.put(resource.getFullPath().toString(), done[0]);
- }
return done[0];
}
@@ -158,27 +162,30 @@
return getResourceForPath(assetId);
}
- CountDownLatch latch = new CountDownLatch(1);
- final String[] name = new String[1];
- final String[] path = new String[1];
+ if (PubServeManager.getManager().isServing()) {
- try {
- PubServeManager.getManager().sendGetAssetIdCommand(
- url,
- new FilePathForUrlCallback(latch, name, path));
- } catch (IOException e) {
- DartCore.logError(e);
- return null;
+ CountDownLatch latch = new CountDownLatch(1);
+ final String[] name = new String[1];
+ final String[] path = new String[1];
+
+ try {
+ PubServeManager.getManager().sendGetAssetIdCommand(
+ url,
+ new FilePathForUrlCallback(latch, name, path));
+ } catch (IOException e) {
+ DartCore.logError(e);
+ return null;
+ }
+ try {
+ latch.await(3000, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ // do nothing
+ }
+ if (path[0] != null) {
+ urlToAsset.put(url, path[0]);
+ return getResourceForPath(path[0]);
+ }
}
- try {
- latch.await(5000, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- // do nothing
- }
- if (path[0] != null) {
- urlToAsset.put(url, path[0]);
- return getResourceForPath(path[0]);
- }
return null;
}

Powered by Google App Engine
This is Rietveld 408576698