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

Unified Diff: lib/html/src/Isolates.dart

Issue 10702110: Added Dartium support for JS to Dart PortSync calls (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed tabbing Created 8 years, 5 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 | « lib/html/frog/html_frog.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/html/src/Isolates.dart
diff --git a/lib/dom/templates/html/frog/html_frog.darttemplate b/lib/html/src/Isolates.dart
similarity index 71%
copy from lib/dom/templates/html/frog/html_frog.darttemplate
copy to lib/html/src/Isolates.dart
index ef0cd9497cf1746d8a1568f19c162d7448a3753e..e9e182461a64c8c15ce08caaa39a438fe424202f 100644
--- a/lib/dom/templates/html/frog/html_frog.darttemplate
+++ b/lib/html/src/Isolates.dart
@@ -2,54 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-// DO NOT EDIT
-// Auto-generated dart:html library.
-
-#library('html');
-
-#import('dart:isolate');
-#import('dart:json');
-
-$!GENERATED_DART_FILES
-
-#source('../../dom/src/EventListener.dart');
-#source('../../dom/src/KeyLocation.dart');
-#source('../../dom/src/KeyName.dart');
-#source('../../dom/src/ReadyState.dart');
-#source('../../dom/src/_Collections.dart');
-#source('../../dom/src/_XMLHttpRequestUtils.dart');
-#source('../../html/src/IDBOpenDBRequest.dart');
-#source('../../html/src/Measurement.dart');
-#source('../../html/src/shared_FactoryProviders.dart');
-#source('../../html/src/frog_DOMImplementation.dart');
-#source('../../html/src/frog_FactoryProviders.dart');
-#source('../../html/src/frog_IDBKeyRangeFactoryProvider.dart');
-#source('../../html/src/frog_IDBOpenDBRequestImplementation.dart');
-#source('../../html/src/frog_LocationWrapper.dart');
-#source('../../dom/src/frog_TypedArrayFactoryProvider.dart');
-#source('../../html/src/_Testing.dart');
-#source('../../html/src/Device.dart');
-#source('../../dom/src/_ListIterators.dart');
-#source('../../dom/src/_Lists.dart');
-#source('../../isolate/serialization.dart');
-
-
-Window get window() native "return window;";
-_WindowImpl get _window() native "return window;";
-
-Document get document() native "return document;";
-
-_DocumentImpl get _document() native "return document;";
-
-Element query(String selector) => _document.query(selector);
-ElementList queryAll(String selector) => _document.queryAll(selector);
-
-// Workaround for tags like <cite> that lack their own Element subclass --
-// Dart issue 1990.
-class _HTMLElementImpl extends _ElementImpl native "*HTMLElement" {
-}
-
-// TODO(vsm): Move this to a separate Isolates.dart file.
_serialize(var message) {
return new _JsSerializer().traverse(message);
}
@@ -68,12 +20,12 @@ class _JsSerializer extends _Serializer {
}
visitLocalSendPortSync(_LocalSendPortSync x) {
- return [ 'sendport', 'dart2js',
+ return [ 'sendport', 'dart',
ReceivePortSync._isolateId, x._receivePort._portId ];
}
visitRemoteSendPortSync(_RemoteSendPortSync x) {
- return [ 'sendport', 'dart2js',
+ return [ 'sendport', 'dart',
x._receivePort._isolateId, x._receivePort._portId ];
}
}
@@ -90,7 +42,7 @@ class _JsDeserializer extends _Deserializer {
case 'nativejs':
num id = x[2];
return new _JsSendPortSync(id);
- case 'dart2js':
+ case 'dart':
num isolateId = x[2];
num portId = x[3];
return ReceivePortSync._lookup(isolateId, portId);
@@ -109,14 +61,13 @@ class _JsSendPortSync implements SendPortSync {
callSync(var message) {
var serialized = _serialize(message);
- var result =
- JS('var', @'ReceivePortSync.dispatchCall(#, #)', _id, serialized);
+ var result = _callPortSync(_id, serialized);
return _deserialize(result);
}
}
-// TODO(vsm): Handle Dartium isolates.
+// TODO(vsm): Differentiate between Dart2Js and Dartium isolates.
// The receiver is a different Dart isolate, compiled to JS.
class _RemoteSendPortSync implements SendPortSync {
@@ -168,7 +119,7 @@ class _LocalSendPortSync implements SendPortSync {
// delayed until the corresponding SendPort is registered on the
// window.
-// A Dart2JS ReceivePortSync (tagged 'dart2js' when serialized) is
+// A Dart ReceivePortSync (tagged 'dart' when serialized) is
// identifiable / resolvable by the combination of its isolateid and
// portid. When a corresponding SendPort is used within the same
// isolate, the _portMap below can be used to obtain the
@@ -201,13 +152,6 @@ class ReceivePortSync {
return _cachedIsolateId;
}
- static int _getNewIsolateId() native @'''
- if (!window.$dart$isolate$counter) {
- window.$dart$isolate$counter = 1;
- }
- return window.$dart$isolate$counter++;
-''';
-
static String _getListenerName(isolateId, portId) =>
'dart-port-$isolateId-$portId';
String get _listenerName() => _getListenerName(_isolateId, _portId);
« no previous file with comments | « lib/html/frog/html_frog.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698