| 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 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/Allocator.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_ALLOCATION(); | 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<> struct CrossThreadCopierBase<false, false, false, DocumentEncodingDat
a> : public CrossThreadCopierPassThrough<DocumentEncodingData> { | 58 template<> struct CrossThreadCopierBase<false, false, false, DocumentEncodingDat
a> : public CrossThreadCopierPassThrough<DocumentEncodingData> { |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 inline bool operator!=(const DocumentEncodingData& a, const DocumentEncodingData
& b) | 61 inline bool operator!=(const DocumentEncodingData& a, const DocumentEncodingData
& b) |
| 62 { | 62 { |
| 63 return a.encoding() != b.encoding() | 63 return a.encoding() != b.encoding() |
| 64 || a.wasDetectedHeuristically() != b.wasDetectedHeuristically() | 64 || a.wasDetectedHeuristically() != b.wasDetectedHeuristically() |
| 65 || a.sawDecodingError() != b.sawDecodingError(); | 65 || a.sawDecodingError() != b.sawDecodingError(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace blink | 68 } // namespace blink |
| 69 | 69 |
| 70 #endif // DocumentEncodingData_h | 70 #endif // DocumentEncodingData_h |
| OLD | NEW |