Delay WebProcess launch until a load is triggered in a Web view
[WebKit-https.git] / Source / WebKit / UIProcess / DrawingAreaProxy.cpp
index d36bc46..b5b4e0a 100644 (file)
@@ -40,6 +40,7 @@ using namespace WebCore;
 
 DrawingAreaProxy::DrawingAreaProxy(DrawingAreaType type, WebPageProxy& webPageProxy, WebProcessProxy& process)
     : m_type(type)
+    , m_identifier(DrawingAreaIdentifier::generate())
     , m_webPageProxy(webPageProxy)
     , m_process(makeRef(process))
     , m_size(webPageProxy.viewSize())
@@ -47,12 +48,12 @@ DrawingAreaProxy::DrawingAreaProxy(DrawingAreaType type, WebPageProxy& webPagePr
     , m_viewExposedRectChangedTimer(RunLoop::main(), this, &DrawingAreaProxy::viewExposedRectChangedTimerFired)
 #endif
 {
-    process.addMessageReceiver(Messages::DrawingAreaProxy::messageReceiverName(), m_webPageProxy.pageID(), *this);
+    process.addMessageReceiver(Messages::DrawingAreaProxy::messageReceiverName(), m_identifier.toUInt64(), *this);
 }
 
 DrawingAreaProxy::~DrawingAreaProxy()
 {
-    process().removeMessageReceiver(Messages::DrawingAreaProxy::messageReceiverName(), m_webPageProxy.pageID());
+    process().removeMessageReceiver(Messages::DrawingAreaProxy::messageReceiverName(), m_identifier.toUInt64());
 }
 
 bool DrawingAreaProxy::setSize(const IntSize& size, const IntSize& scrollDelta)
@@ -73,10 +74,20 @@ MachSendRight DrawingAreaProxy::createFence()
 }
 #endif
 
+IPC::Connection* DrawingAreaProxy::messageSenderConnection() const
+{
+    return process().connection();
+}
+
+bool DrawingAreaProxy::sendMessage(std::unique_ptr<IPC::Encoder> encoder, OptionSet<IPC::SendOption> sendOptions)
+{
+    return process().sendMessage(WTFMove(encoder), sendOptions);
+}
+
 #if PLATFORM(MAC)
 void DrawingAreaProxy::setViewExposedRect(Optional<WebCore::FloatRect> viewExposedRect)
 {
-    if (!m_webPageProxy.isValid())
+    if (!m_webPageProxy.hasRunningProcess())
         return;
 
     m_viewExposedRect = viewExposedRect;
@@ -87,13 +98,13 @@ void DrawingAreaProxy::setViewExposedRect(Optional<WebCore::FloatRect> viewExpos
 
 void DrawingAreaProxy::viewExposedRectChangedTimerFired()
 {
-    if (!m_webPageProxy.isValid())
+    if (!m_webPageProxy.hasRunningProcess())
         return;
 
     if (m_viewExposedRect == m_lastSentViewExposedRect)
         return;
 
-    process().send(Messages::DrawingArea::SetViewExposedRect(m_viewExposedRect), m_webPageProxy.pageID());
+    send(Messages::DrawingArea::SetViewExposedRect(m_viewExposedRect));
     m_lastSentViewExposedRect = m_viewExposedRect;
 }
 #endif // PLATFORM(MAC)