Index: third_party/WebKit/Source/bindings/core/v8/V8StringResource.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8StringResource.cpp b/third_party/WebKit/Source/bindings/core/v8/V8StringResource.cpp |
index a3d51c99a7cffe26b14c255ae334807e9d4aaa9f..70149e9ac82963a895f3c9470e9f2892542fac4d 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/V8StringResource.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/V8StringResource.cpp |
@@ -38,7 +38,7 @@ template<class StringClass> struct StringTraits { |
template<> |
struct StringTraits<String> { |
- static const String& fromStringResource(WebCoreStringResourceBase* resource) |
+ static String fromStringResource(WebCoreStringResourceBase* resource) |
{ |
return resource->webcoreString(); |
} |
@@ -48,7 +48,7 @@ struct StringTraits<String> { |
template<> |
struct StringTraits<AtomicString> { |
- static const AtomicString& fromStringResource(WebCoreStringResourceBase* resource) |
+ static AtomicString fromStringResource(WebCoreStringResourceBase* resource) |
{ |
return resource->atomicString(); |
} |
@@ -107,10 +107,17 @@ StringType v8StringToWebCoreString(v8::Local<v8::String> v8String, ExternalMode |
v8::String::ExternalStringResourceBase* resource = v8String->GetExternalStringResourceBase(&encoding); |
if (LIKELY(!!resource)) { |
WebCoreStringResourceBase* base; |
- if (encoding == v8::String::ONE_BYTE_ENCODING) |
- base = static_cast<WebCoreStringResource8*>(resource); |
- else |
- base = static_cast<WebCoreStringResource16*>(resource); |
+ if (UNLIKELY(resource->IsCompressible())) { |
+ if (encoding == v8::String::ONE_BYTE_ENCODING) |
+ base = static_cast<WebCoreCompressibleStringResource8*>(resource); |
+ else |
+ base = static_cast<WebCoreCompressibleStringResource16*>(resource); |
+ } else { |
+ if (encoding == v8::String::ONE_BYTE_ENCODING) |
+ base = static_cast<WebCoreStringResource8*>(resource); |
+ else |
+ base = static_cast<WebCoreStringResource16*>(resource); |
+ } |
return StringTraits<StringType>::fromStringResource(base); |
} |
} |