diff options
author | Steve Block <steveblock@google.com> | 2011-05-19 13:52:16 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-05-19 14:47:35 +0100 |
commit | a299dfda6bbcec93b532b7ad3d118a9609fa9b75 (patch) | |
tree | b5b0a96e943a40e57de17597b8e1c99646d4e026 /Source | |
parent | bc1021c1924cd3daeefe88111a63dab7b6a9bf03 (diff) | |
download | external_webkit-a299dfda6bbcec93b532b7ad3d118a9609fa9b75.zip external_webkit-a299dfda6bbcec93b532b7ad3d118a9609fa9b75.tar.gz external_webkit-a299dfda6bbcec93b532b7ad3d118a9609fa9b75.tar.bz2 |
Use adoptPtr() and adoptArrayPtr() when setting OwnPtr and OwnArrayPtr
We should not be using OwnPtr/OwnArrayPtr::set() - see LOOSE_OWN_PTR
and LOOSE_OWN_ARRAY_PTR in OwnPtr.h and OwnArrayPtr.h.
LOOSE_OWN_ARRAY_PTR will be removed in
http://trac.webkit.org/changeset/77785 so fixing now to avoid later
problems.
Change-Id: I81552b1bc5e1555a3d46e0db1f9916c68878c751
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/platform/graphics/android/FontAndroid.cpp | 6 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/HarfbuzzSkia.cpp | 17 |
2 files changed, 13 insertions, 10 deletions
diff --git a/Source/WebCore/platform/graphics/android/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/FontAndroid.cpp index 6966e7d..a4fb51b 100644 --- a/Source/WebCore/platform/graphics/android/FontAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/FontAndroid.cpp @@ -49,6 +49,8 @@ #include <unicode/uchar.h> #include <wtf/OwnArrayPtr.h> #include <wtf/OwnPtr.h> +#include <wtf/PassOwnArrayPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/unicode/Unicode.h> #endif @@ -817,12 +819,12 @@ const TextRun& TextRunWalker::getNormalizedTextRun(const TextRun& originalRun, sourceText = normalizedString.getBuffer(); } - normalizedBuffer.set(new UChar[normalizedBufferLength + 1]); + normalizedBuffer = adoptArrayPtr(new UChar[normalizedBufferLength + 1]); normalizeSpacesAndMirrorChars(sourceText, originalRun.rtl(), normalizedBuffer.get(), normalizedBufferLength); - normalizedRun.set(new TextRun(originalRun)); + normalizedRun = adoptPtr(new TextRun(originalRun)); normalizedRun->setText(normalizedBuffer.get(), normalizedBufferLength); return *normalizedRun; } diff --git a/Source/WebCore/platform/graphics/android/HarfbuzzSkia.cpp b/Source/WebCore/platform/graphics/android/HarfbuzzSkia.cpp index 81841f2..7c3a6b4 100644 --- a/Source/WebCore/platform/graphics/android/HarfbuzzSkia.cpp +++ b/Source/WebCore/platform/graphics/android/HarfbuzzSkia.cpp @@ -27,13 +27,14 @@ #include "config.h" #include "FontPlatformData.h" -#include "wtf/OwnArrayPtr.h" -#include "SkFontHost.h" -#include "SkPaint.h" -#include "SkPath.h" -#include "SkPoint.h" -#include "SkRect.h" +#include <SkFontHost.h> +#include <SkPaint.h> +#include <SkPath.h> +#include <SkPoint.h> +#include <SkRect.h> +#include <wtf/OwnArrayPtr.h> +#include <wtf/PassOwnArrayPtr.h> extern "C" { #include "harfbuzz-shaper.h" @@ -80,7 +81,7 @@ static void glyphsToAdvances(HB_Font hbFont, const HB_Glyph* glyphs, hb_uint32 n font->setupPaint(&paint); paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); - OwnArrayPtr<uint16_t> glyphs16(new uint16_t[numGlyphs]); + OwnArrayPtr<uint16_t> glyphs16 = adoptArrayPtr(new uint16_t[numGlyphs]); if (!glyphs16.get()) return; for (unsigned i = 0; i < numGlyphs; ++i) @@ -106,7 +107,7 @@ static HB_Bool canRender(HB_Font hbFont, const HB_UChar16* characters, hb_uint32 font->setupPaint(&paint); paint.setTextEncoding(SkPaint::kUTF16_TextEncoding); - OwnArrayPtr<uint16_t> glyphs16(new uint16_t[length]); + OwnArrayPtr<uint16_t> glyphs16 = adoptArrayPtr(new uint16_t[length]); glyphs16.get(); int numGlyphs = paint.textToGlyphs(characters, length * sizeof(uint16_t), glyphs16.get()); |