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

Unified Diff: sdk/lib/io/http_session.dart

Issue 124753002: Code cleanup (mostly io lib and some http lib). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 6 years, 11 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/io/http_session.dart
diff --git a/sdk/lib/io/http_session.dart b/sdk/lib/io/http_session.dart
index 1b049e395d8f8eb2e74823a57bbe1a6efa3a89fd..9d87ae9fb86be095abb4caad95c4ccaec83e4be9 100644
--- a/sdk/lib/io/http_session.dart
+++ b/sdk/lib/io/http_session.dart
@@ -18,11 +18,11 @@ class _HttpSession implements HttpSession {
// Pointers in timeout queue.
_HttpSession _prev;
_HttpSession _next;
+ final String id;
final Map _data = new HashMap();
- _HttpSession(_HttpSessionManager this._sessionManager, String this.id)
- : _lastSeen = new DateTime.now();
+ _HttpSession(this._sessionManager, this.id) : _lastSeen = new DateTime.now();
void destroy() {
_destroyed = true;
@@ -41,8 +41,6 @@ class _HttpSession implements HttpSession {
bool get isNew => _isNew;
- final String id;
-
void set onTimeout(void callback()) {
_timeoutCallback = callback;
}
@@ -70,6 +68,12 @@ class _HttpSession implements HttpSession {
// * In a map, mapping from ID to HttpSession.
// * In a linked list, used as a timeout queue.
class _HttpSessionManager {
+ Map<String, _HttpSession> _sessions;
+ int _sessionTimeout = 20 * 60; // 20 mins.
+ _HttpSession _head;
+ _HttpSession _tail;
+ Timer _timer;
+
_HttpSessionManager() : _sessions = {};
String createSessionId() {
@@ -78,9 +82,7 @@ class _HttpSessionManager {
return _CryptoUtils.bytesToHex(data);
}
- _HttpSession getSession(String id) {
- return _sessions[id];
- }
+ _HttpSession getSession(String id) => _sessions[id];
_HttpSession createSession() {
var id = createSessionId();
@@ -100,9 +102,7 @@ class _HttpSessionManager {
_startTimer();
}
- void close() {
- _stopTimer();
- }
+ void close() => _stopTimer();
void _bumpToEnd(_HttpSession session) {
_removeFromTimeoutQueue(session);
@@ -168,11 +168,5 @@ class _HttpSessionManager {
_timer = null;
}
}
-
- Map<String, _HttpSession> _sessions;
- int _sessionTimeout = 20 * 60; // 20 mins.
- _HttpSession _head;
- _HttpSession _tail;
- Timer _timer;
}

Powered by Google App Engine
This is Rietveld 408576698