Skip to content

Commit

Permalink
Revert "Cherry-pick 7d0bddb. rdar://110454455"
Browse files Browse the repository at this point in the history
This reverts commit 1d3a1c1.

Identifier: 267815.312@safari-7617.1.11.13-branch
  • Loading branch information
MyahCobbs committed Oct 16, 2023
1 parent 1d3a1c1 commit b098d2f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
3 changes: 1 addition & 2 deletions Source/WebCore/PAL/pal/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ PAL_EXPORT void registerNotifyCallback(ASCIILiteral, Function<void()>&&);
#endif

#define PAL_LOG_CHANNELS(M) \
M(Media) \
M(TextEncoding)
M(Media)

#undef DECLARE_LOG_CHANNEL
#define DECLARE_LOG_CHANNEL(name) \
Expand Down
7 changes: 1 addition & 6 deletions Source/WebCore/PAL/pal/text/TextCodecUTF8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,10 @@ void TextCodecUTF8::registerEncodingNames(EncodingNameRegistrar registrar)
registrar("x-unicode20utf8", "UTF-8");
}

std::unique_ptr<TextCodecUTF8> TextCodecUTF8::codec()
{
return makeUnique<TextCodecUTF8>();
}

void TextCodecUTF8::registerCodecs(TextCodecRegistrar registrar)
{
registrar("UTF-8", [] {
return codec();
return makeUnique<TextCodecUTF8>();
});
}

Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/PAL/pal/text/TextCodecUTF8.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class TextCodecUTF8 final : public TextCodec {
static void registerCodecs(TextCodecRegistrar);

static Vector<uint8_t> encodeUTF8(StringView);
static std::unique_ptr<TextCodecUTF8> codec();

private:
void stripByteOrderMark() final { m_shouldStripByteOrderMark = true; }
Expand Down
14 changes: 1 addition & 13 deletions Source/WebCore/PAL/pal/text/TextEncodingRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "config.h"
#include "TextEncodingRegistry.h"

#include "Logging.h"
#include "TextCodecCJK.h"
#include "TextCodecICU.h"
#include "TextCodecLatin1.h"
Expand Down Expand Up @@ -255,19 +254,8 @@ std::unique_ptr<TextCodec> newTextCodec(const TextEncoding& encoding)
Locker locker { encodingRegistryLock };

ASSERT(textCodecMap);
if (!encoding.isValid()) {
RELEASE_LOG_ERROR(TextEncoding, "Trying to create new text codec with invalid (null) encoding name. Will default to UTF-8.");
return TextCodecUTF8::codec();
}
auto result = textCodecMap->find(encoding.name());
if (result == textCodecMap->end()) {
RELEASE_LOG_ERROR(TextEncoding, "Can't find codec for valid encoding %" PUBLIC_LOG_STRING ". Will default to UTF-8.", encoding.name());
return TextCodecUTF8::codec();
}
if (!result->value) {
RELEASE_LOG_ERROR(TextEncoding, "Codec for encoding %" PUBLIC_LOG_STRING " is null. Will default to UTF-8", encoding.name());
return TextCodecUTF8::codec();
}
ASSERT(result != textCodecMap->end());
return result->value();
}

Expand Down

0 comments on commit b098d2f

Please sign in to comment.