diff options
Diffstat (limited to 'Source/WebCore/loader/TextResourceDecoder.h')
-rw-r--r-- | Source/WebCore/loader/TextResourceDecoder.h | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/Source/WebCore/loader/TextResourceDecoder.h b/Source/WebCore/loader/TextResourceDecoder.h index e51f1f7a8..98ec9257a 100644 --- a/Source/WebCore/loader/TextResourceDecoder.h +++ b/Source/WebCore/loader/TextResourceDecoder.h @@ -20,8 +20,7 @@ */ -#ifndef TextResourceDecoder_h -#define TextResourceDecoder_h +#pragma once #include "TextEncoding.h" #include <wtf/RefCounted.h> @@ -43,17 +42,21 @@ public: EncodingFromParentFrame }; - static PassRefPtr<TextResourceDecoder> create(const String& mimeType, const TextEncoding& defaultEncoding = TextEncoding(), bool usesEncodingDetector = false) + static Ref<TextResourceDecoder> create(const String& mimeType, const TextEncoding& defaultEncoding = TextEncoding(), bool usesEncodingDetector = false) { - return adoptRef(new TextResourceDecoder(mimeType, defaultEncoding, usesEncodingDetector)); + return adoptRef(*new TextResourceDecoder(mimeType, defaultEncoding, usesEncodingDetector)); } - ~TextResourceDecoder(); + WEBCORE_EXPORT ~TextResourceDecoder(); void setEncoding(const TextEncoding&, EncodingSource); const TextEncoding& encoding() const { return m_encoding; } - String decode(const char* data, size_t length); - String flush(); + bool hasEqualEncodingForCharset(const String&) const; + + WEBCORE_EXPORT String decode(const char* data, size_t length); + WEBCORE_EXPORT String flush(); + + WEBCORE_EXPORT String decodeAndFlush(const char* data, size_t length); void setHintEncoding(const TextResourceDecoder* hintDecoder) { @@ -67,7 +70,7 @@ public: bool sawError() const { return m_sawError; } private: - TextResourceDecoder(const String& mimeType, const TextEncoding& defaultEncoding, bool usesEncodingDetector); + WEBCORE_EXPORT TextResourceDecoder(const String& mimeType, const TextEncoding& defaultEncoding, bool usesEncodingDetector); enum ContentType { PlainText, HTML, XML, CSS }; // PlainText only checks for BOM. static ContentType determineContentType(const String& mimeType); @@ -82,7 +85,7 @@ private: ContentType m_contentType; TextEncoding m_encoding; - OwnPtr<TextCodec> m_codec; + std::unique_ptr<TextCodec> m_codec; EncodingSource m_source; const char* m_hintEncoding; Vector<char> m_buffer; @@ -96,6 +99,4 @@ private: std::unique_ptr<HTMLMetaCharsetParser> m_charsetParser; }; -} - -#endif +} // namespace WebCore |