OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CompressibleString_h | 5 #ifndef CompressibleString_h |
6 #define CompressibleString_h | 6 #define CompressibleString_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "wtf/text/Unicode.h" | 9 #include "wtf/text/Unicode.h" |
10 #include "wtf/text/WTFString.h" | 10 #include "wtf/text/WTFString.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 // TODO(hajimehoshi): Now these classes are in platform/text to use UMA. Move | 14 // TODO(hajimehoshi): Now these classes are in platform/text to use UMA. Move |
15 // them to wtf/text. | 15 // them to wtf/text. |
16 | 16 |
17 class PLATFORM_EXPORT CompressibleStringImpl final : public RefCounted<Compressi
bleStringImpl> { | 17 class PLATFORM_EXPORT CompressibleStringImpl final : public RefCounted<Compressi
bleStringImpl> { |
18 WTF_MAKE_NONCOPYABLE(CompressibleStringImpl); | 18 WTF_MAKE_NONCOPYABLE(CompressibleStringImpl); |
19 public: | 19 public: |
20 static void compressAll(); | 20 static void compressAll(); |
21 static void setPageBackground(bool); | |
22 | 21 |
23 CompressibleStringImpl() | 22 CompressibleStringImpl() |
24 : m_string() | 23 : m_string() |
25 , m_isCompressed(false) | 24 , m_isCompressed(false) |
26 { | 25 { |
27 } | 26 } |
28 | 27 |
29 explicit CompressibleStringImpl(PassRefPtr<StringImpl>); | 28 explicit CompressibleStringImpl(PassRefPtr<StringImpl>); |
30 ~CompressibleStringImpl(); | 29 ~CompressibleStringImpl(); |
31 | 30 |
(...skipping 30 matching lines...) Expand all Loading... |
62 | 61 |
63 const UChar* characters16() | 62 const UChar* characters16() |
64 { | 63 { |
65 return toString().characters16(); | 64 return toString().characters16(); |
66 } | 65 } |
67 | 66 |
68 void compressString(); | 67 void compressString(); |
69 void decompressString(); | 68 void decompressString(); |
70 | 69 |
71 private: | 70 private: |
72 static bool s_isPageBackground; | |
73 | |
74 String m_string; | 71 String m_string; |
75 bool m_isCompressed; | 72 bool m_isCompressed; |
76 }; | 73 }; |
77 | 74 |
78 class PLATFORM_EXPORT CompressibleString final { | 75 class PLATFORM_EXPORT CompressibleString final { |
79 public: | 76 public: |
80 CompressibleString() | 77 CompressibleString() |
81 : m_impl(nullptr) | 78 : m_impl(nullptr) |
82 { | 79 { |
83 } | 80 } |
(...skipping 29 matching lines...) Expand all Loading... |
113 | 110 |
114 mutable RefPtr<CompressibleStringImpl> m_impl; | 111 mutable RefPtr<CompressibleStringImpl> m_impl; |
115 }; | 112 }; |
116 | 113 |
117 } // namespace blink | 114 } // namespace blink |
118 | 115 |
119 using blink::CompressibleString; | 116 using blink::CompressibleString; |
120 using blink::CompressibleStringImpl; | 117 using blink::CompressibleStringImpl; |
121 | 118 |
122 #endif | 119 #endif |
OLD | NEW |