Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: Source/core/html/parser/TextResourceDecoder.h

Issue 141143007: Revert of Revert "Moved text decoding to the parser thread" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1999 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 3 Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
4 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 4 Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
(...skipping 10 matching lines...) Expand all
21 */ 21 */
22 22
23 #ifndef TextResourceDecoder_h 23 #ifndef TextResourceDecoder_h
24 #define TextResourceDecoder_h 24 #define TextResourceDecoder_h
25 25
26 #include "wtf/RefCounted.h" 26 #include "wtf/RefCounted.h"
27 #include "wtf/text/TextEncoding.h" 27 #include "wtf/text/TextEncoding.h"
28 28
29 namespace WebCore { 29 namespace WebCore {
30 30
31 class DocumentEncodingData;
31 class HTMLMetaCharsetParser; 32 class HTMLMetaCharsetParser;
32 33
33 class TextResourceDecoder { 34 class TextResourceDecoder {
34 public: 35 public:
35 enum EncodingSource { 36 enum EncodingSource {
36 DefaultEncoding, 37 DefaultEncoding,
37 AutoDetectedEncoding, 38 AutoDetectedEncoding,
38 EncodingFromContentSniffing, 39 EncodingFromContentSniffing,
39 EncodingFromXMLHeader, 40 EncodingFromXMLHeader,
40 EncodingFromMetaTag, 41 EncodingFromMetaTag,
(...skipping 24 matching lines...) Expand all
65 { 66 {
66 m_hintEncoding = encoding.name(); 67 m_hintEncoding = encoding.name();
67 } 68 }
68 69
69 void useLenientXMLDecoding() { m_useLenientXMLDecoding = true; } 70 void useLenientXMLDecoding() { m_useLenientXMLDecoding = true; }
70 bool sawError() const { return m_sawError; } 71 bool sawError() const { return m_sawError; }
71 72
72 private: 73 private:
73 TextResourceDecoder(const String& mimeType, const WTF::TextEncoding& default Encoding, bool usesEncodingDetector); 74 TextResourceDecoder(const String& mimeType, const WTF::TextEncoding& default Encoding, bool usesEncodingDetector);
74 75
75 enum ContentType { PlainText, HTML, XML, CSS }; // PlainText only checks for BOM. 76 enum ContentType { PlainTextContent, HTMLContent, XMLContent, CSSContent }; // PlainText only checks for BOM.
76 static ContentType determineContentType(const String& mimeType); 77 static ContentType determineContentType(const String& mimeType);
77 static const WTF::TextEncoding& defaultEncoding(ContentType, const WTF::Text Encoding& defaultEncoding); 78 static const WTF::TextEncoding& defaultEncoding(ContentType, const WTF::Text Encoding& defaultEncoding);
78 79
79 size_t checkForBOM(const char*, size_t); 80 size_t checkForBOM(const char*, size_t);
80 bool checkForCSSCharset(const char*, size_t, bool& movedDataToBuffer); 81 bool checkForCSSCharset(const char*, size_t, bool& movedDataToBuffer);
81 bool checkForXMLCharset(const char*, size_t, bool& movedDataToBuffer); 82 bool checkForXMLCharset(const char*, size_t, bool& movedDataToBuffer);
82 void checkForMetaCharset(const char*, size_t); 83 void checkForMetaCharset(const char*, size_t);
83 void detectJapaneseEncoding(const char*, size_t); 84 void detectJapaneseEncoding(const char*, size_t);
84 bool shouldAutoDetect() const; 85 bool shouldAutoDetect() const;
85 86
(...skipping 10 matching lines...) Expand all
96 bool m_useLenientXMLDecoding; // Don't stop on XML decoding errors. 97 bool m_useLenientXMLDecoding; // Don't stop on XML decoding errors.
97 bool m_sawError; 98 bool m_sawError;
98 bool m_usesEncodingDetector; 99 bool m_usesEncodingDetector;
99 100
100 OwnPtr<HTMLMetaCharsetParser> m_charsetParser; 101 OwnPtr<HTMLMetaCharsetParser> m_charsetParser;
101 }; 102 };
102 103
103 } 104 }
104 105
105 #endif 106 #endif
OLDNEW
« no previous file with comments | « Source/core/html/parser/TextDocumentParser.cpp ('k') | Source/core/html/parser/TextResourceDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698