diff options
Diffstat (limited to 'src/core/chromium_overrides.cpp')
| -rw-r--r-- | src/core/chromium_overrides.cpp | 93 |
1 files changed, 55 insertions, 38 deletions
diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 3830c8683..b75e5a5e6 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -9,10 +9,12 @@ #include "base/values.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/browser/web_contents/web_contents_view.h" #include "content/common/font_list.h" -#include "gpu/vulkan/buildflags.h" +#include "content/public/browser/web_contents_view_delegate.h" #include "extensions/buildflags/buildflags.h" #include "extensions/common/constants.h" +#include "gpu/vulkan/buildflags.h" #include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/dragdrop/os_exchange_data_provider_factory.h" @@ -20,43 +22,36 @@ #include <QFontDatabase> #include <QLibraryInfo> -#if BUILDFLAG(ENABLE_VULKAN) -#include "gpu/vulkan/init/vulkan_factory.h" -#endif - #if !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) #include "chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.h" #endif +#if BUILDFLAG(ENABLE_VULKAN) +#include "compositor/vulkan_implementation_qt.h" + +#include "gpu/vulkan/init/vulkan_factory.h" + +#if defined(USE_OZONE) +#include "ui/ozone/public/ozone_platform.h" +#include "ui/ozone/public/surface_factory_ozone.h" +#endif // defined(USE_OZONE) +#endif // defined(ENABLE_VULKAN) + void *GetQtXDisplay() { return GLContextHelper::getXDisplay(); } -#if BUILDFLAG(ENABLE_VULKAN) -namespace gpu { -std::unique_ptr<VulkanImplementation> CreateVulkanImplementation(bool use_swiftshader, - bool allow_protected_memory) -{ - NOTIMPLEMENTED(); - return nullptr; -} -} // namespace gpu - -#endif - namespace content { -class WebContentsView; -class WebContentsViewDelegate; class RenderViewHostDelegateView; -WebContentsView* CreateWebContentsView(WebContentsImpl *web_contents, - WebContentsViewDelegate *, +std::unique_ptr<WebContentsView> CreateWebContentsView(WebContentsImpl *web_contents, + std::unique_ptr<WebContentsViewDelegate> delegate, RenderViewHostDelegateView **render_view_host_delegate_view) { QtWebEngineCore::WebContentsViewQt* rv = new QtWebEngineCore::WebContentsViewQt(web_contents); *render_view_host_delegate_view = rv; - return rv; + return std::unique_ptr<WebContentsView>(rv); } #if defined(Q_OS_DARWIN) @@ -79,36 +74,58 @@ base::FilePath getSandboxPath() namespace content { // content/common/font_list.h -std::unique_ptr<base::ListValue> GetFontList_SlowBlocking() +base::Value::List GetFontList_SlowBlocking() { - std::unique_ptr<base::ListValue> font_list(new base::ListValue); + base::Value::List font_list; for (auto family : QFontDatabase::families()){ - std::unique_ptr<base::ListValue> font_item(new base::ListValue()); - font_item->Append(family.toStdString()); - font_item->Append(family.toStdString()); // localized name. + base::Value::List font_item; + font_item.Append(family.toStdString()); + font_item.Append(family.toStdString()); // localized name. // TODO(yusukes): Support localized family names. - font_list->Append(std::move(font_item)); + font_list.Append(std::move(font_item)); } return font_list; } } // namespace content +#endif // defined(USE_AURA) || defined(USE_OZONE) -namespace aura { -class Window; -} +#if BUILDFLAG(ENABLE_VULKAN) +namespace gpu { +std::unique_ptr<VulkanImplementation> CreateVulkanImplementation(bool use_swiftshader, + bool allow_protected_memory) +{ +#if QT_CONFIG(webengine_vulkan) +#if BUILDFLAG(IS_APPLE) + // TODO: Investigate if we can support MoltenVK. + NOTIMPLEMENTED(); + return nullptr; +#else +#if defined(USE_OZONE) + return ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone()->CreateVulkanImplementation( + use_swiftshader, allow_protected_memory); +#endif -namespace wm { -class ActivationClient; +#if !BUILDFLAG(IS_WIN) + // TODO(samans): Support Swiftshader on more platforms. + // https://crbug.com/963988 + DCHECK(!use_swiftshader) << "Vulkan Swiftshader is not supported on this platform."; +#endif // !BUILDFLAG(IS_WIN) -ActivationClient *GetActivationClient(aura::Window *) -{ + // Protected memory is supported only on Fuchsia, which uses Ozone, i.e. + // VulkanImplementation is initialized above. + DCHECK(!allow_protected_memory) << "Protected memory is not supported on this platform."; + + return std::make_unique<VulkanImplementationQt>(); +#endif // BUILDFLAG(IS_APPLE) +#else + NOTREACHED(); return nullptr; +#endif // QT_CONFIG(webengine_vulkan) } - -} // namespace wm -#endif // defined(USE_AURA) || defined(USE_OZONE) +} // namespace gpu +#endif // BUILDFLAG(ENABLE_VULKAN) std::unique_ptr<ui::OSExchangeDataProvider> ui::OSExchangeDataProviderFactory::CreateProvider() { |
