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

Unified Diff: android_webview/native/aw_message_port_service_impl.cc

Issue 986553004: Hold messages in message port service when a message port is (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/native/aw_message_port_service_impl.cc
diff --git a/android_webview/native/aw_message_port_service_impl.cc b/android_webview/native/aw_message_port_service_impl.cc
index 0a15d9f44ef8ccc1e8bb24b01c2961124d1a7b4a..0caf92cd3afb770682d0379bf00fa9e5b2d77a82 100644
--- a/android_webview/native/aw_message_port_service_impl.cc
+++ b/android_webview/native/aw_message_port_service_impl.cc
@@ -150,6 +150,15 @@ void AwMessagePortServiceImpl::ClosePort(JNIEnv* env, jobject obj,
message_port_id));
}
+void AwMessagePortServiceImpl::ReleaseMessages(JNIEnv* env, jobject obj,
+ int message_port_id) {
hush (inactive) 2015/03/06 22:32:37 int --> jint
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ BrowserThread::PostTask(
+ BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(&MessagePortProvider::ReleaseMessages, message_port_id));
+}
+
void AwMessagePortServiceImpl::RemoveSentPorts(
const std::vector<int>& sent_ports) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -181,6 +190,8 @@ void AwMessagePortServiceImpl::CreateMessageChannelOnIOThread(
int* portId1,
int* portId2) {
MessagePortProvider::CreateMessageChannel(filter.get(), portId1, portId2);
+ MessagePortProvider::HoldMessages(*portId1);
+ MessagePortProvider::HoldMessages(*portId2);
AddPort(*portId1, filter.get());
AddPort(*portId2, filter.get());
}

Powered by Google App Engine
This is Rietveld 408576698