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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwMessagePortService.java

Issue 995663002: Implement receiving transferred ports from JS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flaky-test
Patch Set: rebased Created 5 years, 9 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
Index: android_webview/java/src/org/chromium/android_webview/AwMessagePortService.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwMessagePortService.java b/android_webview/java/src/org/chromium/android_webview/AwMessagePortService.java
index 626d427473197bddf14472a170c098cfdbcc7817..e7c887b29ba17775a14901619844eb67dde4d2f8 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwMessagePortService.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwMessagePortService.java
@@ -144,8 +144,14 @@ public class AwMessagePortService {
// Called on IO thread.
@CalledByNative
private void onReceivedMessage(int portId, String message, int[] ports) {
- // TODO(sgurun) implement receiving ports from native
- mPortStorage.get(portId).onReceivedMessage(message);
+ MessagePort[] messagePorts = null;
+ for (int i = 0; i < ports.length; i++) {
hush (inactive) 2015/03/10 22:31:36 Do you need to null check ports here?
sgurun-gerrit only 2015/03/10 23:20:12 it is guaranteed not to be null at this point (cou
+ if (messagePorts == null) {
hush (inactive) 2015/03/10 22:31:36 Move it out of the loop so that you can avoid chec
sgurun-gerrit only 2015/03/10 23:20:12 this is to prevent creating a new if ports array i
+ messagePorts = new MessagePort[ports.length];
+ }
+ messagePorts[i] = addPort(new MessagePort(this), ports[i]);
+ }
+ mPortStorage.get(portId).onReceivedMessage(message, messagePorts);
}
@CalledByNative

Powered by Google App Engine
This is Rietveld 408576698