Reviewed by Oliver.
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Oct 2006 04:33:24 +0000 (04:33 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Oct 2006 04:33:24 +0000 (04:33 +0000)
        Make FileChooser ref-counted.

        * platform/FileChooser.h:
        * platform/mac/FileChooserMac.mm:
        (WebCore::FileChooser::create):
        * rendering/RenderFileUploadControl.cpp:
        (WebCore::RenderFileUploadControl::RenderFileUploadControl):
        (WebCore::RenderFileUploadControl::~RenderFileUploadControl):
        * rendering/RenderFileUploadControl.h:

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

WebCore/ChangeLog
WebCore/platform/FileChooser.h
WebCore/platform/mac/FileChooserMac.mm
WebCore/rendering/RenderFileUploadControl.cpp
WebCore/rendering/RenderFileUploadControl.h

index 5e4f467a0ec57e3feca749bb0699e844a2dd3add..16063c708185951e5a8ebeb14dcb30b864759056 100644 (file)
@@ -1,3 +1,17 @@
+2006-10-10  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Oliver.
+
+        Make FileChooser ref-counted.
+
+        * platform/FileChooser.h:
+        * platform/mac/FileChooserMac.mm:
+        (WebCore::FileChooser::create):
+        * rendering/RenderFileUploadControl.cpp:
+        (WebCore::RenderFileUploadControl::RenderFileUploadControl):
+        (WebCore::RenderFileUploadControl::~RenderFileUploadControl):
+        * rendering/RenderFileUploadControl.h:
+
 2006-10-10  Sam Weinig  <sam.weinig@gmail.com>
 
         Reviewed by Tim H.
index 690256220c4664ca44d8079c53de5fe8de36a464..0124ba7ee3f73434d1eaac6c71533f67822836fd 100644 (file)
@@ -39,9 +39,9 @@ class Document;
 class RenderFileUploadControl;
 class String;
 
-class FileChooser {
+class FileChooser : public Shared<FileChooser> {
 public:
-    FileChooser(Document*, RenderFileUploadControl*);
+    static PassRefPtr<FileChooser> create(Document*, RenderFileUploadControl*);
     ~FileChooser();
     
     void openFileChooser();
@@ -62,6 +62,8 @@ private:
     String m_filename;
     RefPtr<Icon> m_icon;
     RenderFileUploadControl* m_uploadControl;
+
+    FileChooser(Document*, RenderFileUploadControl*);
     
 #if PLATFORM(MAC)
     OpenPanelController* m_controller;
index eb8bbe4ca1f3d4d95c02bf9050c5640b1dce18dd..db9151e4306951827b4f4aa281700dc4be950996 100644 (file)
@@ -85,6 +85,12 @@ using namespace WebCore;
 
 namespace WebCore {
     
+PassRefPtr<FileChooser> FileChooser::create(Document* document, RenderFileUploadControl* uploadControl)
+{
+    PassRefPtr<FileChooser> fileChooser(new FileChooser(document, uploadControl));
+    return fileChooser;
+}
+
 FileChooser::FileChooser(Document* document, RenderFileUploadControl* uploadControl)
     : m_document(document)
     , m_icon(0)
index f1eeaea14a63f3a4d76e23f5c17db5925ba9a21b..3b0bbf3c0525edf149344a30f554679132317804 100644 (file)
@@ -64,7 +64,7 @@ private:
 RenderFileUploadControl::RenderFileUploadControl(Node* node)
     : RenderBlock(node)
     , m_button(0)
-    , m_fileChooser(new FileChooser(document(), this))
+    , m_fileChooser(FileChooser::create(document(), this))
 {
 }
 
@@ -74,7 +74,6 @@ RenderFileUploadControl::~RenderFileUploadControl()
         m_button->detach();
     if (m_fileChooser) {
         m_fileChooser->uploadControlDetaching();
-        delete m_fileChooser;
     }
 }
 
index 611c36c696cf088842cb5afa4503fc60635f78bc..3fd31af2eef075f4b1c42eecb541c314fe4851cf 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "FileChooser.h"
 #include "HTMLInputElement.h"
+#include "Shared.h"
 
 namespace WebCore {
 
@@ -56,7 +57,7 @@ protected:
     RenderStyle* createButtonStyle(RenderStyle* parentStyle = 0);
     
     RefPtr<HTMLFileUploadInnerButtonElement> m_button;
-    FileChooser* m_fileChooser;
+    RefPtr<FileChooser> m_fileChooser;
 };
 
 }