summaryrefslogtreecommitdiffstats
path: root/WebKit/win/WebHistory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/win/WebHistory.cpp')
-rw-r--r--WebKit/win/WebHistory.cpp41
1 files changed, 14 insertions, 27 deletions
diff --git a/WebKit/win/WebHistory.cpp b/WebKit/win/WebHistory.cpp
index deb75e5..5383a0c 100644
--- a/WebKit/win/WebHistory.cpp
+++ b/WebKit/win/WebHistory.cpp
@@ -96,7 +96,7 @@ static bool areEqualOrClose(double d1, double d2)
return (diff < .000001 && diff > -.000001);
}
-static CFDictionaryPropertyBag* createUserInfoFromArray(BSTR notificationStr, CFArrayRef arrayItem)
+static COMPtr<CFDictionaryPropertyBag> createUserInfoFromArray(BSTR notificationStr, CFArrayRef arrayItem)
{
RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF,
CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
@@ -104,28 +104,19 @@ static CFDictionaryPropertyBag* createUserInfoFromArray(BSTR notificationStr, CF
RetainPtr<CFStringRef> key(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(notificationStr));
CFDictionaryAddValue(dictionary.get(), key.get(), arrayItem);
- CFDictionaryPropertyBag* result = CFDictionaryPropertyBag::createInstance();
+ COMPtr<CFDictionaryPropertyBag> result = CFDictionaryPropertyBag::createInstance();
result->setDictionary(dictionary.get());
return result;
}
-static CFDictionaryPropertyBag* createUserInfoFromHistoryItem(BSTR notificationStr, IWebHistoryItem* item)
+static COMPtr<CFDictionaryPropertyBag> createUserInfoFromHistoryItem(BSTR notificationStr, IWebHistoryItem* item)
{
// reference counting of item added to the array is managed by the CFArray value callbacks
RetainPtr<CFArrayRef> itemList(AdoptCF, CFArrayCreate(0, (const void**) &item, 1, &MarshallingHelpers::kIUnknownArrayCallBacks));
- CFDictionaryPropertyBag* info = createUserInfoFromArray(notificationStr, itemList.get());
+ COMPtr<CFDictionaryPropertyBag> info = createUserInfoFromArray(notificationStr, itemList.get());
return info;
}
-static void releaseUserInfo(CFDictionaryPropertyBag* userInfo)
-{
- // free the dictionary
- userInfo->setDictionary(0);
- int result = userInfo->Release();
- (void)result;
- ASSERT(result == 0); // make sure no one else holds a reference to the userInfo.
-}
-
// WebHistory -----------------------------------------------------------------
WebHistory::WebHistory()
@@ -264,9 +255,8 @@ HRESULT STDMETHODCALLTYPE WebHistory::loadFromURL(
goto exit;
if (CFArrayGetCount(discardedItems.get()) > 0) {
- CFDictionaryPropertyBag* userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryItemsDiscardedWhileLoadingNotification), discardedItems.get());
- hr = postNotification(kWebHistoryItemsDiscardedWhileLoadingNotification, userInfo);
- releaseUserInfo(userInfo);
+ COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryItemsDiscardedWhileLoadingNotification), discardedItems.get());
+ hr = postNotification(kWebHistoryItemsDiscardedWhileLoadingNotification, userInfo.get());
if (FAILED(hr))
goto exit;
}
@@ -465,8 +455,8 @@ HRESULT STDMETHODCALLTYPE WebHistory::removeAllItems( void)
PageGroup::removeAllVisitedLinks();
- CFDictionaryPropertyBag* userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryAllItemsRemovedNotification), allItems.get());
- return postNotification(kWebHistoryAllItemsRemovedNotification, userInfo);
+ COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryAllItemsRemovedNotification), allItems.get());
+ return postNotification(kWebHistoryAllItemsRemovedNotification, userInfo.get());
}
HRESULT STDMETHODCALLTYPE WebHistory::orderedLastVisitedDays(
@@ -644,10 +634,9 @@ HRESULT WebHistory::removeItem(IWebHistoryItem* entry)
if (FAILED(hr))
return hr;
- CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
+ COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromHistoryItem(
getNotificationString(kWebHistoryItemsRemovedNotification), entry);
- hr = postNotification(kWebHistoryItemsRemovedNotification, userInfo);
- releaseUserInfo(userInfo);
+ hr = postNotification(kWebHistoryItemsRemovedNotification, userInfo.get());
return hr;
}
@@ -695,10 +684,9 @@ HRESULT WebHistory::addItem(IWebHistoryItem* entry, bool discardDuplicate, bool*
CFDictionarySetValue(m_entriesByURL.get(), urlString.get(), entry);
- CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
+ COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromHistoryItem(
getNotificationString(kWebHistoryItemsAddedNotification), entry);
- hr = postNotification(kWebHistoryItemsAddedNotification, userInfo);
- releaseUserInfo(userInfo);
+ hr = postNotification(kWebHistoryItemsAddedNotification, userInfo.get());
if (added)
*added = true;
@@ -754,10 +742,9 @@ void WebHistory::visitedURL(const KURL& url, const String& title, const String&
COMPtr<WebHistoryItem> item(Query, entry);
item->historyItem()->setRedirectURLs(0);
- CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
+ COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromHistoryItem(
getNotificationString(kWebHistoryItemsAddedNotification), entry);
- postNotification(kWebHistoryItemsAddedNotification, userInfo);
- releaseUserInfo(userInfo);
+ postNotification(kWebHistoryItemsAddedNotification, userInfo.get());
}
HRESULT WebHistory::itemForURLString(