summaryrefslogtreecommitdiffstats
path: root/src/process
diff options
context:
space:
mode:
Diffstat (limited to 'src/process')
-rw-r--r--src/process/CMakeLists.txt105
-rw-r--r--src/process/Info_mac.plist22
-rw-r--r--src/process/Info_mac.plist.in44
-rw-r--r--src/process/QtWebEngineProcess.entitlements2
-rw-r--r--src/process/QtWebEngineProcess.exe.manifest (renamed from src/process/process.exe.manifest)0
-rw-r--r--src/process/main.cpp64
-rw-r--r--src/process/process.pro78
-rw-r--r--src/process/support_win.cpp83
8 files changed, 169 insertions, 229 deletions
diff --git a/src/process/CMakeLists.txt b/src/process/CMakeLists.txt
new file mode 100644
index 000000000..630ba42a8
--- /dev/null
+++ b/src/process/CMakeLists.txt
@@ -0,0 +1,105 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+if(NOT DEFINED WEBENGINE_ROOT_SOURCE_DIR)
+ qt_internal_get_filename_path_mode(path_mode)
+
+ get_filename_component(WEBENGINE_ROOT_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ${path_mode})
+endif()
+include(${WEBENGINE_ROOT_SOURCE_DIR}/cmake/Functions.cmake)
+
+find_package(Qt6 COMPONENTS Gui)
+
+get_target_property(qtWebEngineProcessName WebEngineCore QTWEBENGINEPROCESS_NAME)
+get_target_property(isFramework WebEngineCore FRAMEWORK)
+
+qt_internal_add_executable(${qtWebEngineProcessName}
+ NO_INSTALL
+ SOURCES main.cpp
+)
+
+if(WIN32)
+ target_sources(${qtWebEngineProcessName} PRIVATE support_win.cpp)
+ target_sources(${qtWebEngineProcessName} PRIVATE QtWebEngineProcess.exe.manifest)
+ target_link_libraries(${qtWebEngineProcessName} PRIVATE WebEngineCoreSandbox)
+ set_property(TARGET ${qtWebEngineProcessName} PROPERTY WIN32_EXECUTABLE TRUE)
+ # get libs rsp file, since cmake is not aware of PUBLIC libs for WebEngineCore
+ get_target_property(libs_rsp WebEngineCore LIBS_RSP)
+ target_link_options(${qtWebEngineProcessName} PRIVATE "@${libs_rsp}" "/STACK:0x800000")
+endif()
+
+if(MACOS)
+ set_target_properties(${qtWebEngineProcessName}
+ PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.qt-project.Qt.QtWebEngineProcess"
+ )
+endif()
+
+qt_internal_extend_target(${qtWebEngineProcessName}
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::WebEngineCore
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::WebEngineCorePrivate
+)
+
+target_include_directories(${qtWebEngineProcessName} PRIVATE ../core)
+
+qt_get_cmake_configurations(configs)
+
+foreach(config ${configs})
+ string(TOUPPER "${config}" config_upper)
+ if(isFramework)
+ set(outputPath
+ "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/QtWebEngineCore.framework/Versions/A/Helpers"
+ )
+ else()
+ set(outputPath "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}")
+ endif()
+ set_target_properties(${qtWebEngineProcessName} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY_${config_upper} "${outputPath}"
+ )
+
+ if("${config}" STREQUAL "Debug")
+ set_target_properties(${qtWebEngineProcessName} PROPERTIES
+ OUTPUT_NAME_DEBUG ${qtWebEngineProcessName}${CMAKE_DEBUG_POSTFIX}
+ )
+ endif()
+endforeach()
+
+if(isFramework)
+ set_target_properties(${qtWebEngineProcessName} PROPERTIES
+ MACOSX_BUNDLE TRUE
+ INSTALL_RPATH "@loader_path/../../../../../../../"
+ MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info_mac.plist.in"
+ )
+
+ target_sources(${qtWebEngineProcessName} PRIVATE QtWebEngineProcess.entitlements)
+ set_source_files_properties(QtWebEngineProcess.entitlements PROPERTIES
+ MACOSX_PACKAGE_LOCATION Resources
+ )
+ add_custom_command(TARGET ${qtWebEngineProcessName} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory
+ "$<TARGET_BUNDLE_DIR:WebEngineCore>/Versions/A/Helpers/${qtWebEngineProcessName}.app"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/Helpers"
+ "$<TARGET_BUNDLE_DIR:WebEngineCore>/Helpers"
+ USES_TERMINAL
+ )
+ install(TARGETS ${qtWebEngineProcessName}
+ BUNDLE DESTINATION "${INSTALL_LIBDIR}/QtWebEngineCore.framework/Versions/A/Helpers"
+ COMPONENT Runtime
+ )
+ qt_enable_separate_debug_info(${qtWebEngineProcessName}
+ "${INSTALL_LIBDIR}" QT_EXECUTABLE
+ DSYM_OUTPUT_DIR "${CMAKE_BINARY_DIR}/${INSTALL_LIBDIR}"
+ )
+else()
+ qt_apply_rpaths(TARGET ${qtWebEngineProcessName} INSTALL_PATH "${INSTALL_LIBEXECDIR}" RELATIVE_RPATH)
+ install(TARGETS ${qtWebEngineProcessName}
+ CONFIGURATIONS ${configs}
+ RUNTIME DESTINATION "${INSTALL_LIBEXECDIR}"
+ )
+ qt_enable_separate_debug_info(${qtWebEngineProcessName} "${INSTALL_LIBEXECDIR}" QT_EXECUTABLE)
+ qt_internal_install_pdb_files(${qtWebEngineProcessName} "${INSTALL_LIBEXECDIR}")
+endif()
+
diff --git a/src/process/Info_mac.plist b/src/process/Info_mac.plist
deleted file mode 100644
index dcadc2e8f..000000000
--- a/src/process/Info_mac.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>NSPrincipalClass</key>
- <string>NSApplication</string>
- <key>CFBundleIconFile</key>
- <string>@ICON@</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleGetInfoString</key>
- <string>Created by Qt/QMake</string>
- <key>CFBundleSignature</key>
- <string>@TYPEINFO@</string>
- <key>CFBundleExecutable</key>
- <string>@EXECUTABLE@</string>
- <key>CFBundleIdentifier</key>
- <string>org.qt-project.Qt.QtWebEngineProcess</string>
- <key>LSUIElement</key>
- <string>1</string>
-</dict>
-</plist>
diff --git a/src/process/Info_mac.plist.in b/src/process/Info_mac.plist.in
new file mode 100644
index 000000000..22c8c026d
--- /dev/null
+++ b/src/process/Info_mac.plist.in
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+
+ <key>CFBundleName</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+ <key>CFBundleExecutable</key>
+ <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+
+ <key>CFBundleVersion</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+
+ <key>LSMinimumSystemVersion</key>
+ <string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
+
+ <key>NSHumanReadableCopyright</key>
+ <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+
+ <key>CFBundleIconFile</key>
+ <string>${MACOSX_BUNDLE_ICON_FILE}</string>
+
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleAllowMixedLocalizations</key>
+ <true/>
+
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+
+ <key>NSSupportsAutomaticGraphicsSwitching</key>
+ <true/>
+ <key>LSUIElement</key>
+ <true/>
+</dict>
+</plist>
diff --git a/src/process/QtWebEngineProcess.entitlements b/src/process/QtWebEngineProcess.entitlements
index f2fbabddb..59a4b6c15 100644
--- a/src/process/QtWebEngineProcess.entitlements
+++ b/src/process/QtWebEngineProcess.entitlements
@@ -8,5 +8,7 @@
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
+ <key>com.apple.security.cs.disable-executable-page-protection</key>
+ <true/>
</dict>
</plist>
diff --git a/src/process/process.exe.manifest b/src/process/QtWebEngineProcess.exe.manifest
index 181a0e13e..181a0e13e 100644
--- a/src/process/process.exe.manifest
+++ b/src/process/QtWebEngineProcess.exe.manifest
diff --git a/src/process/main.cpp b/src/process/main.cpp
index 53596d0ee..d71ab128e 100644
--- a/src/process/main.cpp
+++ b/src/process/main.cpp
@@ -1,44 +1,7 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "process_main.h"
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+#include <QtWebEngineCore/private/qtwebenginecoreglobal_p.h>
#include <QCoreApplication>
#include <stdio.h>
#include <memory>
@@ -86,19 +49,18 @@ struct tm* localtime64_r_proxy(const time_t* timep, struct tm* result)
return sandbox::localtime64_r_override(timep, result);
}
-#endif // defined(OS_LINUX)
+#endif // defined(Q_OS_LINUX)
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN32)
namespace QtWebEngineProcess {
void initDpiAwareness();
-void initializeStaticCopy(int argc, const char **argv);
-} // namespace
-#endif // defined(Q_OS_WIN)
+}
+#endif // defined(Q_OS_WIN32)
int main(int argc, const char **argv)
{
-#ifdef Q_OS_WIN
- QtWebEngineProcess::initializeStaticCopy(argc, argv);
+#if defined(Q_OS_WIN32)
+ QtWebEngineSandbox::initializeStaticCopy(argc, argv);
QtWebEngineProcess::initDpiAwareness();
#endif
@@ -127,6 +89,12 @@ int main(int argc, const char **argv)
QCoreApplication qtApplication(argc, argv_.get());
- return QtWebEngineCore::processMain(argc, argv);
+ if (argc == 1) {
+ qInfo("%s(%s/%s)", qPrintable(qtApplication.applicationName()), qWebEngineVersion(),
+ qWebEngineChromiumVersion());
+ return 0;
+ } else {
+ return QtWebEngineCore::processMain(argc, argv);
+ }
}
diff --git a/src/process/process.pro b/src/process/process.pro
deleted file mode 100644
index a28267ee9..000000000
--- a/src/process/process.pro
+++ /dev/null
@@ -1,78 +0,0 @@
-TARGET = $$QTWEBENGINEPROCESS_NAME
-
-# Needed to set LSUIElement=1
-QMAKE_INFO_PLIST = Info_mac.plist
-
-QT_PRIVATE += core-private webenginecore-private
-
-INCLUDEPATH += ../core
-
-SOURCES = main.cpp
-
-CONFIG -= ltcg
-
-# On windows we need to statically link to the windows sandbox code
-win32 {
- # The Chromium headers we include are not clean
- CONFIG -= warnings_are_errors
-
- # Look for linking information produced by GN
- linking_pri = $$OUT_PWD/../core/$$getConfigDir()/qtwebengine_sandbox_win.pri
-
- !include($$linking_pri) {
- error("Could not find the linking information that gn should have generated.")
- }
- isEmpty(NINJA_OBJECTS): error("//sandbox/win:sandbox linking changed, update process.pro")
- isEmpty(NINJA_ARCHIVES): error("//sandbox/win:sandbox linking changed, update process.pro")
-
- LIBS_PRIVATE += $$NINJA_LIB_DIRS $$NINJA_LIBS $$NINJA_ARCHIVES $$NINJA_OBJECTS
- QMAKE_LFLAGS += $$NINJA_LFLAGS
- POST_TARGETDEPS += $$NINJA_TARGETDEPS
-
- CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir()
- INCLUDEPATH += $$CHROMIUM_SRC_DIR \
- $$OUT_PWD/../core/$$getConfigDir()/gen
-
- SOURCES += \
- support_win.cpp
-
- msvc: QMAKE_LFLAGS += /MANIFESTINPUT:$$PWD/process.exe.manifest
- VERSION = $${QT_VERSION}.0
-} else {
- VERSION = $${QT_VERSION}
-}
-
-TEMPLATE = app
-
-load(qt_build_paths)
-
-!build_pass:qtConfig(debug_and_release): CONFIG += release
-CONFIG += relative_qt_rpath
-
-qtConfig(build_all): CONFIG += build_all
-
-qtConfig(framework) {
- # Deploy the QtWebEngineProcess app bundle into the QtWebEngineCore framework.
- DESTDIR = $$MODULE_BASE_OUTDIR/lib/QtWebEngineCore.framework/Versions/5/Helpers
-
- # Deploy the entitlements file so macdeployqt can use it.
- entitlements.files = QtWebEngineProcess.entitlements
- entitlements.path = Contents/Resources/
- QMAKE_BUNDLE_DATA += entitlements
-} else {
- CONFIG -= app_bundle
- win32: DESTDIR = $$MODULE_BASE_OUTDIR/bin
- else: DESTDIR = $$MODULE_BASE_OUTDIR/libexec
-}
-msvc: QMAKE_LFLAGS *= /LARGEADDRESSAWARE
-
-qtConfig(framework) {
- target.path = $$[QT_INSTALL_LIBS]/QtWebEngineCore.framework/Versions/5/Helpers
-} else {
- target.path = $$[QT_INSTALL_LIBEXECS]
-}
-
-load(qt_targets)
-load(qt_common)
-
-INSTALLS += target
diff --git a/src/process/support_win.cpp b/src/process/support_win.cpp
index 4fe69b7a9..ab4436b47 100644
--- a/src/process/support_win.cpp
+++ b/src/process/support_win.cpp
@@ -1,53 +1,11 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include <qlibrary.h>
#include <qoperatingsystemversion.h>
#include <qsysinfo.h>
#include <qt_windows.h>
#include <TlHelp32.h>
-#include "../3rdparty/chromium/sandbox/win/src/process_mitigations.h"
-#include "../3rdparty/chromium/sandbox/win/src/sandbox_factory.h"
-
-#ifndef NDEBUG
-#include "../3rdparty/chromium/base/command_line.h"
-#endif
class User32DLL {
public:
@@ -140,45 +98,8 @@ static DWORD getParentProcessId()
return parentPid;
}
-namespace QtWebEngineCore {
-extern __declspec(dllimport) sandbox::SandboxInterfaceInfo *staticSandboxInterfaceInfo(sandbox::SandboxInterfaceInfo *info = nullptr);
-}
-
namespace QtWebEngineProcess {
-// A duplicate of the function by same name in startup_helper_win.cc
-static void InitializeSandboxInfo(sandbox::SandboxInterfaceInfo *info)
-{
- info->broker_services = sandbox::SandboxFactory::GetBrokerServices();
- if (!info->broker_services) {
- info->target_services = sandbox::SandboxFactory::GetTargetServices();
- } else {
- // Ensure the proper mitigations are enforced for the browser process.
- sandbox::ApplyProcessMitigationsToCurrentProcess(
- sandbox::MITIGATION_DEP | sandbox::MITIGATION_DEP_NO_ATL_THUNK |
- sandbox::MITIGATION_HARDEN_TOKEN_IL_POLICY);
- // Note: these mitigations are "post-startup". Some mitigations that need
- // to be enabled sooner (e.g. MITIGATION_EXTENSION_POINT_DISABLE) are done
- // so in Chrome_ELF.
- }
-}
-
-// Initializes the staticlib copy of //base and //sandbox used for Windows sandboxing
-void initializeStaticCopy(int argc, const char **argv)
-{
-#ifndef NDEBUG
- // Initialize //base for debugging
- base::CommandLine::Init(argc, argv);
- logging::LoggingSettings settings;
- settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
- logging::InitLogging(settings);
-#endif
- sandbox::SandboxInterfaceInfo *info = new sandbox::SandboxInterfaceInfo();
- memset(info, 0, sizeof(sandbox::SandboxInterfaceInfo));
- InitializeSandboxInfo(info);
- QtWebEngineCore::staticSandboxInterfaceInfo(info);
-}
-
void initDpiAwareness()
{
ShcoreDLL shcore;