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.
Created attachment 67741 [details] Save the messages in postMessageToInjectedBundle and send them in ensureWebProcess
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
(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!
Comment on attachment 67741 [details] Save the messages in postMessageToInjectedBundle and send them in ensureWebProcess Committed in r67593: http://trac.webkit.org/changeset/67593