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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 1490763005: Add the right type conversions for various postMessage methods (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 1ecba16a765753710f57f9232060cb8a9af8615e..8acae64c58bef68af8114e88304584654eec0e45 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -8464,7 +8464,26 @@ class DedicatedWorkerGlobalScope extends WorkerGlobalScope {
@DomName('DedicatedWorkerGlobalScope.postMessage')
@DocsEditable()
@Experimental() // untriaged
- void postMessage(Object message, [List<MessagePort> transfer]) native;
+ void postMessage(/*any*/ message, [List<MessagePort> transfer]) {
+ if (transfer != null) {
+ var message_1 = convertDartToNative_SerializedScriptValue(message);
+ _postMessage_1(message_1, transfer);
+ return;
+ }
+ var message_1 = convertDartToNative_SerializedScriptValue(message);
+ _postMessage_2(message_1);
+ return;
+ }
+ @JSName('postMessage')
+ @DomName('DedicatedWorkerGlobalScope.postMessage')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _postMessage_1(message, List<MessagePort> transfer) native;
+ @JSName('postMessage')
+ @DomName('DedicatedWorkerGlobalScope.postMessage')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _postMessage_2(message) native;
/// Stream of `message` events handled by this [DedicatedWorkerGlobalScope].
@DomName('DedicatedWorkerGlobalScope.onmessage')
@@ -27427,7 +27446,26 @@ class ServiceWorkerClient extends Interceptor {
@DomName('ServiceWorkerClient.postMessage')
@DocsEditable()
@Experimental() // untriaged
- void postMessage(/*SerializedScriptValue*/ message, [List<MessagePort> transfer]) native;
+ void postMessage(/*SerializedScriptValue*/ message, [List<MessagePort> transfer]) {
+ if (transfer != null) {
+ var message_1 = convertDartToNative_SerializedScriptValue(message);
+ _postMessage_1(message_1, transfer);
+ return;
+ }
+ var message_1 = convertDartToNative_SerializedScriptValue(message);
+ _postMessage_2(message_1);
+ return;
+ }
+ @JSName('postMessage')
+ @DomName('ServiceWorkerClient.postMessage')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _postMessage_1(message, List<MessagePort> transfer) native;
+ @JSName('postMessage')
+ @DomName('ServiceWorkerClient.postMessage')
+ @DocsEditable()
+ @Experimental() // untriaged
+ void _postMessage_2(message) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -34017,7 +34055,24 @@ class Worker extends EventTarget implements AbstractWorker {
@DomName('Worker.postMessage')
@DocsEditable()
- void postMessage(/*SerializedScriptValue*/ message, [List<MessagePort> transfer]) native;
+ void postMessage(/*SerializedScriptValue*/ message, [List<MessagePort> transfer]) {
+ if (transfer != null) {
+ var message_1 = convertDartToNative_SerializedScriptValue(message);
+ _postMessage_1(message_1, transfer);
+ return;
+ }
+ var message_1 = convertDartToNative_SerializedScriptValue(message);
+ _postMessage_2(message_1);
+ return;
+ }
+ @JSName('postMessage')
+ @DomName('Worker.postMessage')
+ @DocsEditable()
+ void _postMessage_1(message, List<MessagePort> transfer) native;
+ @JSName('postMessage')
+ @DomName('Worker.postMessage')
+ @DocsEditable()
+ void _postMessage_2(message) native;
@DomName('Worker.terminate')
@DocsEditable()
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698