RESOLVED FIXED 45822
We should save messages that can't be sent when postMessageToInjectedBundle is called and send in ensureWebProcess
https://bugs.webkit.org/show_bug.cgi?id=45822
Summary We should save messages that can't be sent when postMessageToInjectedBundle i...
Jessie Berlin
Reported Wednesday, September 15, 2010 5:25:44 PM UTC
WebContext::registerURLSchemeAsEmptyDocument saves the URL Schemes that can't be registered immediately because the WebProcess is not valid at the time it is called and then sends those messages in WebContext::ensureWebProcess. WebContext::postMessageToInjectedBundle should do the same with messages.
Attachments
Save the messages in postMessageToInjectedBundle and send them in ensureWebProcess (2.74 KB, patch)
2010-09-15 16:46 PDT, Jessie Berlin
no flags
Jessie Berlin
Comment 1 Thursday, September 16, 2010 12:46:47 AM UTC
Created attachment 67741 [details] Save the messages in postMessageToInjectedBundle and send them in ensureWebProcess
Jon Honeycutt
Comment 2 Thursday, September 16, 2010 2:17:34 AM UTC
Comment on attachment 67741 [details] Save the messages in postMessageToInjectedBundle and send them in ensureWebProcess > @@ -130,6 +130,12 @@ void WebContext::ensureWebProcess() > for (HashSet<String>::iterator it = m_schemesToRegisterAsEmptyDocument.begin(), end = m_schemesToRegisterAsEmptyDocument.end(); it != end; ++it) > m_process->send(WebProcessMessage::RegisterURLSchemeAsEmptyDocument, 0, CoreIPC::In(*it)); > > + for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) { > + pair<String, RefPtr<APIObject> > message = m_pendingMessagesToPostToInjectedBundle[i]; I think you can make message a reference to avoid a copy. > @@ -197,8 +203,10 @@ void WebContext::preferencesDidChange() > > void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody) > { > - if (!hasValidProcess()) > + if (!hasValidProcess()) { > + m_pendingMessagesToPostToInjectedBundle.append(pair<String, RefPtr<APIObject> >(messageName, messageBody)); You can simplify this using make_pair(messageName, messageBody). r=me
Jessie Berlin
Comment 3 Thursday, September 16, 2010 2:45:52 AM UTC
(In reply to comment #2) > (From update of attachment 67741 [details]) > > @@ -130,6 +130,12 @@ void WebContext::ensureWebProcess() > > for (HashSet<String>::iterator it = m_schemesToRegisterAsEmptyDocument.begin(), end = m_schemesToRegisterAsEmptyDocument.end(); it != end; ++it) > > m_process->send(WebProcessMessage::RegisterURLSchemeAsEmptyDocument, 0, CoreIPC::In(*it)); > > > > + for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) { > > + pair<String, RefPtr<APIObject> > message = m_pendingMessagesToPostToInjectedBundle[i]; > > I think you can make message a reference to avoid a copy. Done. > > > @@ -197,8 +203,10 @@ void WebContext::preferencesDidChange() > > > > void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody) > > { > > - if (!hasValidProcess()) > > + if (!hasValidProcess()) { > > + m_pendingMessagesToPostToInjectedBundle.append(pair<String, RefPtr<APIObject> >(messageName, messageBody)); > > You can simplify this using make_pair(messageName, messageBody). Done. > > r=me Thanks!
Jessie Berlin
Comment 4 Thursday, September 16, 2010 2:51:35 AM UTC
Comment on attachment 67741 [details] Save the messages in postMessageToInjectedBundle and send them in ensureWebProcess Committed in r67593: http://trac.webkit.org/changeset/67593
Note You need to log in before you can comment on or make changes to this bug.