diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebCore/platform/text/brew | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebCore/platform/text/brew')
-rw-r--r-- | Source/WebCore/platform/text/brew/TextBreakIteratorBrew.cpp | 30 | ||||
-rw-r--r-- | Source/WebCore/platform/text/brew/TextCodecBrew.cpp | 10 | ||||
-rw-r--r-- | Source/WebCore/platform/text/brew/TextCodecBrew.h | 3 |
3 files changed, 26 insertions, 17 deletions
diff --git a/Source/WebCore/platform/text/brew/TextBreakIteratorBrew.cpp b/Source/WebCore/platform/text/brew/TextBreakIteratorBrew.cpp index 7f46e4f..3bc1c8a 100644 --- a/Source/WebCore/platform/text/brew/TextBreakIteratorBrew.cpp +++ b/Source/WebCore/platform/text/brew/TextBreakIteratorBrew.cpp @@ -26,6 +26,7 @@ #include <wtf/StdLibExtras.h> #include <wtf/unicode/Unicode.h> +using namespace std; using namespace WTF::Unicode; namespace WebCore { @@ -260,11 +261,32 @@ TextBreakIterator* characterBreakIterator(const UChar* string, int length) return &iterator; } -TextBreakIterator* lineBreakIterator(const UChar* string, int length) +static TextBreakIterator* staticLineBreakIterator; + +TextBreakIterator* acquireLineBreakIterator(const UChar* string, int length) { - DEFINE_STATIC_LOCAL(LineBreakIterator , iterator, ()); - iterator.reset(string, length); - return &iterator; + TextBreakIterator* lineBreakIterator = 0; + if (staticLineBreakIterator) { + staticLineBreakIterator->reset(string, length); + swap(staticLineBreakIterator, lineBreakIterator); + } + + if (!lineBreakIterator && string && length) { + lineBreakIterator = new LineBreakIterator; + lineBreakIterator->reset(string, length); + } + + return lineBreakIterator; +} + +void releaseLineBreakIterator(TextBreakIterator* iterator) +{ + ASSERT(iterator); + + if (!staticLineBreakIterator) + staticLineBreakIterator = iterator; + else + delete iterator; } TextBreakIterator* sentenceBreakIterator(const UChar* string, int length) diff --git a/Source/WebCore/platform/text/brew/TextCodecBrew.cpp b/Source/WebCore/platform/text/brew/TextCodecBrew.cpp index 1f32298..aa94980 100644 --- a/Source/WebCore/platform/text/brew/TextCodecBrew.cpp +++ b/Source/WebCore/platform/text/brew/TextCodecBrew.cpp @@ -43,16 +43,6 @@ static PassOwnPtr<TextCodec> newTextCodecBrew(const TextEncoding& encoding, cons return new TextCodecBrew(encoding); } -void TextCodecBrew::registerBaseEncodingNames(EncodingNameRegistrar registrar) -{ - registrar("UTF-8", "UTF-8"); -} - -void TextCodecBrew::registerBaseCodecs(TextCodecRegistrar registrar) -{ - registrar("UTF-8", newTextCodecBrew, 0); -} - void TextCodecBrew::registerExtendedEncodingNames(EncodingNameRegistrar registrar) { // FIXME: Not sure how to enumerate all available encodings. diff --git a/Source/WebCore/platform/text/brew/TextCodecBrew.h b/Source/WebCore/platform/text/brew/TextCodecBrew.h index 97e2c87..14d11f0 100644 --- a/Source/WebCore/platform/text/brew/TextCodecBrew.h +++ b/Source/WebCore/platform/text/brew/TextCodecBrew.h @@ -35,9 +35,6 @@ namespace WebCore { class TextCodecBrew : public TextCodec { public: - static void registerBaseEncodingNames(EncodingNameRegistrar); - static void registerBaseCodecs(TextCodecRegistrar); - static void registerExtendedEncodingNames(EncodingNameRegistrar); static void registerExtendedCodecs(TextCodecRegistrar); |