2010-08-24 Adam Barth <abarth@webkit.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Aug 2010 18:37:32 +0000 (18:37 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Aug 2010 18:37:32 +0000 (18:37 +0000)
        Reviewed by Eric Seidel.

        Deploy adoptPtr in WebCore/editing
        https://bugs.webkit.org/show_bug.cgi?id=44501

        * editing/Editor.cpp:
        (WebCore::Editor::Editor):
        * editing/TextIterator.cpp:
        (WebCore::plainTextToMallocAllocatedBuffer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@65919 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/editing/Editor.cpp
WebCore/editing/TextIterator.cpp

index 55b07a4..dec181e 100644 (file)
@@ -2,6 +2,18 @@
 
         Reviewed by Eric Seidel.
 
+        Deploy adoptPtr in WebCore/editing
+        https://bugs.webkit.org/show_bug.cgi?id=44501
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::Editor):
+        * editing/TextIterator.cpp:
+        (WebCore::plainTextToMallocAllocatedBuffer):
+
+2010-08-24  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
         Deploy adoptPtr in WebCore/history
         https://bugs.webkit.org/show_bug.cgi?id=44502
 
index fd4c210..2528dd3 100644 (file)
@@ -997,12 +997,12 @@ void Editor::reappliedEditing(PassRefPtr<EditCommand> cmd)
 
 Editor::Editor(Frame* frame)
     : m_frame(frame)
-    , m_deleteButtonController(new DeleteButtonController(frame))
+    , m_deleteButtonController(adoptPtr(new DeleteButtonController(frame)))
     , m_ignoreCompositionSelectionChange(false)
     , m_shouldStartNewKillRingSequence(false)
     // This is off by default, since most editors want this behavior (this matches IE but not FF).
     , m_shouldStyleWithCSS(false)
-    , m_killRing(new KillRing)
+    , m_killRing(adoptPtr(new KillRing))
 { 
 }
 
index 39013c1..5dc43a4 100644 (file)
@@ -2223,7 +2223,7 @@ UChar* plainTextToMallocAllocatedBuffer(const Range* r, unsigned& bufferLength,
     static const unsigned cMaxSegmentSize = 1 << 16;
     bufferLength = 0;
     typedef pair<UChar*, unsigned> TextSegment;
-    Vector<TextSegment>* textSegments = 0;
+    OwnPtr<Vector<TextSegment> > textSegments;
     Vector<UChar> textBuffer;
     textBuffer.reserveInitialCapacity(cMaxSegmentSize);
     for (TextIterator it(r, isDisplayString ? TextIteratorDefaultBehavior : TextIteratorEmitsTextsWithoutTranscoding); !it.atEnd(); it.advance()) {
@@ -2233,7 +2233,7 @@ UChar* plainTextToMallocAllocatedBuffer(const Range* r, unsigned& bufferLength,
                 goto exit;
             memcpy(newSegmentBuffer, textBuffer.data(), textBuffer.size() * sizeof(UChar));
             if (!textSegments)
-                textSegments = new Vector<TextSegment>;
+                textSegments = adoptPtr(new Vector<TextSegment>);
             textSegments->append(make_pair(newSegmentBuffer, (unsigned)textBuffer.size()));
             textBuffer.clear();
         }
@@ -2267,7 +2267,7 @@ exit:
         unsigned size = textSegments->size();
         for (unsigned i = 0; i < size; ++i)
             free(textSegments->at(i).first);
-        delete textSegments;
+        textSegments.clear();
     }
     
     if (isDisplayString && r->ownerDocument())