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

Side by Side Diff: lib/isolate/frog/isolateimpl.dart

Issue 10540139: rename _lazy_port to _lazyPort. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 /** 5 /**
6 * Concepts used here: 6 * Concepts used here:
7 * 7 *
8 * "manager" - A manager contains one or more isolates, schedules their 8 * "manager" - A manager contains one or more isolates, schedules their
9 * execution, and performs other plumbing on their behalf. The isolate 9 * execution, and performs other plumbing on their behalf. The isolate
10 * present at the creation of the manager is designated as its "root isolate". 10 * present at the creation of the manager is designated as its "root isolate".
(...skipping 20 matching lines...) Expand all
31 // Running any Dart code outside the context of an isolate gives it 31 // Running any Dart code outside the context of an isolate gives it
32 // the change to break the isolate abstraction. 32 // the change to break the isolate abstraction.
33 _Manager get _globalState() native "return \$globalState;"; 33 _Manager get _globalState() native "return \$globalState;";
34 set _globalState(_Manager val) native "\$globalState = val;"; 34 set _globalState(_Manager val) native "\$globalState = val;";
35 35
36 void _fillStatics(context) native @""" 36 void _fillStatics(context) native @"""
37 $globals = context.isolateStatics; 37 $globals = context.isolateStatics;
38 $static_init(); 38 $static_init();
39 """; 39 """;
40 40
41 ReceivePort _lazy_port; 41 ReceivePort _lazyPort;
42 ReceivePort get _port() { 42 ReceivePort get _port() {
43 if (_lazy_port === null) { 43 if (_lazyPort === null) {
44 _lazy_port = new ReceivePort(); 44 _lazyPort = new ReceivePort();
45 } 45 }
46 return _lazy_port; 46 return _lazyPort;
47 } 47 }
48 48
49 SendPort _spawnFunction(void topLevelFunction()) { 49 SendPort _spawnFunction(void topLevelFunction()) {
50 final name = _IsolateNatives._getJSFunctionName(topLevelFunction); 50 final name = _IsolateNatives._getJSFunctionName(topLevelFunction);
51 if (name == null) { 51 if (name == null) {
52 throw new UnsupportedOperationException( 52 throw new UnsupportedOperationException(
53 "only top-level functions can be spawned."); 53 "only top-level functions can be spawned.");
54 } 54 }
55 return _IsolateNatives._spawn2(name, null, false); 55 return _IsolateNatives._spawn2(name, null, false);
56 } 56 }
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 if (uri != null) throw new UnsupportedOperationException( 598 if (uri != null) throw new UnsupportedOperationException(
599 "Currently spawnUri is not supported without web workers."); 599 "Currently spawnUri is not supported without web workers.");
600 _globalState.topEventLoop.enqueue(new _IsolateContext(), function() { 600 _globalState.topEventLoop.enqueue(new _IsolateContext(), function() {
601 final func = _getJSFunctionFromName(functionName); 601 final func = _getJSFunctionFromName(functionName);
602 _startIsolate2(func, replyPort); 602 _startIsolate2(func, replyPort);
603 }, 'nonworker start'); 603 }, 'nonworker start');
604 } 604 }
605 605
606 static void _startIsolate2(Function topLevel, SendPort replyTo) { 606 static void _startIsolate2(Function topLevel, SendPort replyTo) {
607 _fillStatics(_globalState.currentContext); 607 _fillStatics(_globalState.currentContext);
608 __port = new ReceivePort(); 608 _lazyPort = new ReceivePort();
609 replyTo.send(_SPAWNED_SIGNAL, port.toSendPort()); 609 replyTo.send(_SPAWNED_SIGNAL, port.toSendPort());
610 topLevel(); 610 topLevel();
611 } 611 }
612 612
613 /** 613 /**
614 * Spawns an isolate in a worker. [factoryName] is the Javascript constructor 614 * Spawns an isolate in a worker. [factoryName] is the Javascript constructor
615 * name for the isolate entry point class. 615 * name for the isolate entry point class.
616 */ 616 */
617 static void _spawnWorker2(functionName, uri, replyPort) { 617 static void _spawnWorker2(functionName, uri, replyPort) {
618 if (functionName == null) functionName = 'main'; 618 if (functionName == null) functionName = 'main';
(...skipping 14 matching lines...) Expand all
633 'command': 'start2', 633 'command': 'start2',
634 'id': workerId, 634 'id': workerId,
635 // Note: we serialize replyPort twice because the child worker needs to 635 // Note: we serialize replyPort twice because the child worker needs to
636 // first deserialize the worker id, before it can correctly deserialize 636 // first deserialize the worker id, before it can correctly deserialize
637 // the port (port deserialization is sensitive to what is the current 637 // the port (port deserialization is sensitive to what is the current
638 // workerId). 638 // workerId).
639 'replyTo': _serializeMessage(replyPort), 639 'replyTo': _serializeMessage(replyPort),
640 'functionName': functionName })); 640 'functionName': functionName }));
641 } 641 }
642 } 642 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698