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

Side by Side Diff: runtime/bin/vmservice/server.dart

Issue 2438613002: Provide an API to dart:developer to control the web server hosting the Service Protocol (Closed)
Patch Set: self review Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | runtime/bin/vmservice/vmservice_io.dart » ('j') | sdk/lib/developer/service.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of vmservice_io; 5 part of vmservice_io;
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 static const ROOT_REDIRECT_PATH = '/index.html'; 121 static const ROOT_REDIRECT_PATH = '/index.html';
122 122
123 final VMService _service; 123 final VMService _service;
124 final String _ip; 124 final String _ip;
125 final int _port; 125 final int _port;
126 final bool _originCheckDisabled; 126 final bool _originCheckDisabled;
127 HttpServer _server; 127 HttpServer _server;
128 bool get running => _server != null; 128 bool get running => _server != null;
129 bool _displayMessages = false; 129 bool _displayMessages = false;
130 130
131 Uri get serverAddress {
132 if (!running) {
133 return null;
134 }
135 var ip = _server.address.address;
136 var port = _server.port;
137 return Uri.parse('http://$ip:$port/');
138 }
139
131 Server(this._service, this._ip, this._port, this._originCheckDisabled) { 140 Server(this._service, this._ip, this._port, this._originCheckDisabled) {
132 _displayMessages = (_ip != '127.0.0.1' || _port != 8181); 141 _displayMessages = (_ip != '127.0.0.1' || _port != 8181);
133 } 142 }
134 143
135 bool _isAllowedOrigin(String origin) { 144 bool _isAllowedOrigin(String origin) {
136 Uri uri; 145 Uri uri;
137 try { 146 try {
138 uri = Uri.parse(origin); 147 uri = Uri.parse(origin);
139 } catch (_) { 148 } catch (_) {
140 return false; 149 return false;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 _notifyServerState("", 0); 333 _notifyServerState("", 0);
325 onServerAddressChange(null); 334 onServerAddressChange(null);
326 return this; 335 return this;
327 }); 336 });
328 } 337 }
329 338
330 } 339 }
331 340
332 void _notifyServerState(String ip, int port) 341 void _notifyServerState(String ip, int port)
333 native "VMServiceIO_NotifyServerState"; 342 native "VMServiceIO_NotifyServerState";
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/vmservice/vmservice_io.dart » ('j') | sdk/lib/developer/service.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698