Commit e2b8aa4d authored by andersca@apple.com's avatar andersca@apple.com

Try to fix the Windows build.

* API/OpaqueJSString.cpp:
(OpaqueJSString::~OpaqueJSString):
(OpaqueJSString::characters):
* API/OpaqueJSString.h:
(OpaqueJSString::OpaqueJSString):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162206 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 409f9a88
......@@ -43,14 +43,14 @@ PassRefPtr<OpaqueJSString> OpaqueJSString::create(const String& string)
OpaqueJSString::~OpaqueJSString()
{
// m_characters is put in a local here to avoid an extra atomic load.
const UChar* characters = m_characters;
UChar* characters = m_characters;
if (!characters)
return;
if (!m_string.is8Bit() && m_string.characters() == characters)
return;
fastFree(const_cast<void*>(static_cast<const void*>(characters)));
fastFree(characters);
}
String OpaqueJSString::string() const
......@@ -82,7 +82,7 @@ const UChar* OpaqueJSString::characters()
return nullptr;
// m_characters is put in a local here to avoid an extra atomic load.
const UChar* characters = m_characters;
UChar* characters = m_characters;
if (characters)
return characters;
......
......@@ -71,13 +71,13 @@ private:
friend class WTF::ThreadSafeRefCounted<OpaqueJSString>;
OpaqueJSString()
: m_characters(static_cast<const UChar*>(nullptr))
: m_characters(nullptr)
{
}
OpaqueJSString(const String& string)
: m_string(string.isolatedCopy())
, m_characters(m_string.is8Bit() ? nullptr : m_string.characters16())
, m_characters(m_string.is8Bit() ? nullptr : const_cast<UChar*>(m_string.characters16()))
{
}
......@@ -89,14 +89,14 @@ private:
OpaqueJSString(const UChar* characters, unsigned length)
: m_string(characters, length)
, m_characters(m_string.is8Bit() ? nullptr : m_string.characters16())
, m_characters(m_string.is8Bit() ? nullptr : const_cast<UChar*>(m_string.characters16()))
{
}
String m_string;
// This will be initialized on demand when characters() is called.
std::atomic<const UChar*> m_characters;
// This will be initialized on demand when characters() is called if the string needs up-conversion.
std::atomic<UChar*> m_characters;
};
#endif
2014-01-17 Anders Carlsson <andersca@apple.com>
Try to fix the Windows build.
* API/OpaqueJSString.cpp:
(OpaqueJSString::~OpaqueJSString):
(OpaqueJSString::characters):
* API/OpaqueJSString.h:
(OpaqueJSString::OpaqueJSString):
2014-01-17 Anders Carlsson <andersca@apple.com>
Get rid of OpaqueJSString::deprecatedCharacters()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment