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> | |
43 | 42 |
44 namespace blink { | 43 namespace blink { |
45 | 44 |
46 class ExceptionState; | 45 class ExceptionState; |
47 | 46 |
48 typedef ArrayBufferOrArrayBufferView BufferSource; | 47 typedef ArrayBufferOrArrayBufferView BufferSource; |
49 | 48 |
50 class TextDecoder final : public GarbageCollectedFinalized<TextDecoder>, public
ScriptWrappable { | 49 class TextDecoder final : public GarbageCollectedFinalized<TextDecoder>, public
ScriptWrappable { |
51 DEFINE_WRAPPERTYPEINFO(); | 50 DEFINE_WRAPPERTYPEINFO(); |
52 public: | 51 public: |
53 static TextDecoder* create(const String& label, const TextDecoderOptions&, E
xceptionState&); | 52 static TextDecoder* create(const String& label, const TextDecoderOptions&, E
xceptionState&); |
54 ~TextDecoder(); | 53 ~TextDecoder(); |
55 | 54 |
56 // Implement the IDL | 55 // Implement the IDL |
57 String encoding() const; | 56 String encoding() const; |
58 bool fatal() const { return m_fatal; } | 57 bool fatal() const { return m_fatal; } |
59 bool ignoreBOM() const { return m_ignoreBOM; } | 58 bool ignoreBOM() const { return m_ignoreBOM; } |
60 String decode(const BufferSource&, const TextDecodeOptions&, ExceptionState&
); | 59 String decode(const BufferSource&, const TextDecodeOptions&, ExceptionState&
); |
61 String decode(ExceptionState&); | 60 String decode(ExceptionState&); |
62 | 61 |
63 DEFINE_INLINE_TRACE() { } | 62 DEFINE_INLINE_TRACE() { } |
64 | 63 |
65 private: | 64 private: |
66 TextDecoder(const WTF::TextEncoding&, bool fatal, bool ignoreBOM); | 65 TextDecoder(const WTF::TextEncoding&, bool fatal, bool ignoreBOM); |
67 | 66 |
68 String decode(const char* start, size_t length, const TextDecodeOptions&, Ex
ceptionState&); | 67 String decode(const char* start, size_t length, const TextDecodeOptions&, Ex
ceptionState&); |
69 | 68 |
70 WTF::TextEncoding m_encoding; | 69 WTF::TextEncoding m_encoding; |
71 std::unique_ptr<WTF::TextCodec> m_codec; | 70 OwnPtr<WTF::TextCodec> m_codec; |
72 bool m_fatal; | 71 bool m_fatal; |
73 bool m_ignoreBOM; | 72 bool m_ignoreBOM; |
74 bool m_bomSeen; | 73 bool m_bomSeen; |
75 }; | 74 }; |
76 | 75 |
77 } // namespace blink | 76 } // namespace blink |
78 | 77 |
79 #endif // TextDecoder_h | 78 #endif // TextDecoder_h |
OLD | NEW |