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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef DocumentEncodingData_h | 31 #ifndef DocumentEncodingData_h |
32 #define DocumentEncodingData_h | 32 #define DocumentEncodingData_h |
33 | 33 |
34 #include "platform/CrossThreadCopier.h" | 34 #include "platform/CrossThreadCopier.h" |
| 35 #include "wtf/Allocator.h" |
35 #include "wtf/text/TextEncoding.h" | 36 #include "wtf/text/TextEncoding.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 class TextResourceDecoder; | 39 class TextResourceDecoder; |
39 | 40 |
40 class DocumentEncodingData { | 41 class DocumentEncodingData { |
| 42 DISALLOW_ALLOCATION(); |
41 public: | 43 public: |
42 DocumentEncodingData(); | 44 DocumentEncodingData(); |
43 explicit DocumentEncodingData(const TextResourceDecoder&); | 45 explicit DocumentEncodingData(const TextResourceDecoder&); |
44 | 46 |
45 const WTF::TextEncoding& encoding() const { return m_encoding; } | 47 const WTF::TextEncoding& encoding() const { return m_encoding; } |
46 void setEncoding(const WTF::TextEncoding&); | 48 void setEncoding(const WTF::TextEncoding&); |
47 bool wasDetectedHeuristically() const { return m_wasDetectedHeuristically; } | 49 bool wasDetectedHeuristically() const { return m_wasDetectedHeuristically; } |
48 bool sawDecodingError() const { return m_sawDecodingError; } | 50 bool sawDecodingError() const { return m_sawDecodingError; } |
49 | 51 |
50 private: | 52 private: |
51 WTF::TextEncoding m_encoding; | 53 WTF::TextEncoding m_encoding; |
52 bool m_wasDetectedHeuristically; | 54 bool m_wasDetectedHeuristically; |
53 bool m_sawDecodingError; | 55 bool m_sawDecodingError; |
54 }; | 56 }; |
55 | 57 |
56 template<> struct CrossThreadCopierBase<false, false, false, DocumentEncodingDat
a> : public CrossThreadCopierPassThrough<DocumentEncodingData> { | 58 template<> struct CrossThreadCopierBase<false, false, false, DocumentEncodingDat
a> : public CrossThreadCopierPassThrough<DocumentEncodingData> { |
57 }; | 59 }; |
58 | 60 |
59 inline bool operator!=(const DocumentEncodingData& a, const DocumentEncodingData
& b) | 61 inline bool operator!=(const DocumentEncodingData& a, const DocumentEncodingData
& b) |
60 { | 62 { |
61 return a.encoding() != b.encoding() | 63 return a.encoding() != b.encoding() |
62 || a.wasDetectedHeuristically() != b.wasDetectedHeuristically() | 64 || a.wasDetectedHeuristically() != b.wasDetectedHeuristically() |
63 || a.sawDecodingError() != b.sawDecodingError(); | 65 || a.sawDecodingError() != b.sawDecodingError(); |
64 } | 66 } |
65 | 67 |
66 } // namespace blink | 68 } // namespace blink |
67 | 69 |
68 #endif // DocumentEncodingData_h | 70 #endif // DocumentEncodingData_h |
OLD | NEW |