Title: [135488] trunk/Source/WebCore
Revision
135488
Author
[email protected]
Date
2012-11-22 00:13:10 -0800 (Thu, 22 Nov 2012)

Log Message

Unreviewed, rolling out r135482.
http://trac.webkit.org/changeset/135482
https://bugs.webkit.org/show_bug.cgi?id=103002

It broke Chrome/Linux Debug build

* bindings/v8/V8StringResource.cpp:
* bindings/v8/V8StringResource.h:
* bindings/v8/V8ValueCache.cpp:
(WebCore::WebCoreStringResourceBase::toWebCoreStringResourceBase):
(WebCore):
(WebCore::WebCoreStringResourceBase::visitStrings):
* bindings/v8/V8ValueCache.h:
(WebCore):
(WebCoreStringResourceBase):
(WebCore::WebCoreStringResourceBase::WebCoreStringResourceBase):
(WebCore::WebCoreStringResourceBase::~WebCoreStringResourceBase):
(WebCore::WebCoreStringResourceBase::webcoreString):
(WebCore::WebCoreStringResourceBase::atomicString):
(WebCore::WebCoreStringResourceBase::memoryConsumption):
(WebCoreStringResource16):
(WebCore::WebCoreStringResource16::WebCoreStringResource16):
(WebCoreStringResource8):
(WebCore::WebCoreStringResource8::WebCoreStringResource8):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135487 => 135488)


--- trunk/Source/WebCore/ChangeLog	2012-11-22 08:09:25 UTC (rev 135487)
+++ trunk/Source/WebCore/ChangeLog	2012-11-22 08:13:10 UTC (rev 135488)
@@ -1,3 +1,30 @@
+2012-11-22  Kentaro Hara  <[email protected]>
+
+        Unreviewed, rolling out r135482.
+        http://trac.webkit.org/changeset/135482
+        https://bugs.webkit.org/show_bug.cgi?id=103002
+
+        It broke Chrome/Linux Debug build
+
+        * bindings/v8/V8StringResource.cpp:
+        * bindings/v8/V8StringResource.h:
+        * bindings/v8/V8ValueCache.cpp:
+        (WebCore::WebCoreStringResourceBase::toWebCoreStringResourceBase):
+        (WebCore):
+        (WebCore::WebCoreStringResourceBase::visitStrings):
+        * bindings/v8/V8ValueCache.h:
+        (WebCore):
+        (WebCoreStringResourceBase):
+        (WebCore::WebCoreStringResourceBase::WebCoreStringResourceBase):
+        (WebCore::WebCoreStringResourceBase::~WebCoreStringResourceBase):
+        (WebCore::WebCoreStringResourceBase::webcoreString):
+        (WebCore::WebCoreStringResourceBase::atomicString):
+        (WebCore::WebCoreStringResourceBase::memoryConsumption):
+        (WebCoreStringResource16):
+        (WebCore::WebCoreStringResource16::WebCoreStringResource16):
+        (WebCoreStringResource8):
+        (WebCore::WebCoreStringResource8::WebCoreStringResource8):
+
 2012-11-22  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r134927 and r134944.

Modified: trunk/Source/WebCore/bindings/v8/V8StringResource.cpp (135487 => 135488)


--- trunk/Source/WebCore/bindings/v8/V8StringResource.cpp	2012-11-22 08:09:25 UTC (rev 135487)
+++ trunk/Source/WebCore/bindings/v8/V8StringResource.cpp	2012-11-22 08:13:10 UTC (rev 135488)
@@ -26,29 +26,10 @@
 #include "config.h"
 #include "V8StringResource.h"
 
