| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #define TextDecoder_h | 32 #define TextDecoder_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h" | 34 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h" |
| 35 #include "bindings/core/v8/ScriptWrappable.h" | 35 #include "bindings/core/v8/ScriptWrappable.h" |
| 36 #include "modules/encoding/TextDecodeOptions.h" | 36 #include "modules/encoding/TextDecodeOptions.h" |
| 37 #include "modules/encoding/TextDecoderOptions.h" | 37 #include "modules/encoding/TextDecoderOptions.h" |
| 38 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 39 #include "wtf/text/TextCodec.h" | 39 #include "wtf/text/TextCodec.h" |
| 40 #include "wtf/text/TextEncoding.h" | 40 #include "wtf/text/TextEncoding.h" |
| 41 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
| 42 #include <memory> |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 class ExceptionState; | 46 class ExceptionState; |
| 46 | 47 |
| 47 typedef ArrayBufferOrArrayBufferView BufferSource; | 48 typedef ArrayBufferOrArrayBufferView BufferSource; |
| 48 | 49 |
| 49 class TextDecoder final : public GarbageCollectedFinalized<TextDecoder>, public
ScriptWrappable { | 50 class TextDecoder final : public GarbageCollectedFinalized<TextDecoder>, public
ScriptWrappable { |
| 50 DEFINE_WRAPPERTYPEINFO(); | 51 DEFINE_WRAPPERTYPEINFO(); |
| 51 public: | 52 public: |
| 52 static TextDecoder* create(const String& label, const TextDecoderOptions&, E
xceptionState&); | 53 static TextDecoder* create(const String& label, const TextDecoderOptions&, E
xceptionState&); |
| 53 ~TextDecoder(); | 54 ~TextDecoder(); |
| 54 | 55 |
| 55 // Implement the IDL | 56 // Implement the IDL |
| 56 String encoding() const; | 57 String encoding() const; |
| 57 bool fatal() const { return m_fatal; } | 58 bool fatal() const { return m_fatal; } |
| 58 bool ignoreBOM() const { return m_ignoreBOM; } | 59 bool ignoreBOM() const { return m_ignoreBOM; } |
| 59 String decode(const BufferSource&, const TextDecodeOptions&, ExceptionState&
); | 60 String decode(const BufferSource&, const TextDecodeOptions&, ExceptionState&
); |
| 60 String decode(ExceptionState&); | 61 String decode(ExceptionState&); |
| 61 | 62 |
| 62 DEFINE_INLINE_TRACE() { } | 63 DEFINE_INLINE_TRACE() { } |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 TextDecoder(const WTF::TextEncoding&, bool fatal, bool ignoreBOM); | 66 TextDecoder(const WTF::TextEncoding&, bool fatal, bool ignoreBOM); |
| 66 | 67 |
| 67 String decode(const char* start, size_t length, const TextDecodeOptions&, Ex
ceptionState&); | 68 String decode(const char* start, size_t length, const TextDecodeOptions&, Ex
ceptionState&); |
| 68 | 69 |
| 69 WTF::TextEncoding m_encoding; | 70 WTF::TextEncoding m_encoding; |
| 70 OwnPtr<WTF::TextCodec> m_codec; | 71 std::unique_ptr<WTF::TextCodec> m_codec; |
| 71 bool m_fatal; | 72 bool m_fatal; |
| 72 bool m_ignoreBOM; | 73 bool m_ignoreBOM; |
| 73 bool m_bomSeen; | 74 bool m_bomSeen; |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 } // namespace blink | 77 } // namespace blink |
| 77 | 78 |
| 78 #endif // TextDecoder_h | 79 #endif // TextDecoder_h |
| OLD | NEW |