| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart_controller_service_isolate; | 5 part of dart_controller_service_isolate; |
| 6 | 6 |
| 7 class WebSocketClient extends Client { | 7 class WebSocketClient extends Client { |
| 8 static const int PARSE_ERROR_CODE = 4000; | 8 static const int PARSE_ERROR_CODE = 4000; |
| 9 static const int BINARY_MESSAGE_ERROR_CODE = 4001; | 9 static const int BINARY_MESSAGE_ERROR_CODE = 4001; |
| 10 static const int NOT_MAP_ERROR_CODE = 4002; | 10 static const int NOT_MAP_ERROR_CODE = 4002; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 assert(resource != null); | 144 assert(resource != null); |
| 145 } | 145 } |
| 146 if (resource != null) { | 146 if (resource != null) { |
| 147 // Serving up a static resource (e.g. .css, .html, .png). | 147 // Serving up a static resource (e.g. .css, .html, .png). |
| 148 request.response.headers.contentType = | 148 request.response.headers.contentType = |
| 149 ContentType.parse(resource.mimeType); | 149 ContentType.parse(resource.mimeType); |
| 150 request.response.add(resource.data); | 150 request.response.add(resource.data); |
| 151 request.response.close(); | 151 request.response.close(); |
| 152 return; | 152 return; |
| 153 } | 153 } |
| 154 var message = new Message.fromUri(this, request.uri); | |
| 155 var client = new HttpRequestClient(request, _service); | 154 var client = new HttpRequestClient(request, _service); |
| 155 var message = new Message.fromUri(client, request.uri); |
| 156 client.onMessage(null, message); | 156 client.onMessage(null, message); |
| 157 } | 157 } |
| 158 | 158 |
| 159 Future startup() { | 159 Future startup() { |
| 160 if (_server != null) { | 160 if (_server != null) { |
| 161 // Already running. | 161 // Already running. |
| 162 return new Future.value(this); | 162 return new Future.value(this); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Startup HTTP server. | 165 // Startup HTTP server. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); | 216 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); |
| 217 _notifyServerState("", 0); | 217 _notifyServerState("", 0); |
| 218 return this; | 218 return this; |
| 219 }); | 219 }); |
| 220 } | 220 } |
| 221 | 221 |
| 222 } | 222 } |
| 223 | 223 |
| 224 _notifyServerState(String ip, int port) | 224 _notifyServerState(String ip, int port) |
| 225 native "ServiceIsolate_NotifyServerState"; | 225 native "ServiceIsolate_NotifyServerState"; |
| OLD | NEW |