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

Unified Diff: runtime/bin/websocket.dart

Issue 10938010: Switch from interfaces to abstract classes in dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Add test binaries. Created 8 years, 3 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
« no previous file with comments | « runtime/bin/string_stream.dart ('k') | tests/co19/test_config.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/websocket.dart
diff --git a/runtime/bin/websocket.dart b/runtime/bin/websocket.dart
index ef8876cafd4bdd3928642687a540514ebf409578..5b5b862dabe6addcbca90a6316a1f825b16a161a 100644
--- a/runtime/bin/websocket.dart
+++ b/runtime/bin/websocket.dart
@@ -5,7 +5,7 @@
/**
* Web socket status codes used when closing a web socket connection.
*/
-interface WebSocketStatus {
+abstract class WebSocketStatus {
static const int NORMAL_CLOSURE = 1000;
static const int GOING_AWAY = 1001;
static const int PROTOCOL_ERROR = 1002;
@@ -38,8 +38,8 @@ interface WebSocketStatus {
*
* This handler strives to implement web sockets as specified by RFC6455.
*/
-interface WebSocketHandler default _WebSocketHandler {
- WebSocketHandler();
+abstract class WebSocketHandler {
+ factory WebSocketHandler() => new _WebSocketHandler();
/**
* Request handler to be registered with the HTTP server.
@@ -57,7 +57,7 @@ interface WebSocketHandler default _WebSocketHandler {
/**
* Server web socket connection.
*/
-interface WebSocketConnection extends Hashable {
+abstract class WebSocketConnection implements Hashable {
/**
* Sets the callback to be called when a message have been
* received. The type on [message] is either [:String:] or
@@ -96,14 +96,15 @@ interface WebSocketConnection extends Hashable {
/**
* Client web socket connection.
*/
-interface WebSocketClientConnection
- extends Hashable default _WebSocketClientConnection {
+abstract class WebSocketClientConnection implements Hashable {
/**
* Creates a new web socket client connection based on a HTTP client
* connection. The HTTP client connection must be freshly opened.
*/
- WebSocketClientConnection(HttpClientConnection conn,
- [List<String> protocols]);
+ factory WebSocketClientConnection(HttpClientConnection conn,
+ [List<String> protocols]) {
+ return new _WebSocketClientConnection(conn, protocols);
+ }
/**
* Sets the callback to be called when the request object for the
@@ -166,15 +167,15 @@ interface WebSocketClientConnection
/**
- * Base interface for the events generated by the W3C complient
- * browser API for web sockets.
+ * Base class for the events generated by the W3C complient browser
+ * API for web sockets.
*/
-interface Event { }
+abstract class Event { }
/**
* Event delivered when there is data on a web socket connection.
*/
-interface MessageEvent extends Event default _WebSocketMessageEvent {
+abstract class MessageEvent extends Event {
/**
* The type of [message] is either [:String:] or [:List<int>:]
* depending on whether it is a text or binary message. If the
@@ -187,7 +188,7 @@ interface MessageEvent extends Event default _WebSocketMessageEvent {
/**
* Event delivered when a web socket connection is closed.
*/
-interface CloseEvent extends Event default _WebSocketCloseEvent {
+abstract class CloseEvent extends Event {
/**
* Returns whether the connection was closed cleanly or not.
*/
@@ -212,7 +213,7 @@ interface CloseEvent extends Event default _WebSocketCloseEvent {
* with the W3C browser API for web sockets specified in
* http://dev.w3.org/html5/websockets/.
*/
-interface WebSocket default _WebSocket {
+abstract class WebSocket {
/**
* Possible states of the connection.
*/
@@ -227,7 +228,7 @@ interface WebSocket default _WebSocket {
* [:String:] or [:List<String>:] specifying the subprotocols the
* client is willing to speak.
*/
- WebSocket(String url, [protocols]);
+ factory WebSocket(String url, [protocols]) => new _WebSocket(url, protocols);
/**
* Returns the current state of the connection.
« no previous file with comments | « runtime/bin/string_stream.dart ('k') | tests/co19/test_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698