summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/platform/wtf/text/text_codec.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-16 09:59:13 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-20 10:28:53 +0000
commit6c11fb357ec39bf087b8b632e2b1e375aef1b38b (patch)
treec8315530db18a8ee566521c39ab8a6af4f72bc03 /chromium/third_party/blink/renderer/platform/wtf/text/text_codec.h
parent3ffaed019d0772e59d6cdb2d0d32fe4834c31f72 (diff)
downloadqtwebengine-chromium-6c11fb357ec39bf087b8b632e2b1e375aef1b38b.tar.gz
BASELINE: Update Chromium to 74.0.3729.159
Change-Id: I8d2497da544c275415aedd94dd25328d555de811 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/wtf/text/text_codec.h')
-rw-r--r--chromium/third_party/blink/renderer/platform/wtf/text/text_codec.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/platform/wtf/text/text_codec.h b/chromium/third_party/blink/renderer/platform/wtf/text/text_codec.h
index d1316dda10d..5a9c4f69497 100644
--- a/chromium/third_party/blink/renderer/platform/wtf/text/text_codec.h
+++ b/chromium/third_party/blink/renderer/platform/wtf/text/text_codec.h
@@ -80,6 +80,11 @@ class WTF_EXPORT TextCodec {
TextCodec() = default;
virtual ~TextCodec();
+ struct EncodeIntoResult {
+ wtf_size_t code_units_read;
+ wtf_size_t bytes_written;
+ };
+
String Decode(const char* str,
wtf_size_t length,
FlushBehavior flush = FlushBehavior::kDoNotFlush) {
@@ -98,6 +103,22 @@ class WTF_EXPORT TextCodec {
virtual CString Encode(const LChar*,
wtf_size_t length,
UnencodableHandling) = 0;
+ // EncodeInto is meant only to encode UTF8 bytes into an unsigned char*
+ // buffer; therefore this method is only usefully overridden by TextCodecUTF8.
+ virtual EncodeIntoResult EncodeInto(const LChar*,
+ wtf_size_t length,
+ unsigned char* destination,
+ wtf_size_t capacity) {
+ NOTREACHED();
+ return EncodeIntoResult{0, 0};
+ }
+ virtual EncodeIntoResult EncodeInto(const UChar*,
+ wtf_size_t length,
+ unsigned char* destination,
+ wtf_size_t capacity) {
+ NOTREACHED();
+ return EncodeIntoResult{0, 0};
+ }
// Fills a null-terminated string representation of the given
// unencodable character into the given replacement buffer.