From b5e07b716d76419a02dde9827f367500d686760b Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Tue, 28 Mar 2023 10:11:00 +0200 Subject: Fix v8 context snapshot generator compilation Add missing overrides. Change-Id: I5d5a8b6522eca9bb7511a6533abb4cdedcf1fd33 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/470769 Reviewed-by: Allan Sandfeld Jensen --- chromium/gin/v8_initializer.cc | 2 +- chromium/tools/v8_context_snapshot/BUILD.gn | 6 +- chromium/tools/v8_context_snapshot/qt_overrides.cc | 146 +++++++++++++++++++++ 3 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 chromium/tools/v8_context_snapshot/qt_overrides.cc diff --git a/chromium/gin/v8_initializer.cc b/chromium/gin/v8_initializer.cc index c7fcbcd71ce..4099e81d1e8 100644 --- a/chromium/gin/v8_initializer.cc +++ b/chromium/gin/v8_initializer.cc @@ -121,7 +121,7 @@ void GetV8FilePath(const char* file_name, base::FilePath* path_out) { // This is the path within the .apk. *path_out = base::FilePath(FILE_PATH_LITERAL("assets")).AppendASCII(file_name); -#elif BUILDFLAG(IS_MAC) +#elif BUILDFLAG(IS_MAC) && !defined(TOOLKIT_QT) base::ScopedCFTypeRef bundle_resource( base::SysUTF8ToCFStringRef(file_name)); *path_out = base::mac::PathForFrameworkBundleResource(bundle_resource); diff --git a/chromium/tools/v8_context_snapshot/BUILD.gn b/chromium/tools/v8_context_snapshot/BUILD.gn index 33a147bd79f..84aa15eb6a0 100644 --- a/chromium/tools/v8_context_snapshot/BUILD.gn +++ b/chromium/tools/v8_context_snapshot/BUILD.gn @@ -101,13 +101,17 @@ if (use_v8_context_snapshot) { } executable("v8_context_snapshot_generator") { - sources = [ "v8_context_snapshot_generator.cc" ] + sources = [ + "v8_context_snapshot_generator.cc", + "qt_overrides.cc" + ] deps = [ "//gin:gin", "//mojo/core/embedder", "//services/service_manager/public/cpp", "//third_party/blink/public:blink", + "//content/public/common:static_switches", "//v8", ] diff --git a/chromium/tools/v8_context_snapshot/qt_overrides.cc b/chromium/tools/v8_context_snapshot/qt_overrides.cc new file mode 100644 index 00000000000..926d633762e --- /dev/null +++ b/chromium/tools/v8_context_snapshot/qt_overrides.cc @@ -0,0 +1,146 @@ +// Copyright (C) 2023 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 "build/build_config.h" +#include "gpu/vulkan/buildflags.h" + +#include "ui/gl/gl_bindings.h" +#include "ui/gl/gl_context.h" +#include "ui/gl/gl_display.h" +#include "ui/gl/gl_surface.h" + +#if BUILDFLAG(IS_LINUX) +#include "ui/gl/gl_surface_egl.h" +#include "ui/gl/gl_surface_glx.h" +#endif + +#include "ui/base/dragdrop/os_exchange_data_provider_factory.h" +#include "ui/base/pointer/pointer_device.h" +#include "ui/base/resource/resource_bundle.h" + +#if BUILDFLAG(ENABLE_VULKAN) +#include "gpu/vulkan/init/vulkan_factory.h" +#endif + +#if BUILDFLAG(IS_LINUX) +void* GetQtXDisplay() { + return nullptr; +} + +namespace gl { +DisplayType GLDisplayEGL::GetDisplayType() const { + return DisplayType::DEFAULT; +} +GLDisplayEGL* GLSurfaceEGL::GetGLDisplayEGL() { + return nullptr; +} +GLDisplayEGL* GLDisplayEGL::GetDisplayForCurrentContext() { + return nullptr; +} +bool GLDisplayEGL::IsAndroidNativeFenceSyncSupported() { + return false; +} +bool GLDisplayEGL::IsEGLContextPrioritySupported() { + return false; +} +bool GLDisplayEGL::InitializeExtensionSettings() { + return false; +} +bool GLSurfaceGLX::IsCreateContextRobustnessSupported() { + return false; +} +bool GLSurfaceGLX::IsRobustnessVideoMemoryPurgeSupported() { + return false; +} +bool GLSurfaceGLX::IsCreateContextProfileSupported() { + return false; +} +bool GLSurfaceGLX::IsCreateContextES2ProfileSupported() { + return false; +} +bool GLSurfaceGLX::IsCreateContextSupported() { + return false; +} +bool GLSurfaceGLX::InitializeExtensionSettingsOneOff() { + return false; +} +std::string DisplayExtensionsEGL::GetPlatformExtensions(EGLDisplay) { + return std::string(); +} +} // namespace gl +#endif // BUILDFLAG(IS_LINUX) + +#if BUILDFLAG(IS_WIN) +namespace gl { +class GLShareGroup; +class GLContextAttribs; +namespace init { + +scoped_refptr CreateGLContext(GLShareGroup* share_group, + GLSurface* compatible_surface, + const GLContextAttribs& attribs) { + return nullptr; +} +GLDisplay* InitializeGLOneOffPlatform(uint64_t system_device_id) { + return nullptr; +} +bool usingSoftwareDynamicGL() { + return false; +} +scoped_refptr CreateOffscreenGLSurfaceWithFormat( + GLDisplay* display, + const gfx::Size& size, + GLSurfaceFormat format) { + return nullptr; +} +scoped_refptr CreateViewGLSurface(GLDisplay* display, + gfx::AcceleratedWidget window) { + return nullptr; +} +} // namespace init +} // namespace gl + +#endif // BUILDFLAG(IS_WIN) + +namespace ui { +class OzonePlatform; +OzonePlatform* CreateOzonePlatformQt() { + return nullptr; +} +std::unique_ptr +OSExchangeDataProviderFactory::CreateProvider() { + return nullptr; +} +bool ResourceBundle::LocaleDataPakExists(const std::string& locale) { + return false; +} +std::string ResourceBundle::LoadLocaleResources(const std::string& pref_locale, + bool crash_on_failure) { + return std::string(); +} +void ResourceBundle::LoadCommonResources() {} +int GetAvailablePointerTypes() { + return POINTER_TYPE_NONE; +} +int GetAvailableHoverTypes() { + return HOVER_TYPE_NONE; +} + +namespace gfx { +class ClientNativePixmapFactory; +} +gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryQt() { + return nullptr; +} +} // namespace ui + +#if BUILDFLAG(ENABLE_VULKAN) +namespace gpu { +std::unique_ptr CreateVulkanImplementation( + bool use_swiftshader, + bool allow_protected_memory) { + return nullptr; +} +} +#endif // BUILDFLAG(ENABLE_VULKAN) -- cgit v1.2.1