Diff
Modified: trunk/Source/WebCore/ChangeLog (274790 => 274791)
--- trunk/Source/WebCore/ChangeLog 2021-03-22 20:32:13 UTC (rev 274790)
+++ trunk/Source/WebCore/ChangeLog 2021-03-22 20:38:19 UTC (rev 274791)
@@ -1,3 +1,26 @@
+2021-03-22 Fujii Hironori <[email protected]>
+
+ [WinCairo] ASSERTION FAILED: isMainThread() in GPU process for some canvas/philip/tests tests
+ https://bugs.webkit.org/show_bug.cgi?id=223500
+
+ Reviewed by Alex Christensen.
+
+ Added a new member of FontPlatformData::CreationData to
+ FontCustomPlatformData struct to transfer custom fonts to GPU
+ process for WinCairo port.
+
+ * PlatformWin.cmake:
+ * platform/graphics/FontPlatformData.h:
+ * platform/graphics/win/FontCustomPlatformData.cpp:
+ (WebCore::createFontCustomPlatformData):
+ * platform/graphics/win/FontCustomPlatformData.h:
+ (WebCore::FontCustomPlatformData::FontCustomPlatformData):
+ * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
+ (WebCore::FontCustomPlatformData::fontPlatformData):
+ (WebCore::createFontCustomPlatformData):
+ * platform/graphics/win/FontPlatformDataCairoWin.cpp:
+ (WebCore::FontPlatformData::FontPlatformData):
+
2021-03-22 Youenn Fablet <[email protected]>
RealtimeMediaSource does not need to be a WeakPtr
Modified: trunk/Source/WebCore/PlatformWin.cmake (274790 => 274791)
--- trunk/Source/WebCore/PlatformWin.cmake 2021-03-22 20:32:13 UTC (rev 274790)
+++ trunk/Source/WebCore/PlatformWin.cmake 2021-03-22 20:38:19 UTC (rev 274791)
@@ -113,6 +113,7 @@
page/win/FrameWin.h
platform/graphics/win/DIBPixelData.h
+ platform/graphics/win/FontCustomPlatformData.h
platform/graphics/win/FullScreenController.h
platform/graphics/win/FullScreenControllerClient.h
platform/graphics/win/LocalWindowsContext.h
Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (274790 => 274791)
--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2021-03-22 20:32:13 UTC (rev 274790)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h 2021-03-22 20:38:19 UTC (rev 274791)
@@ -122,7 +122,7 @@
FontPlatformData(GDIObject<HFONT>&&, COMPtr<IDWriteFont>&&, float size, bool syntheticBold, bool syntheticOblique, bool useGDI);
#endif
#if USE(CAIRO)
- FontPlatformData(GDIObject<HFONT>, cairo_font_face_t*, float size, bool bold, bool italic);
+ FontPlatformData(GDIObject<HFONT>, cairo_font_face_t*, float size, bool bold, bool italic, CreationData* = nullptr);
#endif
#endif
Modified: trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp (274790 => 274791)
--- trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp 2021-03-22 20:32:13 UTC (rev 274790)
+++ trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp 2021-03-22 20:38:19 UTC (rev 274791)
@@ -111,7 +111,7 @@
fontReference = renameAndActivateFont(buffer, fontName);
if (!fontReference)
return nullptr;
- auto result = makeUnique<FontCustomPlatformData>(fontReference, fontName);
+ auto result = makeUnique<FontCustomPlatformData>(fontReference, fontName, { });
#if USE(CORE_TEXT)
result->fontDescriptor = adoptCF(CTFontManagerCreateFontDescriptorFromData(buffer.createCFData().get()));
#endif
Modified: trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h (274790 => 274791)
--- trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h 2021-03-22 20:32:13 UTC (rev 274790)
+++ trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h 2021-03-22 20:38:19 UTC (rev 274791)
@@ -21,6 +21,7 @@
#ifndef FontCustomPlatformData_h
#define FontCustomPlatformData_h
+#include "FontPlatformData.h"
#include "TextFlags.h"
#include <windows.h>
#include <wtf/Forward.h>
@@ -36,7 +37,6 @@
namespace WebCore {
class FontDescription;
-class FontPlatformData;
class SharedBuffer;
struct FontSelectionSpecifiedCapabilities;
struct FontVariantSettings;
@@ -48,9 +48,10 @@
WTF_MAKE_FAST_ALLOCATED;
WTF_MAKE_NONCOPYABLE(FontCustomPlatformData);
public:
- FontCustomPlatformData(HANDLE fontReference, const String& name)
+ FontCustomPlatformData(HANDLE fontReference, const String& name, FontPlatformData::CreationData&& creationData)
: fontReference(fontReference)
, name(name)
+ , creationData(WTFMove(creationData))
{
}
@@ -65,6 +66,7 @@
#if USE(CORE_TEXT)
RetainPtr<CTFontDescriptorRef> fontDescriptor;
#endif
+ FontPlatformData::CreationData creationData;
};
std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer&, const String&);
Modified: trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp (274790 => 274791)
--- trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp 2021-03-22 20:32:13 UTC (rev 274790)
+++ trunk/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp 2021-03-22 20:38:19 UTC (rev 274791)
@@ -66,7 +66,7 @@
cairo_font_face_t* fontFace = cairo_win32_font_face_create_for_hfont(hfont.get());
- FontPlatformData fontPlatformData(WTFMove(hfont), fontFace, size, bold, italic);
+ FontPlatformData fontPlatformData(WTFMove(hfont), fontFace, size, bold, italic, &creationData);
cairo_font_face_destroy(fontFace);
@@ -83,7 +83,7 @@
return fontName;
}
-std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer& buffer, const String&)
+std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffer& buffer, const String& itemInCollection)
{
String fontName = createUniqueFontName();
HANDLE fontReference = renameAndActivateFont(buffer, fontName);
@@ -91,7 +91,8 @@
if (!fontReference)
return nullptr;
- return makeUnique<FontCustomPlatformData>(fontReference, fontName);
+ FontPlatformData::CreationData creationData = { buffer, itemInCollection };
+ return makeUnique<FontCustomPlatformData>(fontReference, fontName, WTFMove(creationData));
}
bool FontCustomPlatformData::supportsFormat(const String& format)
Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp (274790 => 274791)
--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp 2021-03-22 20:32:13 UTC (rev 274790)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataCairoWin.cpp 2021-03-22 20:38:19 UTC (rev 274791)
@@ -60,11 +60,11 @@
m_isSystemFont = !wcscmp(faceName, L"Lucida Grande");
}
-FontPlatformData::FontPlatformData(GDIObject<HFONT> font, cairo_font_face_t* fontFace, float size, bool bold, bool oblique)
- : m_font(SharedGDIObject<HFONT>::create(WTFMove(font)))
- , m_size(size)
- , m_syntheticOblique(oblique)
+FontPlatformData::FontPlatformData(GDIObject<HFONT> font, cairo_font_face_t* fontFace, float size, bool bold, bool oblique, CreationData* creationData)
+ : FontPlatformData(size, bold, oblique, FontOrientation::Horizontal, FontWidthVariant::RegularWidth, TextRenderingMode::AutoTextRendering, creationData)
{
+ m_font = SharedGDIObject<HFONT>::create(WTFMove(font));
+
cairo_matrix_t fontMatrix;
cairo_matrix_init_scale(&fontMatrix, size, size);
cairo_matrix_t ctm;
Modified: trunk/Source/WebKit/ChangeLog (274790 => 274791)
--- trunk/Source/WebKit/ChangeLog 2021-03-22 20:32:13 UTC (rev 274790)
+++ trunk/Source/WebKit/ChangeLog 2021-03-22 20:38:19 UTC (rev 274791)
@@ -1,3 +1,32 @@
+2021-03-22 Fujii Hironori <[email protected]>
+
+ [WinCairo] ASSERTION FAILED: isMainThread() in GPU process for some canvas/philip/tests tests
+ https://bugs.webkit.org/show_bug.cgi?id=223500
+
+ Reviewed by Alex Christensen.
+
+ In WinCairo GPU process mode, WebCore::Font IPC decoder was using
+ FontCache::fontForFamily that should be called only in the main
+ thread. However, It is was called in IPC thread. Reimplemented the
+ decoder without using FontCache::fontForFamily.
+
+ Encode LOGFONT for WebCore::Font, and decode it and create a font
+ directly from it.
+
+ This change also encodes and decodes the
+ FontPlatformData::CreationData of custom fonts. However, custom
+ fonts still don't work in GPU process mode because
+ FontCustomPlatformData is destructed soon. In non-GPU process
+ mode, FontCustomPlatformData is retained by CachedFont. In GPU
+ process mode, fontReference of FontCustomPlatformData should be
+ refcounted and retained by WebCore::Font.
+
+ * Shared/win/WebCoreArgumentCodersWin.cpp:
+ (IPC::ArgumentCoder<LOGFONT>::encode):
+ (IPC::ArgumentCoder<LOGFONT>::decode):
+ (IPC::ArgumentCoder<Ref<Font>>::encodePlatformData):
+ (IPC::ArgumentCoder<Ref<Font>>::decodePlatformData):
+
2021-03-22 Per Arne <[email protected]>
Allow additional fcntl
Modified: trunk/Source/WebKit/Shared/win/WebCoreArgumentCodersWin.cpp (274790 => 274791)
--- trunk/Source/WebKit/Shared/win/WebCoreArgumentCodersWin.cpp 2021-03-22 20:32:13 UTC (rev 274790)
+++ trunk/Source/WebKit/Shared/win/WebCoreArgumentCodersWin.cpp 2021-03-22 20:38:19 UTC (rev 274791)
@@ -29,6 +29,7 @@
#include <WebCore/Font.h>
#include <WebCore/FontAttributes.h>
#include <WebCore/FontCache.h>
+#include <WebCore/FontCustomPlatformData.h>
#include <WebCore/FontDescription.h>
#include <wtf/win/GDIObject.h>
@@ -47,35 +48,41 @@
return WTF::nullopt;
}
+template<> struct ArgumentCoder<LOGFONT> {
+ static void encode(Encoder& encoder, const LOGFONT& logFont)
+ {
+ encoder.encodeFixedLengthData(reinterpret_cast<const uint8_t*>(&logFont), sizeof logFont, 1);
+ }
+ static Optional<LOGFONT> decode(Decoder& decoder)
+ {
+ LOGFONT logFont;
+ if (!decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(&logFont), sizeof(logFont), 1))
+ return WTF::nullopt;
+ return logFont;
+ }
+};
+
void ArgumentCoder<Ref<Font>>::encodePlatformData(Encoder& encoder, const Ref<Font>& font)
{
const auto& platformData = font->platformData();
- encoder << platformData.orientation();
- encoder << platformData.widthVariant();
- encoder << platformData.textRenderingMode();
encoder << platformData.size();
encoder << platformData.syntheticBold();
encoder << platformData.syntheticOblique();
- encoder << platformData.familyName();
+
+ const auto& creationData = platformData.creationData();
+ encoder << static_cast<bool>(creationData);
+ if (creationData) {
+ encoder << creationData->fontFaceData;
+ encoder << creationData->itemInCollection;
+ }
+
+ LOGFONT logFont;
+ GetObject(platformData.hfont(), sizeof logFont, &logFont);
+ encoder << logFont;
}
Optional<FontPlatformData> ArgumentCoder<Ref<Font>>::decodePlatformData(Decoder& decoder)
{
- Optional<FontOrientation> orientation;
- decoder >> orientation;
- if (!orientation.hasValue())
- return WTF::nullopt;
-
- Optional<FontWidthVariant> widthVariant;
- decoder >> widthVariant;
- if (!widthVariant.hasValue())
- return WTF::nullopt;
-
- Optional<TextRenderingMode> textRenderingMode;
- decoder >> textRenderingMode;
- if (!textRenderingMode.hasValue())
- return WTF::nullopt;
-
Optional<float> size;
decoder >> size;
if (!size.hasValue())
@@ -91,26 +98,41 @@
if (!syntheticOblique.hasValue())
return WTF::nullopt;
- Optional<String> familyName;
- decoder >> familyName;
- if (!familyName.hasValue())
+ Optional<bool> includesCreationData;
+ decoder >> includesCreationData;
+ if (!includesCreationData.hasValue())
return WTF::nullopt;
- FontDescription description;
- description.setOrientation(*orientation);
- description.setWidthVariant(*widthVariant);
- description.setTextRenderingMode(*textRenderingMode);
- description.setComputedSize(*size);
- RefPtr<Font> font = FontCache::singleton().fontForFamily(description, *familyName);
- if (!font)
+ std::unique_ptr<FontCustomPlatformData> fontCustomPlatformData;
+
+ if (includesCreationData.value()) {
+ Optional<Ref<SharedBuffer>> fontFaceData;
+ decoder >> fontFaceData;
+ if (!fontFaceData.hasValue())
+ return WTF::nullopt;
+
+ Optional<String> itemInCollection;
+ decoder >> itemInCollection;
+ if (!itemInCollection.hasValue())
+ return WTF::nullopt;
+
+ fontCustomPlatformData = createFontCustomPlatformData(fontFaceData.value(), itemInCollection.value());
+ if (!fontCustomPlatformData)
+ return WTF::nullopt;
+ }
+
+ Optional<LOGFONT> logFont;
+ decoder >> logFont;
+ if (!logFont.hasValue())
return WTF::nullopt;
+
+ if (fontCustomPlatformData)
+ wcscpy_s(logFont->lfFaceName, LF_FACESIZE, fontCustomPlatformData->name.wideCharacters().data());
- LOGFONT logFont;
- GetObject(font->platformData().hfont(), sizeof logFont, &logFont);
- auto gdiFont = adoptGDIObject(CreateFontIndirect(&logFont));
+ auto gdiFont = adoptGDIObject(CreateFontIndirect(&*logFont));
if (!gdiFont)
return WTF::nullopt;
-
+
return FontPlatformData(WTFMove(gdiFont), *size, *syntheticBold, *syntheticOblique, false);
}