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 8d2c499d7c67989cfa831269bfa95fac24314ed6..2a03536b10610b84b07f34e912e8947b88d9e773 100644 |
--- a/android_webview/java/src/org/chromium/android_webview/AwMessagePortService.java |
+++ b/android_webview/java/src/org/chromium/android_webview/AwMessagePortService.java |
@@ -123,12 +123,17 @@ public class AwMessagePortService { |
mObserverList.removeObserver(observer); |
} |
+ public void closePort(int messagePortId) { |
+ mPortStorage.put(messagePortId, null); |
hush (inactive)
2015/02/25 19:44:27
what's different between this and mPortStorage.rem
sgurun-gerrit only
2015/02/25 21:38:53
good catch.
|
+ if (mNativeMessagePortService == 0) return; |
+ nativeClosePort(mNativeMessagePortService, messagePortId); |
+ } |
+ |
public void postMessage(int senderId, String message, int[] sentPorts) { |
// verify that webview still owns the port (not transferred) |
if (mPortStorage.get(senderId) == null) { |
throw new IllegalStateException("Cannot post to unknown port " + senderId); |
} |
- removeSentPorts(sentPorts); |
hush (inactive)
2015/02/25 19:44:27
why is this removed?
sgurun-gerrit only
2015/02/25 21:38:53
this is actually a bug. The ports are removed in P
|
if (mNativeMessagePortService == 0) return; |
nativePostAppToWebMessage(mNativeMessagePortService, senderId, message, sentPorts); |
} |
@@ -190,4 +195,6 @@ public class AwMessagePortService { |
private native long nativeInitAwMessagePortService(); |
private native void nativePostAppToWebMessage(long nativeAwMessagePortServiceImpl, |
int senderId, String message, int[] portIds); |
+ private native void nativeClosePort(long nativeAwMessagePortServiceImpl, |
+ int messagePortId); |
} |