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

Side by Side Diff: runtime/bin/builtin.dart

Issue 1278623002: - Make sure to close the port if a packages file was passed on the (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address previous review comments. Created 5 years, 4 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/loader.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library builtin; 5 library builtin;
6 // NOTE: Do not import 'dart:io' in builtin. 6 // NOTE: Do not import 'dart:io' in builtin.
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:_internal'; 9 import 'dart:_internal';
10 import 'dart:isolate'; 10 import 'dart:isolate';
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 _rootScript = scriptUri; 302 _rootScript = scriptUri;
303 303
304 if (_traceLoading) { 304 if (_traceLoading) {
305 _log('Resolved entry point to: $_rootScript'); 305 _log('Resolved entry point to: $_rootScript');
306 } 306 }
307 return scriptUri; 307 return scriptUri;
308 } 308 }
309 309
310 310
311 void _finishLoadRequest(_LoadRequest req) { 311 void _finishLoadRequest(_LoadRequest req) {
312 // Now that we are done with loading remove the request from the map. 312 if (req != null) {
313 var tmp = _reqMap.remove(req._id); 313 // Now that we are done with loading remove the request from the map.
314 assert(tmp == req); 314 var tmp = _reqMap.remove(req._id);
315 if (_traceLoading) { 315 assert(tmp == req);
316 _log("Loading of ${req._uri} finished: " 316 if (_traceLoading) {
317 "${_reqMap.length} requests remaining, " 317 _log("Loading of ${req._uri} finished: "
318 "${_pendingPackageLoads.length} packages pending."); 318 "${_reqMap.length} requests remaining, "
319 "${_pendingPackageLoads.length} packages pending.");
320 }
319 } 321 }
320 322
321 if (!_pendingLoads()) { 323 if (!_pendingLoads()) {
322 if (_traceLoading) { 324 if (_traceLoading) {
323 _log("Closing loading port."); 325 _log("Closing loading port.");
324 } 326 }
325 _receivePort.close(); 327 _receivePort.close();
326 _receivePort = null; 328 _receivePort = null;
327 _sendPort = null; 329 _sendPort = null;
328 _reqId = 0; 330 _reqId = 0;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 _loadPackage(req._tag, req._uri, req._resourceUri, req._context); 442 _loadPackage(req._tag, req._uri, req._resourceUri, req._context);
441 } else { 443 } else {
442 if (_traceLoading) { 444 if (_traceLoading) {
443 _log("Skipping dummy deferred request."); 445 _log("Skipping dummy deferred request.");
444 } 446 }
445 } 447 }
446 } 448 }
447 // Reset the pending package loads to empty. So that we eventually can 449 // Reset the pending package loads to empty. So that we eventually can
448 // finish loading. 450 // finish loading.
449 _pendingPackageLoads = []; 451 _pendingPackageLoads = [];
452 // Make sure that the receive port is closed if no other loads are pending.
453 _finishLoadRequest(null);
450 } 454 }
451 455
452 456
453 void _requestPackagesMap() { 457 void _requestPackagesMap() {
454 assert(_packagesPort == null); 458 assert(_packagesPort == null);
455 assert(_rootScript != null); 459 assert(_rootScript != null);
456 // Create a port to receive the packages map on. 460 // Create a port to receive the packages map on.
457 _packagesPort = new RawReceivePort(_handlePackagesReply); 461 _packagesPort = new RawReceivePort(_handlePackagesReply);
458 var sp = _packagesPort.sendPort; 462 var sp = _packagesPort.sendPort;
459 463
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 756
753 return [path, filename, name]; 757 return [path, filename, name];
754 } 758 }
755 759
756 760
757 // Register callbacks and hooks with the rest of the core libraries. 761 // Register callbacks and hooks with the rest of the core libraries.
758 _setupHooks() { 762 _setupHooks() {
759 _setupCompleted = true; 763 _setupCompleted = true;
760 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes; 764 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes;
761 } 765 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/vmservice/loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698