Implement TextEncoder()'s encodeInto method

This CL implements the encodeInto method on the TextEncoder interface,
which encodes a string into a given pre-allocated Uint8Array. This CL
introduces an EncodeInto() method to TextCodecUTF8, which acts similar to
EncodeCommon(), however is bound by a given capacity, and also outputs
the number of converted UTF16 code units. EncodeInto() is called via an
overloaded TextCodec::Encode() method, which is meant only to be implemented
in TextCodecUTF8 (since that is only where EncodeInto() is used).

Intent to Implement and Ship:!topic/blink-dev/vTNMrsScW1g,,

Bug: 920107
Change-Id: I178f927e837833731049c4867c0eb71e90d369cc
Reviewed-by: Adam Rice <>
Reviewed-by: Joshua Bell <>
Reviewed-by: Yoav Weiss <>
Reviewed-by: Kinuko Yasuda <>
Commit-Queue: Dominic Farolino <>
Cr-Commit-Position: refs/heads/master@{#631002}
24 files changed