Chromium Code Reviews| Index: third_party/WebKit/Source/wtf/text/CompressableString.h |
| diff --git a/third_party/WebKit/Source/wtf/text/CompressableString.h b/third_party/WebKit/Source/wtf/text/CompressableString.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4a3ac8abf7f687e030833dbf9bad386f21f2f866 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/wtf/text/CompressableString.h |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CompressableString_h |
| +#define CompressableString_h |
| + |
| +#include "wtf/text/Unicode.h" |
| +#include "wtf/text/WTFString.h" |
| + |
| +namespace WTF { |
| + |
| +class WTF_EXPORT CompressableString : public RefCounted<CompressableString> { |
| +public: |
| + static PassRefPtr<CompressableString> create(const String&); |
| + |
| + unsigned length() const; |
| + bool isEmpty() const; |
| + bool isCompressed() const { return m_isCompressed; } |
| + bool is8Bit() const; |
| + 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.
|
| + |
| + String toString(); |
| + |
| +private: |
| + CompressableString(); |
| + explicit CompressableString(const String&); |
| + |
| + void uncompress(); |
| + |
| + 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.
|
| + RefPtr<StringImpl> m_impl; |
| + const unsigned m_originalLength; |
| + const bool m_is8Bit; |
| +}; |
| + |
| +} // namespace WTF |
| + |
| +using WTF::CompressableString; |
| + |
| +#endif |