diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2023-01-17 13:21:21 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2023-01-19 14:24:58 +0100 |
commit | 876f11854eddbe95132692b3b0853470563ff54a (patch) | |
tree | 5189679817c390b2114c3d1f3e5ee6aebd99daf7 | |
parent | 474426afa4cf52e057d321498f78bb0fbd626022 (diff) |
Disable WebEngineContext dump by default
Keep it enabled for simplebrowser and quicknanobrowser examples. Also
add documentation how to enable it.
[ChangeLog][WebEngineCore] Disabled WebEngineContext dump by default.
Fixes: QTBUG-109040
Pick-to: 6.5
Change-Id: I4bd3c0e9eb532771f9b455863324e9dacaae884a
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r-- | examples/webenginequick/quicknanobrowser/main.cpp | 2 | ||||
-rw-r--r-- | examples/webenginewidgets/simplebrowser/main.cpp | 2 | ||||
-rw-r--r-- | src/core/doc/src/qtwebengine-debugging.qdoc | 11 | ||||
-rw-r--r-- | src/core/web_engine_context.cpp | 37 |
4 files changed, 33 insertions, 19 deletions
diff --git a/examples/webenginequick/quicknanobrowser/main.cpp b/examples/webenginequick/quicknanobrowser/main.cpp index 519cfd089..850b8c443 100644 --- a/examples/webenginequick/quicknanobrowser/main.cpp +++ b/examples/webenginequick/quicknanobrowser/main.cpp @@ -12,6 +12,7 @@ #include <QtCore/QCommandLineParser> #include <QtCore/QCommandLineOption> +#include <QtCore/QLoggingCategory> static QUrl startupUrl(const QCommandLineParser &parser) { @@ -31,6 +32,7 @@ int main(int argc, char **argv) QtWebEngineQuick::initialize(); QGuiApplication app(argc, argv); + QLoggingCategory::setFilterRules(QStringLiteral("qt.webenginecontext.debug=true")); QCommandLineParser parser; parser.addHelpOption(); diff --git a/examples/webenginewidgets/simplebrowser/main.cpp b/examples/webenginewidgets/simplebrowser/main.cpp index 477a8171b..b945ef27e 100644 --- a/examples/webenginewidgets/simplebrowser/main.cpp +++ b/examples/webenginewidgets/simplebrowser/main.cpp @@ -5,6 +5,7 @@ #include "browserwindow.h" #include "tabwidget.h" #include <QApplication> +#include <QLoggingCategory> #include <QWebEngineProfile> #include <QWebEngineSettings> @@ -24,6 +25,7 @@ int main(int argc, char **argv) QApplication app(argc, argv); app.setWindowIcon(QIcon(QStringLiteral(":AppLogoColor.png"))); + QLoggingCategory::setFilterRules(QStringLiteral("qt.webenginecontext.debug=true")); QWebEngineProfile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true); QWebEngineProfile::defaultProfile()->settings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true); diff --git a/src/core/doc/src/qtwebengine-debugging.qdoc b/src/core/doc/src/qtwebengine-debugging.qdoc index 3599ec55e..3bb6a7029 100644 --- a/src/core/doc/src/qtwebengine-debugging.qdoc +++ b/src/core/doc/src/qtwebengine-debugging.qdoc @@ -92,6 +92,15 @@ QTWEBENGINE_CHROMIUM_FLAGS="--disable-logging" mybrowser \endcode - QTWEBENGINE_CHROMIUM_FLAGS can also be set using {qputenv} from within the + QTWEBENGINE_CHROMIUM_FLAGS can also be set using \c qputenv from within the application if called before QtWebEngineQuick::initialize(). + + \section1 Dump WebEngineContext Information + + For dumping the WebEngineContext information, you can set the \c QT_LOGGING_RULES + environment variable to \c "qt.webenginecontext.debug=true". + + The output contains information about the graphical backend, and the way how \QWE + is initialized for the application. This is particularly useful for reproducing + issues. */ diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 71855c8c2..ee90a5810 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -119,6 +119,8 @@ QT_END_NAMESPACE namespace QtWebEngineCore { +Q_LOGGING_CATEGORY(webEngineContextLog, "qt.webenginecontext") + #if QT_CONFIG(opengl) static bool usingSupportedSGBackend() @@ -235,8 +237,7 @@ void dummyGetPluginCallback(const std::vector<content::WebPluginInfo>&) static void logContext(const char *glType, base::CommandLine *cmd) { - QLoggingCategory webEngineContextLog("qt.webenginecontext"); - if (webEngineContextLog.isInfoEnabled()) { + if (Q_UNLIKELY(webEngineContextLog().isDebugEnabled())) { #if QT_CONFIG(opengl) const QSurfaceFormat sharedFormat = qt_gl_global_share_context()->format(); const auto profile = QMetaEnum::fromType<QSurfaceFormat::OpenGLContextProfile>().valueToKey( @@ -248,23 +249,23 @@ static void logContext(const char *glType, base::CommandLine *cmd) for (const auto &pair : switch_map) params << " * " << toQt(pair.first) << toQt(pair.second) << "\n"; - qCInfo(webEngineContextLog, - "\n\nGL Type: %s\n" - "Surface Type: %s\n" - "Surface Profile: %s\n" - "Surface Version: %d.%d\n" - "QSG RHI Backend: %s\n" - "Using Supported QSG Backend: %s\n" - "Using Software Dynamic GL: %s\n" - "Using Multithreaded OpenGL: %s\n\n" - "Init Parameters:\n %s", - glType, type, profile, sharedFormat.majorVersion(), sharedFormat.minorVersion(), - qUtf8Printable(QSGRhiSupport::instance()->rhiBackendName()), - usingSupportedSGBackend() ? "yes" : "no", usingSoftwareDynamicGL() ? "yes" : "no", - !WebEngineContext::isGpuServiceOnUIThread() ? "yes" : "no", - qPrintable(params.join(" "))); + qCDebug(webEngineContextLog, + "\n\nGL Type: %s\n" + "Surface Type: %s\n" + "Surface Profile: %s\n" + "Surface Version: %d.%d\n" + "QSG RHI Backend: %s\n" + "Using Supported QSG Backend: %s\n" + "Using Software Dynamic GL: %s\n" + "Using Multithreaded OpenGL: %s\n\n" + "Init Parameters:\n %s", + glType, type, profile, sharedFormat.majorVersion(), sharedFormat.minorVersion(), + qUtf8Printable(QSGRhiSupport::instance()->rhiBackendName()), + usingSupportedSGBackend() ? "yes" : "no", usingSoftwareDynamicGL() ? "yes" : "no", + !WebEngineContext::isGpuServiceOnUIThread() ? "yes" : "no", + qPrintable(params.join(" "))); #else - qCInfo(webEngineContextLog) << "WebEngine compiled with no opengl enabled."; + qCDebug(webEngineContextLog) << "WebEngine compiled with no opengl enabled."; #endif //QT_CONFIG(opengl) } } |