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

Unified Diff: pkg/pool/lib/pool.dart

Issue 399963004: Move pub/barback's Pool class into its own package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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: pkg/pool/lib/pool.dart
diff --git a/sdk/lib/_internal/pub/lib/src/pool.dart b/pkg/pool/lib/pool.dart
similarity index 94%
rename from sdk/lib/_internal/pub/lib/src/pool.dart
rename to pkg/pool/lib/pool.dart
index 24100ca6c604e6b57973e3d35b21fcaa788b1880..36a29c86dca0951753d3bd7159a6f66f1f3dff4d 100644
--- a/sdk/lib/_internal/pub/lib/src/pool.dart
+++ b/pkg/pool/lib/pool.dart
@@ -1,17 +1,14 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library barback.pool;
+library pool;
import 'dart:async';
import 'dart:collection';
import 'package:stack_trace/stack_trace.dart';
-import 'utils.dart';
-
-// TODO(nweiz): put this somewhere that it can be shared between packages.
/// Manages an abstract pool of resources with a limit on how many may be in use
/// at once.
///
@@ -76,7 +73,7 @@ class Pool {
/// The return value of [callback] is piped to the returned Future.
Future withResource(callback()) {
return request().then((resource) =>
- syncFuture(callback).whenComplete(resource.release));
+ Chain.track(new Future.sync(callback)).whenComplete(resource.release));
}
/// If there are any pending requests, this will fire the oldest one.
@@ -138,4 +135,5 @@ class PoolResource {
_released = true;
_pool._onResourceReleased();
}
-}
+}
+
« pkg/pool/README.md ('K') | « pkg/pool/README.md ('k') | pkg/pool/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698