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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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" | |
35 #include "wtf/Allocator.h" | 34 #include "wtf/Allocator.h" |
| 35 #include "wtf/CrossThreadCopier.h" |
36 #include "wtf/text/TextEncoding.h" | 36 #include "wtf/text/TextEncoding.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 class TextResourceDecoder; | 39 class TextResourceDecoder; |
40 | 40 |
41 class DocumentEncodingData { | 41 class DocumentEncodingData { |
42 DISALLOW_NEW(); | 42 DISALLOW_NEW(); |
43 public: | 43 public: |
44 DocumentEncodingData(); | 44 DocumentEncodingData(); |
45 explicit DocumentEncodingData(const TextResourceDecoder&); | 45 explicit DocumentEncodingData(const TextResourceDecoder&); |
46 | 46 |
47 const WTF::TextEncoding& encoding() const { return m_encoding; } | 47 const WTF::TextEncoding& encoding() const { return m_encoding; } |
48 void setEncoding(const WTF::TextEncoding&); | 48 void setEncoding(const WTF::TextEncoding&); |
49 bool wasDetectedHeuristically() const { return m_wasDetectedHeuristically; } | 49 bool wasDetectedHeuristically() const { return m_wasDetectedHeuristically; } |
50 bool sawDecodingError() const { return m_sawDecodingError; } | 50 bool sawDecodingError() const { return m_sawDecodingError; } |
51 | 51 |
52 private: | 52 private: |
53 WTF::TextEncoding m_encoding; | 53 WTF::TextEncoding m_encoding; |
54 bool m_wasDetectedHeuristically; | 54 bool m_wasDetectedHeuristically; |
55 bool m_sawDecodingError; | 55 bool m_sawDecodingError; |
56 }; | 56 }; |
57 | 57 |
58 template <> | |
59 struct CrossThreadCopier<DocumentEncodingData> : public CrossThreadCopierPassThr
ough<DocumentEncodingData> { | |
60 }; | |
61 | |
62 inline bool operator!=(const DocumentEncodingData& a, const DocumentEncodingData
& b) | 58 inline bool operator!=(const DocumentEncodingData& a, const DocumentEncodingData
& b) |
63 { | 59 { |
64 return a.encoding() != b.encoding() | 60 return a.encoding() != b.encoding() |
65 || a.wasDetectedHeuristically() != b.wasDetectedHeuristically() | 61 || a.wasDetectedHeuristically() != b.wasDetectedHeuristically() |
66 || a.sawDecodingError() != b.sawDecodingError(); | 62 || a.sawDecodingError() != b.sawDecodingError(); |
67 } | 63 } |
68 | 64 |
69 } // namespace blink | 65 } // namespace blink |
70 | 66 |
| 67 namespace WTF { |
| 68 |
| 69 template <> |
| 70 struct CrossThreadCopier<blink::DocumentEncodingData> : public CrossThreadCopier
PassThrough<blink::DocumentEncodingData> { |
| 71 }; |
| 72 |
| 73 } // namespace WTF |
| 74 |
71 #endif // DocumentEncodingData_h | 75 #endif // DocumentEncodingData_h |
OLD | NEW |