| 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 f7419ab3f72edd043bdaedb25b3d5fc9aa6d5a35..b65cfad6b6ec892d1bc79b622ffebcca6b34d412 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8StringResource.h
|
| @@ -28,7 +28,6 @@
|
|
|
| #include "bindings/core/v8/ExceptionState.h"
|
| #include "core/CoreExport.h"
|
| -#include "platform/text/CompressibleString.h"
|
| #include "wtf/Allocator.h"
|
| #include "wtf/Threading.h"
|
| #include "wtf/text/AtomicString.h"
|
| @@ -63,52 +62,24 @@ public:
|
| v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(memoryConsumption(string));
|
| }
|
|
|
| - explicit WebCoreStringResourceBase(const CompressibleString& string)
|
| - : m_compressibleString(string)
|
| - {
|
| -#if ENABLE(ASSERT)
|
| - m_threadId = WTF::currentThread();
|
| -#endif
|
| - ASSERT(!string.isNull());
|
| - v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(memoryConsumption(string));
|
| - }
|
| -
|
| virtual ~WebCoreStringResourceBase()
|
| {
|
| #if ENABLE(ASSERT)
|
| ASSERT(m_threadId == WTF::currentThread());
|
| #endif
|
| - int reducedExternalMemory = 0;
|
| - if (LIKELY(m_compressibleString.isNull())) {
|
| - reducedExternalMemory = -memoryConsumption(m_plainString);
|
| - if (m_plainString.impl() != m_atomicString.impl() && !m_atomicString.isNull())
|
| - reducedExternalMemory -= memoryConsumption(m_atomicString.getString());
|
| - } else {
|
| - reducedExternalMemory = -memoryConsumption(m_compressibleString);
|
| - }
|
| + int reducedExternalMemory = -memoryConsumption(m_plainString);
|
| + if (m_plainString.impl() != m_atomicString.impl() && !m_atomicString.isNull())
|
| + reducedExternalMemory -= memoryConsumption(m_atomicString);
|
| v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(reducedExternalMemory);
|
| }
|
|
|
| - const String& webcoreString()
|
| - {
|
| - if (UNLIKELY(!m_compressibleString.isNull())) {
|
| - ASSERT(m_plainString.isNull());
|
| - ASSERT(m_atomicString.isNull());
|
| - return m_compressibleString.toString();
|
| - }
|
| - return m_plainString;
|
| - }
|
| + const String& webcoreString() { return m_plainString; }
|
|
|
| - AtomicString getAtomicString()
|
| + const AtomicString& getAtomicString()
|
| {
|
| #if ENABLE(ASSERT)
|
| ASSERT(m_threadId == WTF::currentThread());
|
| #endif
|
| - if (UNLIKELY(!m_compressibleString.isNull())) {
|
| - ASSERT(m_plainString.isNull());
|
| - ASSERT(m_atomicString.isNull());
|
| - return AtomicString(m_compressibleString.toString());
|
| - }
|
| if (m_atomicString.isNull()) {
|
| m_atomicString = AtomicString(m_plainString);
|
| ASSERT(!m_atomicString.isNull());
|
| @@ -118,8 +89,6 @@ public:
|
| return m_atomicString;
|
| }
|
|
|
| - const CompressibleString& getCompressibleString() { return m_compressibleString; }
|
| -
|
| protected:
|
| // A shallow copy of the string. Keeps the string buffer alive until the V8 engine garbage collects it.
|
| String m_plainString;
|
| @@ -130,19 +99,11 @@ protected:
|
| // into that string.
|
| AtomicString m_atomicString;
|
|
|
| - CompressibleString m_compressibleString;
|
| -
|
| private:
|
| static int memoryConsumption(const String& string)
|
| {
|
| return string.length() * (string.is8Bit() ? sizeof(LChar) : sizeof(UChar));
|
| }
|
| -
|
| - static int memoryConsumption(const CompressibleString& string)
|
| - {
|
| - return string.currentSizeInBytes();
|
| - }
|
| -
|
| #if ENABLE(ASSERT)
|
| WTF::ThreadIdentifier m_threadId;
|
| #endif
|
| @@ -192,50 +153,6 @@ public:
|
| }
|
| };
|
|
|
| -class WebCoreCompressibleStringResource16 final : public WebCoreStringResourceBase, public v8::String::ExternalStringResource {
|
| - WTF_MAKE_NONCOPYABLE(WebCoreCompressibleStringResource16);
|
| -public:
|
| - explicit WebCoreCompressibleStringResource16(const CompressibleString& string)
|
| - : WebCoreStringResourceBase(string)
|
| - {
|
| - ASSERT(!m_compressibleString.is8Bit());
|
| - }
|
| -
|
| - bool IsCompressible() const override { return true; }
|
| -
|
| - size_t length() const override
|
| - {
|
| - return m_compressibleString.length();
|
| - }
|
| -
|
| - const uint16_t* data() const override
|
| - {
|
| - return reinterpret_cast<const uint16_t*>(m_compressibleString.characters16());
|
| - }
|
| -};
|
| -
|
| -class WebCoreCompressibleStringResource8 final : public WebCoreStringResourceBase, public v8::String::ExternalOneByteStringResource {
|
| - WTF_MAKE_NONCOPYABLE(WebCoreCompressibleStringResource8);
|
| -public:
|
| - explicit WebCoreCompressibleStringResource8(const CompressibleString& string)
|
| - : WebCoreStringResourceBase(string)
|
| - {
|
| - ASSERT(m_compressibleString.is8Bit());
|
| - }
|
| -
|
| - bool IsCompressible() const override { return true; }
|
| -
|
| - size_t length() const override
|
| - {
|
| - return m_compressibleString.length();
|
| - }
|
| -
|
| - const char* data() const override
|
| - {
|
| - return reinterpret_cast<const char*>(m_compressibleString.characters8());
|
| - }
|
| -};
|
| -
|
| enum ExternalMode {
|
| Externalize,
|
| DoNotExternalize
|
|
|