summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@digia.com>2014-01-14 15:56:06 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-28 15:38:22 +0100
commit7753f12a5449a3ec934e833619380e91f97a6db1 (patch)
treec70a1bc3b5c649afad1c5dc0d2f642a32b22174b
parent14992ac7cf0754b8a97a8cedf40c2b63aa26d421 (diff)
Pre-start the render process upon initialiazing the adapter
This should provide us with an initial empty document, which our imported autotests tend to assume all over the place. Initialization of the adapter is moved further down in QQuickWebEngineView's constructor so that the value of q_ptr is set and valid by the time we end up in WebContentsViewQt::CreateViewForWidget. Change-Id: I45d8d61e65caa3a690461b6da44adea9f8981e7e Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com> Reviewed-by: Zeno Albisser <zeno.albisser@digia.com> Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r--src/core/web_contents_adapter.cpp8
-rw-r--r--src/webengine/api/qquickwebengineview.cpp5
2 files changed, 9 insertions, 4 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 24da23016..4c197090c 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -52,9 +52,9 @@
#include "base/values.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
+#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
#include "content/public/common/page_zoom.h"
#include "content/public/common/renderer_preferences.h"
#include "ui/shell_dialogs/selected_file_info.h"
@@ -220,6 +220,12 @@ void WebContentsAdapter::initialize(WebContentsAdapterClient *adapterClient)
// Let the WebContent's view know about the WebContentsAdapterClient.
WebContentsViewQt* contentsView = static_cast<WebContentsViewQt*>(d->webContents->GetView());
contentsView->initialize(adapterClient);
+
+ // Create a RenderView with the initial empty document
+ content::RenderViewHost *rvh = d->webContents->GetRenderViewHost();
+ Q_ASSERT(rvh);
+ static_cast<content::WebContentsImpl*>(d->webContents.get())->CreateRenderViewForRenderManager(rvh, MSG_ROUTING_NONE);
+
}
void WebContentsAdapter::reattachRWHV()
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index a99707730..68e64ee4e 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -89,8 +89,6 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
// 1x, 2x, 3x etc assets that fit an integral number of pixels.
setDevicePixelRatio(qMax(1, qRound(webPixelRatio)));
}
-
- adapter->initialize(this);
}
QQuickWebEngineViewExperimental *QQuickWebEngineViewPrivate::experimental() const
@@ -324,8 +322,9 @@ void QQuickWebEngineViewPrivate::setDevicePixelRatio(qreal devicePixelRatio)
QQuickWebEngineView::QQuickWebEngineView(QQuickItem *parent)
: QQuickItem(*(new QQuickWebEngineViewPrivate), parent)
{
- Q_D(const QQuickWebEngineView);
+ Q_D(QQuickWebEngineView);
d->e->q_ptr = this;
+ d->adapter->initialize(d);
}
QQuickWebEngineView::~QQuickWebEngineView()