Index: third_party/WebKit/Source/bindings/core/v8/V8StringResource.h |
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h b/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h |
index 65b12efe12a28b11cce0376f64cda85c6c0288ba..d13e29ef81de9e9b401b7831b5b1094abf5926b7 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h |
+++ b/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h |
@@ -31,6 +31,7 @@ |
#include "wtf/Allocator.h" |
#include "wtf/Threading.h" |
#include "wtf/text/AtomicString.h" |
+#include "wtf/text/CompressableString.h" |
#include <v8.h> |
namespace blink { |
@@ -153,6 +154,54 @@ public: |
} |
}; |
+class WebCoreCompressableStringResource16 final : public v8::String::ExternalStringResource { |
+ WTF_MAKE_NONCOPYABLE(WebCoreCompressableStringResource16); |
+public: |
+ explicit WebCoreCompressableStringResource16(RefPtrWillBeRawPtr<CompressableString> string) |
+ : m_string(string) |
+ { |
+ ASSERT(m_string); |
+ ASSERT(!m_string->is8Bit()); |
+ } |
+ |
+ size_t length() const override |
+ { |
+ return m_string->length(); |
+ } |
+ |
+ const uint16_t* data() const override |
+ { |
+ return reinterpret_cast<const uint16_t*>(m_string->toString().characters16()); |
+ } |
+ |
+private: |
+ RefPtrWillBeMember<CompressableString> m_string; |
+}; |
+ |
+class WebCoreCompressableStringResource8 final : public v8::String::ExternalOneByteStringResource { |
+ WTF_MAKE_NONCOPYABLE(WebCoreCompressableStringResource8); |
+public: |
+ explicit WebCoreCompressableStringResource8(RefPtrWillBeRawPtr<CompressableString> string) |
+ : m_string(string) |
+ { |
+ ASSERT(m_string); |
+ ASSERT(m_string->is8Bit()); |
+ } |
+ |
+ size_t length() const override |
+ { |
+ return m_string->length(); |
+ } |
+ |
+ const char* data() const override |
+ { |
+ return reinterpret_cast<const char*>(m_string->toString().characters8()); |
+ } |
+ |
+private: |
+ RefPtrWillBeMember<CompressableString> m_string; |
+}; |
+ |
enum ExternalMode { |
Externalize, |
DoNotExternalize |