- Revision
- 170614
- Author
- [email protected]
- Date
- 2014-06-30 16:39:43 -0700 (Mon, 30 Jun 2014)
Log Message
WebBackForwardListItem should not store back-forward data
https://bugs.webkit.org/show_bug.cgi?id=134469
Reviewed by Darin Adler.
Change WebBackForwardListItem::backForwardData to encode the main frame state lazily,
and change WebBackForwardListItem::setBackForwardData to decode it into the main frame state.
* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::backForwardData):
(WebKit::WebBackForwardListItem::setBackForwardData):
(WebKit::WebBackForwardListItem::encode):
* Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::backForwardData): Deleted.
* UIProcess/cf/WebBackForwardListCF.cpp:
(WebKit::WebBackForwardList::createCFDictionaryRepresentation):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::restoreSession):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (170613 => 170614)
--- trunk/Source/WebKit2/ChangeLog 2014-06-30 23:26:42 UTC (rev 170613)
+++ trunk/Source/WebKit2/ChangeLog 2014-06-30 23:39:43 UTC (rev 170614)
@@ -1,5 +1,26 @@
2014-06-30 Anders Carlsson <[email protected]>
+ WebBackForwardListItem should not store back-forward data
+ https://bugs.webkit.org/show_bug.cgi?id=134469
+
+ Reviewed by Darin Adler.
+
+ Change WebBackForwardListItem::backForwardData to encode the main frame state lazily,
+ and change WebBackForwardListItem::setBackForwardData to decode it into the main frame state.
+
+ * Shared/WebBackForwardListItem.cpp:
+ (WebKit::WebBackForwardListItem::backForwardData):
+ (WebKit::WebBackForwardListItem::setBackForwardData):
+ (WebKit::WebBackForwardListItem::encode):
+ * Shared/WebBackForwardListItem.h:
+ (WebKit::WebBackForwardListItem::backForwardData): Deleted.
+ * UIProcess/cf/WebBackForwardListCF.cpp:
+ (WebKit::WebBackForwardList::createCFDictionaryRepresentation):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::restoreSession):
+
+2014-06-30 Anders Carlsson <[email protected]>
+
WebBackForwardListItems should hold on to PageState objects
https://bugs.webkit.org/show_bug.cgi?id=134467
Modified: trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp (170613 => 170614)
--- trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp 2014-06-30 23:26:42 UTC (rev 170613)
+++ trunk/Source/WebKit2/Shared/WebBackForwardListItem.cpp 2014-06-30 23:39:43 UTC (rev 170614)
@@ -26,7 +26,9 @@
#include "config.h"
#include "WebBackForwardListItem.h"
+#include "APIData.h"
#include "DataReference.h"
+#include "LegacySessionStateCoding.h"
#include "WebCoreArgumentCoders.h"
namespace WebKit {
@@ -55,11 +57,14 @@
return highestUsedItemID;
}
+PassRefPtr<API::Data> WebBackForwardListItem::backForwardData() const
+{
+ return encodeLegacySessionHistoryEntryData(m_pageState.mainFrameState);
+}
+
void WebBackForwardListItem::setBackForwardData(const uint8_t* data, size_t size)
{
- m_backForwardData.clear();
- m_backForwardData.reserveCapacity(size);
- m_backForwardData.append(data, size);
+ decodeLegacySessionHistoryEntryData(data, size, m_pageState.mainFrameState);
}
void WebBackForwardListItem::encode(IPC::ArgumentEncoder& encoder) const
@@ -68,7 +73,9 @@
encoder << m_pageState.mainFrameState.urlString;
encoder << m_pageState.title;
encoder << m_itemID;
- encoder << IPC::DataReference(m_backForwardData);
+
+ RefPtr<API::Data> backForwardData = this->backForwardData();
+ encoder << IPC::DataReference(backForwardData->bytes(), backForwardData->size());
}
PassRefPtr<WebBackForwardListItem> WebBackForwardListItem::decode(IPC::ArgumentDecoder& decoder)
Modified: trunk/Source/WebKit2/Shared/WebBackForwardListItem.h (170613 => 170614)
--- trunk/Source/WebKit2/Shared/WebBackForwardListItem.h 2014-06-30 23:26:42 UTC (rev 170613)
+++ trunk/Source/WebKit2/Shared/WebBackForwardListItem.h 2014-06-30 23:39:43 UTC (rev 170614)
@@ -31,6 +31,10 @@
#include <wtf/PassRefPtr.h>
#include <wtf/text/WTFString.h>
+namespace API {
+class Data;
+}
+
namespace IPC {
class ArgumentDecoder;
class ArgumentEncoder;
@@ -59,7 +63,7 @@
const String& title() const { return m_pageState.title; }
void setBackForwardData(const uint8_t* buffer, size_t size);
- const Vector<uint8_t>& backForwardData() const { return m_backForwardData; }
+ PassRefPtr<API::Data> backForwardData() const;
void setSnapshotUUID(const String& uuid) { m_snapshotUUID = uuid; }
const String& snapshotUUID() const { return m_snapshotUUID; }
@@ -74,7 +78,6 @@
PageState m_pageState;
uint64_t m_itemID;
- Vector<uint8_t> m_backForwardData;
String m_snapshotUUID;
};
Modified: trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp (170613 => 170614)
--- trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp 2014-06-30 23:26:42 UTC (rev 170613)
+++ trunk/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp 2014-06-30 23:39:43 UTC (rev 170614)
@@ -26,6 +26,7 @@
#include "config.h"
#include "WebBackForwardList.h"
+#include "APIData.h"
#include "Logging.h"
#include <CoreFoundation/CoreFoundation.h>
#include <wtf/NeverDestroyed.h>
@@ -109,7 +110,8 @@
// FIXME: This uses the IPC data encoding format, which means that whenever we change the IPC encoding we need to bump the CurrentSessionStateDataVersion
// constant in WebPageProxyCF.cpp. The IPC data format is meant to be an implementation detail, and not something that should be written to disk.
- RetainPtr<CFDataRef> entryData = adoptCF(CFDataCreate(kCFAllocatorDefault, m_entries[i]->backForwardData().data(), m_entries[i]->backForwardData().size()));
+ RefPtr<API::Data> backForwardData = m_entries[i]->backForwardData();
+ RetainPtr<CFDataRef> entryData = adoptCF(CFDataCreate(kCFAllocatorDefault, backForwardData->bytes(), backForwardData->size()));
const void* keys[5] = { sessionHistoryEntryURLKey, sessionHistoryEntryTitleKey, sessionHistoryEntryOriginalURLKey, sessionHistoryEntryDataKey, sessionHistoryEntrySnapshotUUIDKey };
const void* values[5] = { url.get(), title.get(), originalURL.get(), entryData.get(), uuid.get() };
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (170613 => 170614)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-06-30 23:26:42 UTC (rev 170613)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-06-30 23:39:43 UTC (rev 170614)
@@ -1971,7 +1971,8 @@
pageState.mainFrameState.urlString = webItem->url();
pageState.mainFrameState.originalURLString = webItem->originalURL();
- if (!decodeLegacySessionHistoryEntryData(webItem->backForwardData().data(), webItem->backForwardData().size(), pageState.mainFrameState)) {
+ RefPtr<API::Data> backForwardData = webItem->backForwardData();
+ if (!decodeLegacySessionHistoryEntryData(backForwardData->bytes(), backForwardData->size(), pageState.mainFrameState)) {
LOG_ERROR("Failed to decode page state.");
return 0;
}