mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This CL generated by |sed -i '/sky\/engine\/config.h/d'| and a manual sweep to catch some oddballs. TBR=eseidel@chromium.org Review URL: https://codereview.chromium.org/1206763002.
44 lines
996 B
C++
44 lines
996 B
C++
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "sky/engine/core/html/parser/TextResourceDecoder.h"
|
|
|
|
#include "sky/engine/wtf/text/TextCodec.h"
|
|
#include "sky/engine/wtf/text/TextEncodingRegistry.h"
|
|
|
|
namespace blink {
|
|
|
|
TextResourceDecoder::TextResourceDecoder()
|
|
: m_sawError(false)
|
|
{
|
|
}
|
|
|
|
TextResourceDecoder::~TextResourceDecoder()
|
|
{
|
|
}
|
|
|
|
const WTF::TextEncoding& TextResourceDecoder::encoding() const
|
|
{
|
|
return WTF::UTF8Encoding();
|
|
}
|
|
|
|
String TextResourceDecoder::decode(const char* data, size_t len)
|
|
{
|
|
if (!m_codec)
|
|
m_codec = newTextCodec(encoding());
|
|
return m_codec->decode(data, len, WTF::DoNotFlush, false, m_sawError);
|
|
}
|
|
|
|
String TextResourceDecoder::flush()
|
|
{
|
|
if (!m_codec)
|
|
m_codec = newTextCodec(encoding());
|
|
|
|
String result = m_codec->decode(0, 0, WTF::FetchEOF, false, m_sawError);
|
|
m_codec.clear();
|
|
return result;
|
|
}
|
|
|
|
}
|