summaryrefslogtreecommitdiffstats
path: root/content/browser/message_port_service.h
diff options
context:
space:
mode:
authormek <mek@chromium.org>2014-11-20 16:31:20 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-21 00:31:40 +0000
commitddb153288a99ad6be14b88244bfa070e612580f9 (patch)
tree64cb44d7da57454f6c621528aa0572ea6393bd69 /content/browser/message_port_service.h
parent7f4660dcd4c4476502a61eb7375c4a941d938b9b (diff)
downloadchromium_src-ddb153288a99ad6be14b88244bfa070e612580f9.zip
chromium_src-ddb153288a99ad6be14b88244bfa070e612580f9.tar.gz
chromium_src-ddb153288a99ad6be14b88244bfa070e612580f9.tar.bz2
Properly queue messages sent to message ports that are transferred to a service worker.
There can be some delay between the message port being transferred to the browser process and the renderer for the service worker being available, so this change makes sure that during this period messages sent to these message ports are queued, rather than get lost/cause assertions to fail. Additionally, ports that are send to these ports while they are queued will be similarly delayed, and thus also need to be put in this special state. Finally when for some reason launching the service worker fails all these ports (that are not associated with any renderer) need to be cleaned up, which might have to happen asynchronously, since the source renderer process might not have finished sending the message queue for this port yet. Some layout tests for this are in https://codereview.chromium.org/729923004/ BUG=432678 Review URL: https://codereview.chromium.org/737833002 Cr-Commit-Position: refs/heads/master@{#305120}
Diffstat (limited to 'content/browser/message_port_service.h')
-rw-r--r--content/browser/message_port_service.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/content/browser/message_port_service.h b/content/browser/message_port_service.h
index 6689591..12ba538 100644
--- a/content/browser/message_port_service.h
+++ b/content/browser/message_port_service.h
@@ -37,6 +37,7 @@ class MessagePortService {
void QueueMessages(int message_port_id);
void SendQueuedMessages(int message_port_id,
const QueuedMessages& queued_messages);
+ void ReleaseMessages(int message_port_id);
// Updates the information needed to reach a message port when it's sent to a
// (possibly different) process.
@@ -45,6 +46,20 @@ class MessagePortService {
MessagePortMessageFilter* filter,
int routing_id);
+ // The message port is being transferred to a new renderer process, but the
+ // code doing that isn't able to immediately update the message port with a
+ // new filter and routing_id. This queues up all messages sent to this port
+ // until later ReleaseMessages is called for this port (this will happen
+ // automatically as soon as a WebMessagePortChannelImpl instance is created
+ // for this port in the renderer. The browser side code is still responsible
+ // for updating the port with a new filter before that happens. If ultimately
+ // transfering the port to a new process fails, ClosePort should be called to
+ // clean up the port.
+ void HoldMessages(int message_port_id);
+
+ // Closes and cleans up the message port.
+ void ClosePort(int message_port_id);
+
void OnMessagePortMessageFilterClosing(MessagePortMessageFilter* filter);
// Attempts to send the queued messages for a message port.