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

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

Issue 812253002: Delete a bunch of packages that are now on GitHub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Un-delete http Created 6 years 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 | « pkg/http_throttle/README.md ('k') | pkg/http_throttle/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http_throttle/lib/http_throttle.dart
diff --git a/pkg/http_throttle/lib/http_throttle.dart b/pkg/http_throttle/lib/http_throttle.dart
deleted file mode 100644
index 7cd95a6b40696a46bd4c03d1ff7d78e59598a28c..0000000000000000000000000000000000000000
--- a/pkg/http_throttle/lib/http_throttle.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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 http_throttle;
-
-import 'dart:async';
-
-import 'package:http/http.dart';
-import 'package:pool/pool.dart';
-
-/// A middleware client that throttles the number of concurrent requests.
-///
-/// As long as the number of requests is within the limit, this works just like
-/// a normal client. If a request is made beyond the limit, the underlying HTTP
-/// request won't be sent until other requests have completed.
-class ThrottleClient extends BaseClient {
- final Pool _pool;
- final Client _inner;
-
- /// Creates a new client that allows no more than [maxActiveRequests]
- /// concurrent requests.
- ///
- /// If [inner] is passed, it's used as the inner client for sending HTTP
- /// requests. It defaults to `new http.Client()`.
- ThrottleClient(int maxActiveRequests, [Client inner])
- : _pool = new Pool(maxActiveRequests),
- _inner = inner == null ? new Client() : inner;
-
- Future<StreamedResponse> send(BaseRequest request) {
- return _pool.request().then((resource) {
- return _inner.send(request).then((response) {
- var stream = response.stream.transform(
- new StreamTransformer.fromHandlers(handleDone: (sink) {
- resource.release();
- sink.close();
- }));
- return new StreamedResponse(stream, response.statusCode,
- contentLength: response.contentLength,
- request: response.request,
- headers: response.headers,
- isRedirect: response.isRedirect,
- persistentConnection: response.persistentConnection,
- reasonPhrase: response.reasonPhrase);
- });
- });
- }
-
- void close() => _inner.close();
-}
« no previous file with comments | « pkg/http_throttle/README.md ('k') | pkg/http_throttle/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698