Looks overall reasonable to me. Just some smaller comments.
MaybeEmitMetaCharsetTraceEvent();Maybe you could move this to `UpdateDocument`?
Document* document = GetDocument();
if (!document) {
return;
}
LocalFrame* frame = document->GetFrame();
if (!frame) {
return;
}Perhaps move these above the switch()?
kBytesToCheckUnconditionallyHmm. Feels a little weird to have a named constant that happens to be 1024, combined with the explicit 1024 in these enums. Perhaps you could just add a static_assert here that kBytesToCheckUnconditionally is 1024, and a comment to do something about that if someone breaks the assert?
enum class MetaCharsetDisposition {We shouldn't have the same enum class in two places.
TextResourceDecoder::MetaCharsetDisposition ToMetaCharsetDisposition(
HTMLMetaCharsetParser::MetaCharsetDisposition parser_disposition) {
switch (parser_disposition) {
case HTMLMetaCharsetParser::MetaCharsetDisposition::kUnknown:
return TextResourceDecoder::MetaCharsetDisposition::kUnknown;
case HTMLMetaCharsetParser::MetaCharsetDisposition::kFoundInFirst1024Bytes:
return TextResourceDecoder::MetaCharsetDisposition::
kFoundInFirst1024Bytes;
case HTMLMetaCharsetParser::MetaCharsetDisposition::
kFoundAfterFirst1024Bytes:
return TextResourceDecoder::MetaCharsetDisposition::
kFoundAfterFirst1024Bytes;
case HTMLMetaCharsetParser::MetaCharsetDisposition::kNotFound:
return TextResourceDecoder::MetaCharsetDisposition::kNotFound;
}
return TextResourceDecoder::MetaCharsetDisposition::kUnknown;Any way to combine them to avoid this?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |