Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CompressableString_h | |
| 6 #define CompressableString_h | |
| 7 | |
| 8 #include "wtf/text/Unicode.h" | |
| 9 #include "wtf/text/WTFString.h" | |
| 10 | |
| 11 namespace WTF { | |
| 12 | |
| 13 class WTF_EXPORT CompressableString : public RefCounted<CompressableString> { | |
| 14 public: | |
| 15 static PassRefPtr<CompressableString> create(const String&); | |
| 16 | |
| 17 unsigned length() const; | |
| 18 bool isEmpty() const; | |
| 19 bool isCompressed() const { return m_isCompressed; } | |
| 20 bool is8Bit() const; | |
| 21 void compress(); | |
|
esprehn
2015/10/24 03:59:26
Why is compress() public? Why would a caller ever
hajimehoshi
2015/10/26 09:34:03
Done.
| |
| 22 | |
| 23 String toString(); | |
| 24 | |
| 25 private: | |
| 26 CompressableString(); | |
| 27 explicit CompressableString(const String&); | |
| 28 | |
| 29 void uncompress(); | |
| 30 | |
| 31 bool m_isCompressed; | |
|
haraken
2015/10/22 16:03:31
Move this boolean to below m_is8Bit (to save sizeo
esprehn
2015/10/24 03:59:26
You need to also combine them with a bitfield for
hajimehoshi
2015/10/26 09:34:03
Done.
| |
| 32 RefPtr<StringImpl> m_impl; | |
| 33 const unsigned m_originalLength; | |
| 34 const bool m_is8Bit; | |
| 35 }; | |
| 36 | |
| 37 } // namespace WTF | |
| 38 | |
| 39 using WTF::CompressableString; | |
| 40 | |
| 41 #endif | |
| OLD | NEW |