Changeset 55820 in webkit
- Timestamp:
- Mar 10, 2010 4:59:11 PM (14 years ago)
- Location:
- trunk/WebKit/chromium
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/chromium/ChangeLog
r55814 r55820 1 2010-03-10 Darin Fisher <darin@chromium.org> 2 3 Reviewed by Jeremy Orlow. 4 5 Add API wrapper for WebCore::SerializedScriptValue 6 https://bugs.webkit.org/show_bug.cgi?id=35988 7 8 WebSerializedScriptValue is a wrapper around SerializedScriptValue. 9 10 WebPrivatePtr is used to simplify wrapping reference counted WebCore 11 types. This class is used to cleanup WebHistoryItem, and will be used 12 to clean up other classes in the WebKit API in a follow-up patch. 13 14 * WebKit.gyp: 15 * public/WebHistoryItem.h: 16 * public/WebPrivatePtr.h: Added. 17 * public/WebSerializedScriptValue.h: Added. 18 * src/WebHistoryItem.cpp: 19 * src/WebSerializedScriptValue.cpp: Added. 20 1 21 2010-03-10 Sanjeev Radhakrishnan <sanjeevr@chromium.org> 2 22 -
trunk/WebKit/chromium/WebKit.gyp
r55784 r55820 160 160 'public/WebPopupMenu.h', 161 161 'public/WebPopupMenuInfo.h', 162 'public/WebPrivatePtr.h', 162 163 'public/WebRange.h', 163 164 'public/WebRect.h', … … 170 171 'public/WebSecurityOrigin.h', 171 172 'public/WebSecurityPolicy.h', 173 'public/WebSerializedScriptValue.h', 172 174 'public/WebSettings.h', 173 175 'public/WebSharedWorker.h', … … 350 352 'src/WebSecurityOrigin.cpp', 351 353 'src/WebSecurityPolicy.cpp', 354 'src/WebSerializedScriptValue.cpp', 352 355 'src/WebSettingsImpl.cpp', 353 356 'src/WebSettingsImpl.h', -
trunk/WebKit/chromium/public/WebHistoryItem.h
r53971 r55820 33 33 34 34 #include "WebCommon.h" 35 #include "WebPrivatePtr.h" 35 36 36 #if WEBKIT_IMPLEMENTATION37 37 namespace WebCore { class HistoryItem; } 38 namespace WTF { template <typename T> class PassRefPtr; }39 #endif40 38 41 39 namespace WebKit { 42 43 class WebHistoryItemPrivate;44 40 class WebHTTPBody; 45 41 class WebString; 42 class WebSerializedScriptValue; 46 43 struct WebPoint; 47 44 template <typename T> class WebVector; … … 56 53 ~WebHistoryItem() { reset(); } 57 54 58 WebHistoryItem() : m_private(0){ }59 WebHistoryItem(const WebHistoryItem& h) : m_private(0){ assign(h); }55 WebHistoryItem() { } 56 WebHistoryItem(const WebHistoryItem& h) { assign(h); } 60 57 WebHistoryItem& operator=(const WebHistoryItem& h) 61 58 { … … 68 65 WEBKIT_API void assign(const WebHistoryItem&); 69 66 70 bool isNull() const { return !m_private; }67 bool isNull() const { return m_private.isNull(); } 71 68 72 69 WEBKIT_API WebString urlString() const; … … 109 106 WEBKIT_API void setDocumentSequenceNumber(long long); 110 107 108 WEBKIT_API WebSerializedScriptValue stateObject() const; 109 WEBKIT_API void setStateObject(const WebSerializedScriptValue&); 110 111 111 WEBKIT_API WebString httpContentType() const; 112 112 WEBKIT_API void setHTTPContentType(const WebString&); … … 126 126 127 127 private: 128 void assign(WebHistoryItemPrivate*);129 128 void ensureMutable(); 130 Web HistoryItemPrivate*m_private;129 WebPrivatePtr<WebCore::HistoryItem> m_private; 131 130 }; 132 131 -
trunk/WebKit/chromium/src/WebHistoryItem.cpp
r53971 r55820 38 38 #include "WebHTTPBody.h" 39 39 #include "WebPoint.h" 40 #include "WebSerializedScriptValue.h" 40 41 #include "WebString.h" 41 42 #include "WebVector.h" … … 45 46 namespace WebKit { 46 47 47 class WebHistoryItemPrivate : public HistoryItem {48 };49 50 48 void WebHistoryItem::initialize() 51 49 { 52 assign(static_cast<WebHistoryItemPrivate*>(HistoryItem::create().releaseRef()));50 m_private = HistoryItem::create(); 53 51 } 54 52 55 53 void WebHistoryItem::reset() 56 54 { 57 assign(0);55 m_private.reset(); 58 56 } 59 57 60 58 void WebHistoryItem::assign(const WebHistoryItem& other) 61 59 { 62 WebHistoryItemPrivate* p = const_cast<WebHistoryItemPrivate*>(other.m_private); 63 if (p) 64 p->ref(); 65 assign(p); 60 m_private = other.m_private; 66 61 } 67 62 68 63 WebString WebHistoryItem::urlString() const 69 64 { 70 ASSERT(!isNull());71 65 return m_private->urlString(); 72 66 } … … 80 74 WebString WebHistoryItem::originalURLString() const 81 75 { 82 ASSERT(!isNull());83 76 return m_private->originalURLString(); 84 77 } … … 92 85 WebString WebHistoryItem::referrer() const 93 86 { 94 ASSERT(!isNull());95 87 return m_private->referrer(); 96 88 } … … 104 96 WebString WebHistoryItem::target() const 105 97 { 106 ASSERT(!isNull());107 98 return m_private->target(); 108 99 } … … 116 107 WebString WebHistoryItem::parent() const 117 108 { 118 ASSERT(!isNull());119 109 return m_private->parent(); 120 110 } … … 128 118 WebString WebHistoryItem::title() const 129 119 { 130 ASSERT(!isNull());131 120 return m_private->title(); 132 121 } … … 140 129 WebString WebHistoryItem::alternateTitle() const 141 130 { 142 ASSERT(!isNull());143 131 return m_private->alternateTitle(); 144 132 } … … 152 140 double WebHistoryItem::lastVisitedTime() const 153 141 { 154 ASSERT(!isNull());155 142 return m_private->lastVisitedTime(); 156 143 } … … 169 156 WebPoint WebHistoryItem::scrollOffset() const 170 157 { 171 ASSERT(!isNull());172 158 return m_private->scrollPoint(); 173 159 } … … 181 167 bool WebHistoryItem::isTargetItem() const 182 168 { 183 ASSERT(!isNull());184 169 return m_private->isTargetItem(); 185 170 } … … 193 178 int WebHistoryItem::visitCount() const 194 179 { 195 ASSERT(!isNull());196 180 return m_private->visitCount(); 197 181 } … … 205 189 WebVector<WebString> WebHistoryItem::documentState() const 206 190 { 207 ASSERT(!isNull());208 191 return m_private->documentState(); 209 192 } … … 221 204 long long WebHistoryItem::documentSequenceNumber() const 222 205 { 223 ASSERT(!isNull());224 206 return m_private->documentSequenceNumber(); 225 207 } … … 231 213 } 232 214 215 WebSerializedScriptValue WebHistoryItem::stateObject() const 216 { 217 return WebSerializedScriptValue(m_private->stateObject()); 218 } 219 220 void WebHistoryItem::setStateObject(const WebSerializedScriptValue& object) 221 { 222 ensureMutable(); 223 m_private->setStateObject(object); 224 } 225 233 226 WebString WebHistoryItem::httpContentType() const 234 227 { 235 ASSERT(!isNull());236 228 return m_private->formContentType(); 237 229 } … … 245 237 WebHTTPBody WebHistoryItem::httpBody() const 246 238 { 247 ASSERT(!isNull());248 239 return WebHTTPBody(m_private->formData()); 249 240 } … … 257 248 WebVector<WebHistoryItem> WebHistoryItem::children() const 258 249 { 259 ASSERT(!isNull());260 250 return m_private->children(); 261 251 } … … 276 266 277 267 WebHistoryItem::WebHistoryItem(const PassRefPtr<HistoryItem>& item) 278 : m_private( static_cast<WebHistoryItemPrivate*>(item.releaseRef()))268 : m_private(item) 279 269 { 280 270 } … … 282 272 WebHistoryItem& WebHistoryItem::operator=(const PassRefPtr<HistoryItem>& item) 283 273 { 284 assign(static_cast<WebHistoryItemPrivate*>(item.releaseRef()));274 m_private = item; 285 275 return *this; 286 276 } … … 288 278 WebHistoryItem::operator PassRefPtr<HistoryItem>() const 289 279 { 290 return m_private; 291 } 292 293 void WebHistoryItem::assign(WebHistoryItemPrivate* p) 294 { 295 // p is already ref'd for us by the caller 296 if (m_private) 297 m_private->deref(); 298 m_private = p; 280 return m_private.get(); 299 281 } 300 282 301 283 void WebHistoryItem::ensureMutable() 302 284 { 303 ASSERT(!isNull());304 285 if (!m_private->hasOneRef()) 305 assign(static_cast<WebHistoryItemPrivate*>(m_private->copy().releaseRef()));286 m_private = m_private->copy(); 306 287 } 307 288
Note: See TracChangeset
for help on using the changeset viewer.