Make Icon ref-counted.
* platform/FileChooser.h: Store m_icon as a RefPtr instead of
auto_ptr.
* platform/Icon.h: Inherit from Shared<Icon>
* platform/mac/FileChooserMac.mm:
(WebCore::FileChooser::chooseFile): Update m_icon usage
* platform/mac/IconMac.mm:
(WebCore::Icon::newIconForFile): Return a RefPtr instead of an
auto_ptr
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16336
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-09-12 Adam Roben <aroben@apple.com>
+
+ Reviewed by timo, ggaren.
+
+ Make Icon ref-counted.
+
+ * platform/FileChooser.h: Store m_icon as a RefPtr instead of
+ auto_ptr.
+ * platform/Icon.h: Inherit from Shared<Icon>
+ * platform/mac/FileChooserMac.mm:
+ (WebCore::FileChooser::chooseFile): Update m_icon usage
+ * platform/mac/IconMac.mm:
+ (WebCore::Icon::newIconForFile): Return a RefPtr instead of an
+ auto_ptr
+
=== Safari-521.26 ===
2006-09-12 Nikolas Zimmermann <zimmermann@kde.org>
#include "Icon.h"
#include "PlatformString.h"
-#include <wtf/OwnPtr.h>
+#include <wtf/RefPtr.h>
#if PLATFORM(MAC)
#ifdef __OBJC__
private:
Document* m_document;
String m_filename;
- OwnPtr<Icon> m_icon;
+ RefPtr<Icon> m_icon;
RenderFileUploadControl* m_uploadControl;
#if PLATFORM(MAC)
#ifndef ICON_H_
#define ICON_H_
+#include "Shared.h"
+
#include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
#if PLATFORM(MAC)
#ifdef __OBJC__
typedef struct HICON__* HICON;
#endif
-using namespace std;
-
namespace WebCore {
class GraphicsContext;
class IntRect;
class String;
-class Icon : Noncopyable {
+class Icon : public Shared<Icon>, Noncopyable {
public:
Icon();
~Icon();
- static auto_ptr<Icon> newIconForFile(const String& filename);
+ static PassRefPtr<Icon> newIconForFile(const String& filename);
void paint(GraphicsContext*, const IntRect&);
// Need unsigned 0 here to disambiguate String::operator[] from operator(NSString*, int)[]
if (!m_filename.length() || m_filename[0U] != '/')
- m_icon.set(0);
+ m_icon = 0;
else
- m_icon.set(Icon::newIconForFile(m_filename).release());
+ m_icon = Icon::newIconForFile(m_filename);
uploadControl()->valueChanged();
}
[m_nsImage release];
}
-auto_ptr<Icon> Icon::newIconForFile(const String& filename)
+PassRefPtr<Icon> Icon::newIconForFile(const String& filename)
{
NSImage* fileIcon = [[[NSWorkspace sharedWorkspace] iconForFile:filename] retain];
if (!fileIcon)
- return auto_ptr<Icon>(0);
+ return PassRefPtr<Icon>(0);
- auto_ptr<Icon> icon(new Icon());
+ PassRefPtr<Icon> icon(new Icon());
icon->m_nsImage = fileIcon;