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

Unified Diff: third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp

Issue 2786913002: Replace the type of hint url for blink::detectTextEncoding (Closed)
Patch Set: const KURL& Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp
index f71d434f81a8bbf8769ab05a36ed1bd8df942b07..0e20dbebc89de3228330e72fc4d3512658779694 100644
--- a/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp
+++ b/third_party/WebKit/Source/core/html/parser/TextResourceDecoder.cpp
@@ -142,12 +142,12 @@ TextResourceDecoder::TextResourceDecoder(
const String& mimeType,
const WTF::TextEncoding& specifiedDefaultEncoding,
EncodingDetectionOption encodingDetectionOption,
- const String& url)
+ const KURL& hintUrl)
: m_contentType(determineContentType(mimeType)),
m_encoding(defaultEncoding(m_contentType, specifiedDefaultEncoding)),
m_source(DefaultEncoding),
m_hintEncoding(0),
- m_hintUrl(url.utf8()),
+ m_hintUrl(hintUrl),
m_checkedForBOM(false),
m_checkedForCSSCharset(false),
m_checkedForXMLCharset(false),
@@ -161,7 +161,7 @@ TextResourceDecoder::TextResourceDecoder(
} else if (m_encodingDetectionOption == UseAllAutoDetection) {
// Checking empty URL helps unit testing. Providing defaultLanguage() is
// sometimes difficult in tests.
- if (!url.isEmpty()) {
+ if (!hintUrl.isEmpty()) {
// This object is created in the main thread, but used in another thread.
// We should not share an AtomicString.
AtomicString locale = defaultLanguage();
@@ -472,8 +472,8 @@ String TextResourceDecoder::decode(const char* data, size_t len) {
if (shouldAutoDetect()) {
WTF::TextEncoding detectedEncoding;
- if (detectTextEncoding(data, len, m_hintEncoding, m_hintUrl.data(),
- m_hintLanguage, &detectedEncoding))
+ if (detectTextEncoding(data, len, m_hintEncoding, m_hintUrl, m_hintLanguage,
+ &detectedEncoding))
setEncoding(detectedEncoding, EncodingFromContentSniffing);
}
@@ -500,7 +500,7 @@ String TextResourceDecoder::flush() {
(!m_checkedForCSSCharset && (m_contentType == CSSContent)))) {
WTF::TextEncoding detectedEncoding;
if (detectTextEncoding(m_buffer.data(), m_buffer.size(), m_hintEncoding,
- m_hintUrl.data(), m_hintLanguage, &detectedEncoding))
+ m_hintUrl, m_hintLanguage, &detectedEncoding))
setEncoding(detectedEncoding, EncodingFromContentSniffing);
}

Powered by Google App Engine
This is Rietveld 408576698