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

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

Issue 956763002: Implement the close() API for Message ports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 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);
}

Powered by Google App Engine
This is Rietveld 408576698