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

Unified Diff: content/child/webmessageportchannel_impl.cc

Issue 203073005: (NOT READY FOR REVIEW) Introduce MessagePortBypassFilter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « content/child/webmessageportchannel_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webmessageportchannel_impl.cc
diff --git a/content/child/webmessageportchannel_impl.cc b/content/child/webmessageportchannel_impl.cc
index cf439cc0742851de8270d70f228bf20b1e86f20c..808bda5869ca363e417af0796ed2b5f1712db2d3 100644
--- a/content/child/webmessageportchannel_impl.cc
+++ b/content/child/webmessageportchannel_impl.cc
@@ -65,9 +65,24 @@ void WebMessagePortChannelImpl::setClient(WebMessagePortChannelClient* client) {
client_ = client;
}
+void WebMessagePortChannelImpl::OnRouteRemoved() {
+ child_thread_loop_->ReleaseSoon(FROM_HERE, this);
+}
+
void WebMessagePortChannelImpl::destroy() {
+ if (!child_thread_loop_->BelongsToCurrentThread()) {
+ child_thread_loop_->PostTask(
+ FROM_HERE, base::Bind(&WebMessagePortChannelImpl::destroy, this));
+ return;
+ }
setClient(NULL);
+ if (route_id_ != MSG_ROUTING_NONE) {
+ ChildThread::current()->message_port_bypass_filter()->RemoveRoute(
+ route_id_,
+ base::Bind(&WebMessagePortChannelImpl::OnRouteRemoved, this));
+ return;
+ }
// Release the object on the main thread, since the destructor might want to
// send an IPC, and that has to happen on the main thread.
child_thread_loop_->ReleaseSoon(FROM_HERE, this);
@@ -149,6 +164,8 @@ void WebMessagePortChannelImpl::Init() {
&route_id_, &message_port_id_));
}
+ ChildThread::current()->message_port_bypass_filter()->AddRoute(route_id_,
+ this);
ChildThread::current()->GetRouter()->AddRoute(route_id_, this);
}
« no previous file with comments | « content/child/webmessageportchannel_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698