-#include "BindingVisitors.h"
 #include "V8Binding.h"
 
 namespace WebCore {
 
-WebCoreStringResourceBase* WebCoreStringResourceBase::toWebCoreStringResourceBase(v8::Handle<v8::String> string)
-{
-    v8::String::Encoding encoding;
-    v8::String::ExternalStringResourceBase* resource = string->GetExternalStringResourceBase(&encoding);
-    if (!resource)
-        return 0;
-    if (encoding == v8::String::ASCII_ENCODING)
-        return static_cast<WebCoreStringResource8*>(resource);
-    return static_cast<WebCoreStringResource16*>(resource);
-}
-
-void WebCoreStringResourceBase::visitStrings(ExternalStringVisitor* visitor)
-{
-    visitor->visitJSExternalString(m_plainString.impl());
-    if (m_plainString.impl() != m_atomicString.impl() && !m_atomicString.isNull())
-        visitor->visitJSExternalString(m_atomicString.impl());
-}
-
 template<class StringClass> struct StringTraits {
     static const StringClass& fromStringResource(WebCoreStringResourceBase*);
     static bool is16BitAtomicString(StringClass&);

Modified: trunk/Source/WebCore/bindings/v8/V8StringResource.h (135487 => 135488)


--- trunk/Source/WebCore/bindings/v8/V8StringResource.h	2012-11-22 08:09:25 UTC (rev 135487)
+++ trunk/Source/WebCore/bindings/v8/V8StringResource.h	2012-11-22 08:13:10 UTC (rev 135488)
@@ -32,108 +32,6 @@
 
 namespace WebCore {
 
-class ExternalStringVisitor;
-
-// WebCoreStringResource is a helper class for v8ExternalString. It is used
-// to manage the life-cycle of the underlying buffer of the external string.
-class WebCoreStringResourceBase {
-public:
-    static WebCoreStringResourceBase* toWebCoreStringResourceBase(v8::Handle<v8::String>);
-
-    explicit WebCoreStringResourceBase(const String& string)
-        : m_plainString(string)
-    {
-#ifndef NDEBUG
-        m_threadId = WTF::currentThread();
-#endif
-        ASSERT(!string.isNull());
-        v8::V8::AdjustAmountOfExternalAllocatedMemory(memoryConsumption(string));
-    }
-
-    explicit WebCoreStringResourceBase(const AtomicString& string)
-        : m_plainString(string.string())
-        , m_atomicString(string)
-    {
-#ifndef NDEBUG
-        m_threadId = WTF::currentThread();
-#endif
-        ASSERT(!string.isNull());
-        v8::V8::AdjustAmountOfExternalAllocatedMemory(memoryConsumption(string));
-    }
-
-    virtual ~WebCoreStringResourceBase()
-    {
-#ifndef NDEBUG
-        ASSERT(m_threadId == WTF::currentThread());
-#endif
-        int reducedExternalMemory = -memoryConsumption(m_plainString);
-        if (m_plainString.impl() != m_atomicString.impl() && !m_atomicString.isNull())
-            reducedExternalMemory -= memoryConsumption(m_atomicString.string());
-        v8::V8::AdjustAmountOfExternalAllocatedMemory(reducedExternalMemory);
-    }
-
-    const String& webcoreString() { return m_plainString; }
-
-    const AtomicString& atomicString()
-    {
-#ifndef NDEBUG
-        ASSERT(m_threadId == WTF::currentThread());
-#endif
-        if (m_atomicString.isNull()) {
-            m_atomicString = AtomicString(m_plainString);
-            ASSERT(!m_atomicString.isNull());
-            if (m_plainString.impl() != m_atomicString.impl())
-                v8::V8::AdjustAmountOfExternalAllocatedMemory(memoryConsumption(m_atomicString.string()));
-        }
-        return m_atomicString;
-    }
-
-    void visitStrings(ExternalStringVisitor*);
-
-protected:
-    // A shallow copy of the string. Keeps the string buffer alive until the V8 engine garbage collects it.
-    String m_plainString;
-    // If this string is atomic or has been made atomic earlier the
-    // atomic string is held here. In the case where the string starts
-    // off non-atomic and becomes atomic later it is necessary to keep
-    // the original string alive because v8 may keep derived pointers
-    // into that string.
-    AtomicString m_atomicString;
-
-private:
-    static int memoryConsumption(const String& string)
-    {
-        return string.length() * (string.is8Bit() ? sizeof(LChar) : sizeof(UChar));
-    }
-#ifndef NDEBUG
-    WTF::ThreadIdentifier m_threadId;
-#endif
-};
-
-class WebCoreStringResource16 : public WebCoreStringResourceBase, public v8::String::ExternalStringResource {
-public:
-    explicit WebCoreStringResource16(const String& string) : WebCoreStringResourceBase(string) { }
-    explicit WebCoreStringResource16(const AtomicString& string) : WebCoreStringResourceBase(string) { }
-
-    virtual size_t length() const OVERRIDE { return m_plainString.impl()->length(); }
-    virtual const uint16_t* data() const OVERRIDE
-    {
-        return reinterpret_cast<const uint16_t*>(m_plainString.impl()->characters());
-    }
-};
-
-class WebCoreStringResource8 : public WebCoreStringResourceBase, public v8::String::ExternalAsciiStringResource {
-public:
-    explicit WebCoreStringResource8(const String& string) : WebCoreStringResourceBase(string) { }
-    explicit WebCoreStringResource8(const AtomicString& string) : WebCoreStringResourceBase(string) { }
-
-    virtual size_t length() const OVERRIDE { return m_plainString.impl()->length(); }
-    virtual const char* data() const OVERRIDE
-    {
-        return reinterpret_cast<const char*>(m_plainString.impl()->characters8());
-    }
-};
-
 enum ExternalMode {
     Externalize,
     DoNotExternalize

Modified: trunk/Source/WebCore/bindings/v8/V8ValueCache.cpp (135487 => 135488)


--- trunk/Source/WebCore/bindings/v8/V8ValueCache.cpp	2012-11-22 08:09:25 UTC (rev 135487)
+++ trunk/Source/WebCore/bindings/v8/V8ValueCache.cpp	2012-11-22 08:13:10 UTC (rev 135488)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "V8ValueCache.h"
 
+#include "BindingVisitors.h"
 #include "V8Binding.h"
 
 namespace WebCore {
@@ -100,6 +101,24 @@
     return newString;
 }
 
+WebCoreStringResourceBase* WebCoreStringResourceBase::toWebCoreStringResourceBase(v8::Handle<v8::String> string)
+{
+    v8::String::Encoding encoding;
+    v8::String::ExternalStringResourceBase* resource = string->GetExternalStringResourceBase(&encoding);
+    if (!resource)
+        return 0;
+    if (encoding == v8::String::ASCII_ENCODING)
+        return static_cast<WebCoreStringResource8*>(resource);
+    return static_cast<WebCoreStringResource16*>(resource);
+}
+
+void WebCoreStringResourceBase::visitStrings(ExternalStringVisitor* visitor)
+{
+    visitor->visitJSExternalString(m_plainString.impl());
+    if (m_plainString.impl() != m_atomicString.impl() && !m_atomicString.isNull())
+        visitor->visitJSExternalString(m_atomicString.impl());
+}
+
 void IntegerCache::createSmallIntegers(v8::Isolate* isolate)
 {
     ASSERT(!m_initialized);

Modified: trunk/Source/WebCore/bindings/v8/V8ValueCache.h (135487 => 135488)


--- trunk/Source/WebCore/bindings/v8/V8ValueCache.h	2012-11-22 08:09:25 UTC (rev 135487)
+++ trunk/Source/WebCore/bindings/v8/V8ValueCache.h	2012-11-22 08:13:10 UTC (rev 135488)
@@ -34,6 +34,8 @@
 
 namespace WebCore {
 
+class ExternalStringVisitor;
+
 class StringCache {
 public:
     StringCache() { }
@@ -68,6 +70,106 @@
 
 const int numberOfCachedSmallIntegers = 64;
 
+// WebCoreStringResource is a helper class for v8ExternalString. It is used
+// to manage the life-cycle of the underlying buffer of the external string.
+class WebCoreStringResourceBase {
+public:
+    static WebCoreStringResourceBase* toWebCoreStringResourceBase(v8::Handle<v8::String>);
+
+    explicit WebCoreStringResourceBase(const String& string)
+        : m_plainString(string)
+    {
+#ifndef NDEBUG
+        m_threadId = WTF::currentThread();
+#endif
+        ASSERT(!string.isNull());
+        v8::V8::AdjustAmountOfExternalAllocatedMemory(memoryConsumption(string));
+    }
+
+    explicit WebCoreStringResourceBase(const AtomicString& string)
+        : m_plainString(string.string())
+        , m_atomicString(string)
+    {
+#ifndef NDEBUG
+        m_threadId = WTF::currentThread();
+#endif
+        ASSERT(!string.isNull());
+        v8::V8::AdjustAmountOfExternalAllocatedMemory(memoryConsumption(string));
+    }
+
+    virtual ~WebCoreStringResourceBase()
+    {
+#ifndef NDEBUG
+        ASSERT(m_threadId == WTF::currentThread());
+#endif
+        int reducedExternalMemory = -memoryConsumption(m_plainString);
+        if (m_plainString.impl() != m_atomicString.impl() && !m_atomicString.isNull())
+            reducedExternalMemory -= memoryConsumption(m_atomicString.string());
+        v8::V8::AdjustAmountOfExternalAllocatedMemory(reducedExternalMemory);
+    }
+
+    const String& webcoreString() { return m_plainString; }
+
+    const AtomicString& atomicString()
+    {
+#ifndef NDEBUG
+        ASSERT(m_threadId == WTF::currentThread());
+#endif
+        if (m_atomicString.isNull()) {
+            m_atomicString = AtomicString(m_plainString);
+            ASSERT(!m_atomicString.isNull());
+            if (m_plainString.impl() != m_atomicString.impl())
+                v8::V8::AdjustAmountOfExternalAllocatedMemory(memoryConsumption(m_atomicString.string()));
+        }
+        return m_atomicString;
+    }
+
+    void visitStrings(ExternalStringVisitor*);
+
+protected:
+    // A shallow copy of the string. Keeps the string buffer alive until the V8 engine garbage collects it.
+    String m_plainString;
+    // If this string is atomic or has been made atomic earlier the
+    // atomic string is held here. In the case where the string starts
+    // off non-atomic and becomes atomic later it is necessary to keep
+    // the original string alive because v8 may keep derived pointers
+    // into that string.
+    AtomicString m_atomicString;
+
+private:
+    static int memoryConsumption(const String& string)
+    {
+        return string.length() * (string.is8Bit() ? sizeof(LChar) : sizeof(UChar));
+    }
+#ifndef NDEBUG
+    WTF::ThreadIdentifier m_threadId;
+#endif
+};
+
+class WebCoreStringResource16 : public WebCoreStringResourceBase, public v8::String::ExternalStringResource {
+public:
+    explicit WebCoreStringResource16(const String& string) : WebCoreStringResourceBase(string) { }
+    explicit WebCoreStringResource16(const AtomicString& string) : WebCoreStringResourceBase(string) { }
+
+    virtual size_t length() const OVERRIDE { return m_plainString.impl()->length(); }
+    virtual const uint16_t* data() const OVERRIDE
+    {
+        return reinterpret_cast<const uint16_t*>(m_plainString.impl()->characters());
+    }
+};
+
+class WebCoreStringResource8 : public WebCoreStringResourceBase, public v8::String::ExternalAsciiStringResource {
+public:
+    explicit WebCoreStringResource8(const String& string) : WebCoreStringResourceBase(string) { }
+    explicit WebCoreStringResource8(const AtomicString& string) : WebCoreStringResourceBase(string) { }
+
+    virtual size_t length() const OVERRIDE { return m_plainString.impl()->length(); }
+    virtual const char* data() const OVERRIDE
+    {
+        return reinterpret_cast<const char*>(m_plainString.impl()->characters8());
+    }
+};
+
 class IntegerCache {
 public:
      IntegerCache() : m_initialized(false) { };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to