Commit 1e2e9ed5 authored by aroben@apple.com's avatar aroben@apple.com

Windows part 2 of <rdar://5438063> Saving history containing 100,000 entries...

Windows part 2 of <rdar://5438063> Saving history containing 100,000 entries causes pauses of 2s while browsing

WebCore:

        Add SharedBuffer::wrapCFData

        This is the CF-equivalent of wrapNSData.

        Reviewed by Brady Eidson.

        * platform/SharedBuffer.h:
        * platform/cf/SharedBufferCF.cpp:
        (WebCore::SharedBuffer::wrapCFData):

WebKit/win:

        Windows part 2 of <rdar://5438063> Saving history containing 100,000
        entries causes pauses of 2s while browsing

        Reviewed by Brady Eidson.

        * Interfaces/IWebHistoryPrivate.idl: Added data, analagous to
        WebKit/mac's -[WebHistory _data] method.

        * WebHistory.cpp:
        (WebHistory::saveHistoryGuts): Changed to call data() to get the data for
        saving.
        (WebHistory::data): Added. Returns the data for saving as an IStream.
        (WebHistory::data): Added. Returns the data for saving as a CFDataRef.

        * WebHistory.h: Added data.

git-svn-id: svn://svn.chromium.org/blink/trunk@42463 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 64d4d5d5
2009-04-13 Adam Roben <aroben@apple.com>
Add SharedBuffer::wrapCFData
This is the CF-equivalent of wrapNSData.
Reviewed by Brady Eidson.
* platform/SharedBuffer.h:
* platform/cf/SharedBufferCF.cpp:
(WebCore::SharedBuffer::wrapCFData):
2009-04-13 Dan Bernstein <mitz@apple.com>
- build fix
......@@ -70,6 +70,7 @@ public:
#endif
#if PLATFORM(CF)
CFDataRef createCFData();
static PassRefPtr<SharedBuffer> wrapCFData(CFDataRef);
#endif
const char* data() const;
......
......@@ -51,6 +51,11 @@ CFDataRef SharedBuffer::createCFData()
}
#endif
PassRefPtr<SharedBuffer> SharedBuffer::wrapCFData(CFDataRef data)
{
return adoptRef(new SharedBuffer(data));
}
bool SharedBuffer::hasPlatformData() const
{
return m_cfData;
......
2009-04-13 Adam Roben <aroben@apple.com>
Windows part 2 of <rdar://5438063> Saving history containing 100,000
entries causes pauses of 2s while browsing
Reviewed by Brady Eidson.
* Interfaces/IWebHistoryPrivate.idl: Added data, analagous to
WebKit/mac's -[WebHistory _data] method.
* WebHistory.cpp:
(WebHistory::saveHistoryGuts): Changed to call data() to get the data for
saving.
(WebHistory::data): Added. Returns the data for saving as an IStream.
(WebHistory::data): Added. Returns the data for saving as a CFDataRef.
* WebHistory.h: Added data.
2009-04-10 Steve Falkenburg <sfalken@apple.com>
<rdar://problem/6676024> REGRESSION (PB-40B1): Safari crashes on launch on tablet PC
......
......@@ -35,4 +35,5 @@ interface IWebHistoryItem;
interface IWebHistoryPrivate : IUnknown
{
HRESULT allItems([in, out] int* count, [out, retval] IWebHistoryItem** items);
HRESULT data([out, retval] IStream**);
}
......@@ -28,6 +28,7 @@
#include "WebHistory.h"
#include "CFDictionaryPropertyBag.h"
#include "MemoryStream.h"
#include "WebKit.h"
#include "MarshallingHelpers.h"
#include "WebHistoryItem.h"
......@@ -40,6 +41,7 @@
#include <WebCore/HistoryPropertyList.h>
#include <WebCore/KURL.h>
#include <WebCore/PageGroup.h>
#include <WebCore/SharedBuffer.h>
#pragma warning( pop )
#include <wtf/StdLibExtras.h>
#include <wtf/Vector.h>
......@@ -387,9 +389,7 @@ HRESULT WebHistory::saveHistoryGuts(CFURLRef url, IWebError** error)
if (error)
*error = 0;
WebHistoryWriter writer(m_entriesByDate.get());
writer.writePropertyList();
RetainPtr<CFDataRef> data = writer.releaseData();
RetainPtr<CFDataRef> data = this->data();
RetainPtr<CFWriteStreamRef> stream(AdoptCF, CFWriteStreamCreateWithFile(kCFAllocatorDefault, url));
if (!stream)
......@@ -558,6 +558,17 @@ HRESULT STDMETHODCALLTYPE WebHistory::allItems(
return S_OK;
}
HRESULT WebHistory::data(IStream** stream)
{
if (!stream)
return E_POINTER;
*stream = 0;
COMPtr<MemoryStream> result = MemoryStream::createInstance(SharedBuffer::wrapCFData(data().get()));
return result.copyRefTo(stream);
}
HRESULT STDMETHODCALLTYPE WebHistory::setHistoryItemLimit(
/* [in] */ int limit)
{
......@@ -934,3 +945,10 @@ void WebHistory::addVisitedLinksToPageGroup(PageGroup& group)
{
CFDictionaryApplyFunction(m_entriesByURL.get(), addVisitedLinkToPageGroup, &group);
}
RetainPtr<CFDataRef> WebHistory::data() const
{
WebHistoryWriter writer(m_entriesByDate.get());
writer.writePropertyList();
return writer.releaseData();
}
......@@ -113,6 +113,8 @@ public:
/* [out][in] */ int* count,
/* [retval][out] */ IWebHistoryItem** items);
virtual HRESULT STDMETHODCALLTYPE data(IStream**);
// WebHistory
static WebHistory* sharedHistory();
void visitedURL(const WebCore::KURL&, const WebCore::String& title, const WebCore::String& httpMethod, bool wasFailure);
......@@ -145,6 +147,7 @@ private:
static CFAbsoluteTime timeToDate(CFAbsoluteTime time);
BSTR getNotificationString(NotificationType notifyType);
HRESULT itemForURLString(CFStringRef urlString, IWebHistoryItem** item) const;
RetainPtr<CFDataRef> data() const;
ULONG m_refCount;
RetainPtr<CFMutableDictionaryRef> m_entriesByURL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment