61 |
61 |
62 String iconURL; |
62 String iconURL; |
63 int timestamp; |
63 int timestamp; |
64 RefPtr<SharedBuffer> data; |
64 RefPtr<SharedBuffer> data; |
65 }; |
65 }; |
66 |
66 |
67 /* To avoid deletion of icon bitmaps in Symbian */ |
|
68 #if PLATFORM(SYMBIAN) |
|
69 class IconImagePtr : Noncopyable { |
|
70 typedef Image* PtrType; |
|
71 public: |
|
72 explicit IconImagePtr(PtrType ptr = 0) : m_ptr(ptr) { } |
|
73 ~IconImagePtr() { /*deleteOwnedPtr(m_ptr);*/ } |
|
74 |
|
75 PtrType get() const { return m_ptr; } |
|
76 PtrType release() { PtrType ptr = m_ptr; m_ptr = 0; return ptr; } |
|
77 |
|
78 void set(PtrType ptr) { ASSERT(!ptr || m_ptr != ptr); /*deleteOwnedPtr(m_ptr);*/ m_ptr = ptr; } |
|
79 void clear() { /*deleteOwnedPtr(m_ptr);*/ m_ptr = 0; } |
|
80 |
|
81 Image& operator*() const { ASSERT(m_ptr); return *m_ptr; } |
|
82 PtrType operator->() const { ASSERT(m_ptr); return m_ptr; } |
|
83 |
|
84 bool operator!() const { return !m_ptr; } |
|
85 |
|
86 // This conversion operator allows implicit conversion to bool but not to other integer types. |
|
87 typedef PtrType (IconImagePtr::*UnspecifiedBoolType)() const; |
|
88 operator UnspecifiedBoolType() const { return m_ptr ? &IconImagePtr::get : 0; } |
|
89 |
|
90 void swap(IconImagePtr& o) { std::swap(m_ptr, o.m_ptr); } |
|
91 |
|
92 private: |
|
93 PtrType m_ptr; |
|
94 }; |
|
95 |
|
96 inline void swap(IconImagePtr& a, IconImagePtr& b) { a.swap(b); } |
|
97 inline Image* getPtr(const IconImagePtr& p) |
|
98 { |
|
99 return p.get(); |
|
100 } |
|
101 #endif |
|
102 |
|
103 class IconRecord : public Shared<IconRecord> { |
67 class IconRecord : public Shared<IconRecord> { |
104 friend class PageURLRecord; |
68 friend class PageURLRecord; |
105 public: |
69 public: |
106 IconRecord(const String& url); |
70 IconRecord(const String& url); |
107 ~IconRecord(); |
71 ~IconRecord(); |
122 |
86 |
123 IconSnapshot snapshot(bool forDeletion = false) const; |
87 IconSnapshot snapshot(bool forDeletion = false) const; |
124 private: |
88 private: |
125 String m_iconURL; |
89 String m_iconURL; |
126 time_t m_stamp; |
90 time_t m_stamp; |
127 #if PLATFORM(SYMBIAN) |
|
128 IconImagePtr m_image; |
|
129 #else |
|
130 OwnPtr<Image> m_image; |
91 OwnPtr<Image> m_image; |
131 #endif |
|
132 |
92 |
133 HashSet<String> m_retainingPageURLs; |
93 HashSet<String> m_retainingPageURLs; |
134 |
94 |
135 // This allows us to cache whether or not a SiteIcon has had its data set yet |
95 // This allows us to cache whether or not a SiteIcon has had its data set yet |
136 // This helps the IconDatabase know if it has to set the data on a new object or not, |
96 // This helps the IconDatabase know if it has to set the data on a new object or not, |