From 8a4091c2104913294b4dc7b06c8e9fb2c022f51e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 16 Aug 2016 14:51:33 +0200 Subject: Fix crash when trying to navigate in new window but is blocked Ensure that if QWebEnginePage::createWindow returns 'this' that we fall back to navigating in current tab. Change-Id: Idffe25dcafaaf3c824815b3cf1f0e400eaec2923 Reviewed-by: Michal Klocek --- src/core/web_contents_delegate_qt.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/core') diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 97f0e515d..5e9157069 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -97,6 +97,7 @@ content::WebContents *WebContentsDelegateQt::OpenURLFromTab(content::WebContents if (targetAdapter) target = targetAdapter->webContents(); } + Q_ASSERT(target); content::NavigationController::LoadURLParams load_url_params(params.url); load_url_params.referrer = params.referrer; -- cgit v1.2.3 From e2b8c3fe8f83cf448df4b0476f4f0dd4dd7d1b80 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 13 May 2016 17:53:14 +0200 Subject: Fix textures memory leak on second X11 screen Fix for QTBUG-48969 was only half-baked patch and introduced massive memory leak on fbo and texture alloctaions. Delete fbo and extra allocated textures. Task-number: QTBUG-52575 Task-number: QTBUG-48969 Change-Id: I2148f37cd27dab9e40ab72caeb6857752b69379f Reviewed-by: Allan Sandfeld Jensen --- src/core/delegated_frame_node.cpp | 82 +++++++++++++++++++++++++++++---------- src/core/delegated_frame_node.h | 5 +++ 2 files changed, 67 insertions(+), 20 deletions(-) (limited to 'src/core') diff --git a/src/core/delegated_frame_node.cpp b/src/core/delegated_frame_node.cpp index c7c106177..363814789 100644 --- a/src/core/delegated_frame_node.cpp +++ b/src/core/delegated_frame_node.cpp @@ -70,7 +70,6 @@ #include #include #include -#include #include #if !defined(QT_NO_EGL) @@ -91,6 +90,7 @@ namespace QtWebEngineCore { class MailboxTexture : public QSGTexture, protected QOpenGLFunctions { public: MailboxTexture(const gpu::MailboxHolder &mailboxHolder, const QSize textureSize); + ~MailboxTexture(); virtual int textureId() const Q_DECL_OVERRIDE { return m_textureId; } virtual QSize textureSize() const Q_DECL_OVERRIDE { return m_textureSize; } virtual bool hasAlphaChannel() const Q_DECL_OVERRIDE { return m_hasAlpha; } @@ -108,6 +108,9 @@ private: QSize m_textureSize; bool m_hasAlpha; GLenum m_target; +#if defined(USE_X11) + bool m_ownsTexture; +#endif #ifdef Q_OS_QNX EGLStreamData m_eglStreamData; #endif @@ -280,6 +283,9 @@ MailboxTexture::MailboxTexture(const gpu::MailboxHolder &mailboxHolder, const QS , m_textureSize(textureSize) , m_hasAlpha(false) , m_target(GL_TEXTURE_2D) +#if defined(USE_X11) + , m_ownsTexture(false) +#endif { initializeOpenGLFunctions(); @@ -290,6 +296,21 @@ MailboxTexture::MailboxTexture(const gpu::MailboxHolder &mailboxHolder, const QS m_textureSize = QSize(1, 1); } +MailboxTexture::~MailboxTexture() +{ +#if defined(USE_X11) + // This is rare case, where context is not shared + // we created extra texture in current context, so + // delete it now + if (m_ownsTexture) { + QOpenGLContext *currentContext = QOpenGLContext::currentContext() ; + QOpenGLFunctions *funcs = currentContext->functions(); + GLuint id(m_textureId); + funcs->glDeleteTextures(1, &id); + } +#endif +} + void MailboxTexture::bind() { glBindTexture(m_target, m_textureId); @@ -390,8 +411,25 @@ RectClipNode::RectClipNode(const QRectF &rect) DelegatedFrameNode::DelegatedFrameNode() : m_numPendingSyncPoints(0) +#if defined(USE_X11) + , m_contextShared(true) +#endif { setFlag(UsePreprocess); +#if defined(USE_X11) + QOpenGLContext *currentContext = QOpenGLContext::currentContext() ; + QOpenGLContext *sharedContext = qt_gl_global_share_context(); + if (!QOpenGLContext::areSharing(currentContext, sharedContext)) { + static bool allowNotSharedContextWarningShown = true; + if (allowNotSharedContextWarningShown) { + allowNotSharedContextWarningShown = false; + qWarning("Context is not shared, textures will be copied between contexts."); + } + m_offsurface.reset(new QOffscreenSurface); + m_offsurface->create(); + m_contextShared = false; + } +#endif } DelegatedFrameNode::~DelegatedFrameNode() @@ -430,30 +468,28 @@ void DelegatedFrameNode::preprocess() #if defined(USE_X11) // Workaround when context is not shared QTBUG-48969 // Make slow copy between two contexts. - QOpenGLContext *currentContext = QOpenGLContext::currentContext() ; - QOpenGLContext *sharedContext = qt_gl_global_share_context(); - if (!QOpenGLContext::areSharing(currentContext,sharedContext)) { - static bool allowNotSharedContextWarningShown = true; - if (allowNotSharedContextWarningShown) { - allowNotSharedContextWarningShown = false; - qWarning("Context is not shared, textures will be copied between contexts."); - } + if (!m_contextShared) { + QOpenGLContext *currentContext = QOpenGLContext::currentContext() ; + QOpenGLContext *sharedContext = qt_gl_global_share_context(); + + QSurface *surface = currentContext->surface(); + Q_ASSERT(m_offsurface); + sharedContext->makeCurrent(m_offsurface.data()); + QOpenGLFunctions *funcs = sharedContext->functions(); + + GLuint fbo = 0; + funcs->glGenFramebuffers(1, &fbo); Q_FOREACH (MailboxTexture *mailboxTexture, mailboxesToFetch) { gfx::TransferableFence fence = transferredFences.take(mailboxTexture->mailboxHolder().sync_point); waitChromiumSync(&fence); deleteChromiumSync(&fence); - QSurface *surface = currentContext->surface(); // Read texture into QImage from shared context. // Switch to shared context. - QOffscreenSurface offsurface; - offsurface.create(); - sharedContext->makeCurrent(&offsurface); - QOpenGLFunctions *funcs = sharedContext->functions(); + sharedContext->makeCurrent(m_offsurface.data()); + funcs = sharedContext->functions(); QImage img(mailboxTexture->textureSize(), QImage::Format_RGBA8888_Premultiplied); - GLuint fbo = 0; - funcs->glGenFramebuffers(1, &fbo); funcs->glBindFramebuffer(GL_FRAMEBUFFER, fbo); funcs->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mailboxTexture->m_textureId, 0); GLenum status = funcs->glCheckFramebufferStatus(GL_FRAMEBUFFER); @@ -461,13 +497,12 @@ void DelegatedFrameNode::preprocess() qWarning("fbo error, skipping slow copy..."); continue; } - - funcs->glReadPixels(0, 0, mailboxTexture->textureSize().width(), mailboxTexture->textureSize().height(), GL_RGBA, GL_UNSIGNED_BYTE, img.bits()); - funcs->glBindFramebuffer(GL_FRAMEBUFFER, 0); + funcs->glReadPixels(0, 0, mailboxTexture->textureSize().width(), mailboxTexture->textureSize().height(), + GL_RGBA, GL_UNSIGNED_BYTE, img.bits()); // Restore current context. - currentContext->makeCurrent(surface); // Create texture from QImage in current context. + currentContext->makeCurrent(surface); GLuint texture = 0; funcs = currentContext->functions(); funcs->glGenTextures(1, &texture); @@ -479,7 +514,14 @@ void DelegatedFrameNode::preprocess() funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, mailboxTexture->textureSize().width(), mailboxTexture->textureSize().height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, img.bits()); mailboxTexture->m_textureId = texture; + mailboxTexture->m_ownsTexture = true; } + // Cleanup allocated resources + sharedContext->makeCurrent(m_offsurface.data()); + funcs = sharedContext->functions(); + funcs->glBindFramebuffer(GL_FRAMEBUFFER, 0); + funcs->glDeleteFramebuffers(1, &fbo); + currentContext->makeCurrent(surface); } else #endif { diff --git a/src/core/delegated_frame_node.h b/src/core/delegated_frame_node.h index eed03fadd..d888935b2 100644 --- a/src/core/delegated_frame_node.h +++ b/src/core/delegated_frame_node.h @@ -45,6 +45,7 @@ #include #include #include +#include #include "chromium_gpu_helper.h" #include "render_widget_host_view_qt_delegate.h" @@ -98,6 +99,10 @@ private: QMap m_mailboxGLFences; QWaitCondition m_mailboxesFetchedWaitCond; QMutex m_mutex; +#if defined(USE_X11) + bool m_contextShared; + QScopedPointer m_offsurface; +#endif }; } // namespace QtWebEngineCore -- cgit v1.2.3 From 74b324b8f328e9d241984de6a9c43825fa298aff Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 26 Aug 2016 15:23:41 +0200 Subject: Update Chromium MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pulls in a security update and updates our sources to match. Change-Id: I06af8eea04426ee9c695e78cce7c9606eb2b4ab1 Reviewed-by: Michael BrĂ¼ning --- src/core/resource_dispatcher_host_delegate_qt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/resource_dispatcher_host_delegate_qt.cpp b/src/core/resource_dispatcher_host_delegate_qt.cpp index 73a640207..af8b02e1b 100644 --- a/src/core/resource_dispatcher_host_delegate_qt.cpp +++ b/src/core/resource_dispatcher_host_delegate_qt.cpp @@ -92,7 +92,7 @@ QString ResourceDispatcherHostLoginDelegateQt::realm() const QString ResourceDispatcherHostLoginDelegateQt::host() const { - return QString::fromStdString(m_authInfo->challenger.ToString()); + return QString::fromStdString(m_authInfo->challenger.host()); } bool ResourceDispatcherHostLoginDelegateQt::isProxy() const -- cgit v1.2.3 From ce2f1b140d2d417f925ec54c8a095981827f7e68 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 6 Sep 2016 15:27:50 +0200 Subject: Do not assume neon on armv7 Chromium defaults to arm_neon=1 and then sets -mfpu=neon if the arm architecture is 7. Change-Id: Ib144dd4188ba4221ed35367026de9f9a04c69792 Reviewed-by: Michal Klocek --- src/core/gyp_run.pro | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/core') diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index 885df908c..ee62e5d72 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -79,6 +79,10 @@ contains(QT_ARCH, "arm") { contains(MFPU, "neon")|contains(MFPU, "neon-vfpv4"): GYP_CONFIG += arm_fpu=\"$$MFPU\" arm_neon=1 else:!lessThan(MARMV, 7): GYP_CONFIG += arm_neon=0 arm_neon_optional=1 else: GYP_CONFIG += arm_fpu=\"$$MFPU\" arm_neon=0 arm_neon_optional=0 + } else { + # Chromium defaults to arm_neon=1, Qt does not. + GYP_CONFIG += arm_neon=0 + !lessThan(MARMV, 7): GYP_CONFIG += arm_neon_optional=1 } contains(QMAKE_CFLAGS, "-marm"): GYP_CONFIG += arm_thumb=0 -- cgit v1.2.3 From 9766adb01943873d9109968911734be8e5dcb150 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 8 Sep 2016 11:48:22 +0200 Subject: Fix build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We now get a multiword value from $$pkgConfigExecutable which will cause us to treat it as multiple gyp config sets, which will make gyp fail. Change-Id: Icdf781bb633d804ff6355e882dc4997bb5f3310f Reviewed-by: Michael BrĂ¼ning --- src/core/gyp_run.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/gyp_run.pro b/src/core/gyp_run.pro index 71c1e063c..9b45af3be 100644 --- a/src/core/gyp_run.pro +++ b/src/core/gyp_run.pro @@ -19,7 +19,7 @@ cross_compile { GYP_CONFIG += qtwe_process_name_debug=$$QTWEBENGINEPROCESS_NAME_DEBUG GYP_CONFIG += qtwe_process_name_release=$$QTWEBENGINEPROCESS_NAME_RELEASE GYP_CONFIG += disable_glibcxx_debug=1 -!contains(QT_CONFIG, no-pkg-config): GYP_CONFIG += pkg-config=$$pkgConfigExecutable() +!contains(QT_CONFIG, no-pkg-config): GYP_ARGS += "-D pkg-config=\"$$pkgConfigExecutable()\"" !webcore_debug: GYP_CONFIG += remove_webcore_debug_symbols=1 !v8base_debug: GYP_CONFIG += remove_v8base_debug_symbols=1 -- cgit v1.2.3 From 527af790d460f0ec486fdbb667a36164a829761e Mon Sep 17 00:00:00 2001 From: Viktor Engelmann Date: Tue, 16 Aug 2016 13:50:43 +0200 Subject: Resolved nullptr dereference bug In line 282f of chromium/content/browser/frame_host/render_frame_host_manager.cc, RenderFrameHostManager::Navigate passes nullptr to WebContentsImpl::NotifyViewSwapped. In line 3833f of chromium/content/browser/web_contents/web_contents_impl.cc, this is passed on to the observers, including UserResourceControllerHost::WebContentsObserverHelper::RenderViewHostChanged which dereferenced it unchecked, causing a crash. Task-number: QTBUG-55254 Change-Id: Ibdb6645f63957d28a89c50b51faeb3aea086a8b3 Reviewed-by: Kai Koehne --- src/core/user_script_controller_host.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/user_script_controller_host.cpp b/src/core/user_script_controller_host.cpp index a0d3f6fed..4dcd1a071 100644 --- a/src/core/user_script_controller_host.cpp +++ b/src/core/user_script_controller_host.cpp @@ -78,7 +78,8 @@ void UserScriptControllerHost::WebContentsObserverHelper::RenderViewCreated(cont void UserScriptControllerHost::WebContentsObserverHelper::RenderViewHostChanged(content::RenderViewHost *oldHost, content::RenderViewHost *newHost) { - oldHost->Send(new RenderViewObserverHelper_ClearScripts(oldHost->GetRoutingID())); + if (oldHost) + oldHost->Send(new RenderViewObserverHelper_ClearScripts(oldHost->GetRoutingID())); content::WebContents *contents = web_contents(); Q_FOREACH (const UserScript &script, m_controllerHost->m_perContentsScripts.value(contents)) -- cgit v1.2.3 From d6c8a2cf8fa374e6d1c0a578391b57112c047fa4 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 5 Sep 2016 15:25:02 +0200 Subject: Enable -fno_delete_null_pointer_checks for g++ 6 on all of chromium This is necessary e.g. for PaintLayer::enclosingSelfPaintingLayer which also compares this with null. Change-Id: I85d69432a0d7eeb0d8df8f395821880e36180dcc Reviewed-by: Allan Sandfeld Jensen --- src/core/config/linux.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/config/linux.pri b/src/core/config/linux.pri index 9264932c4..a318e170c 100644 --- a/src/core/config/linux.pri +++ b/src/core/config/linux.pri @@ -29,7 +29,7 @@ use?(nss) { use_openssl_certs=1 } -gcc:!clang: greaterThan(QT_GCC_MAJOR_VERSION, 5): GYP_CONFIG += v8_no_delete_null_pointer_checks=1 +gcc:!clang: greaterThan(QT_GCC_MAJOR_VERSION, 5): GYP_CONFIG += no_delete_null_pointer_checks=1 contains(QT_CONFIG, system-zlib): use?(system_minizip): GYP_CONFIG += use_system_zlib=1 contains(QT_CONFIG, system-png): GYP_CONFIG += use_system_libpng=1 -- cgit v1.2.3