Title: [170264] trunk/Source/WebKit2
- Revision
- 170264
- Author
- [email protected]
- Date
- 2014-06-22 09:58:27 -0700 (Sun, 22 Jun 2014)
Log Message
Add IPC decoding support to BackForwardListState
https://bugs.webkit.org/show_bug.cgi?id=134171
Reviewed by Dan Bernstein.
* Shared/SessionState.cpp:
(WebKit::isValidEnum):
(WebKit::HTTPBody::Element::decode):
(WebKit::HTTPBody::decode):
(WebKit::FrameState::decode):
(WebKit::PageState::decode):
(WebKit::BackForwardListState::decode):
* Shared/SessionState.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (170263 => 170264)
--- trunk/Source/WebKit2/ChangeLog 2014-06-22 16:47:20 UTC (rev 170263)
+++ trunk/Source/WebKit2/ChangeLog 2014-06-22 16:58:27 UTC (rev 170264)
@@ -1,5 +1,21 @@
2014-06-22 Anders Carlsson <[email protected]>
+ Add IPC decoding support to BackForwardListState
+ https://bugs.webkit.org/show_bug.cgi?id=134171
+
+ Reviewed by Dan Bernstein.
+
+ * Shared/SessionState.cpp:
+ (WebKit::isValidEnum):
+ (WebKit::HTTPBody::Element::decode):
+ (WebKit::HTTPBody::decode):
+ (WebKit::FrameState::decode):
+ (WebKit::PageState::decode):
+ (WebKit::BackForwardListState::decode):
+ * Shared/SessionState.h:
+
+2014-06-22 Anders Carlsson <[email protected]>
+
Address a review comment.
* UIProcess/mac/LegacySessionStateCoding.cpp:
Modified: trunk/Source/WebKit2/Shared/SessionState.cpp (170263 => 170264)
--- trunk/Source/WebKit2/Shared/SessionState.cpp 2014-06-22 16:47:20 UTC (rev 170263)
+++ trunk/Source/WebKit2/Shared/SessionState.cpp 2014-06-22 16:58:27 UTC (rev 170264)
@@ -41,12 +41,54 @@
encoder << blobURLString;
}
+static bool isValidEnum(HTTPBody::Element::Type type)
+{
+ switch (type) {
+ case HTTPBody::Element::Type::Data:
+ case HTTPBody::Element::Type::File:
+ case HTTPBody::Element::Type::Blob:
+ return true;
+ }
+
+ return false;
+}
+
+bool HTTPBody::Element::decode(IPC::ArgumentDecoder& decoder, Element& result)
+{
+ if (!decoder.decodeEnum(result.type) || !isValidEnum(result.type))
+ return false;
+ if (!decoder.decode(result.data))
+ return false;
+ if (!decoder.decode(result.filePath))
+ return false;
+ if (!decoder.decode(result.fileStart))
+ return false;
+ if (!decoder.decode(result.fileLength))
+ return false;
+ if (!decoder.decode(result.expectedFileModificationTime))
+ return false;
+ if (!decoder.decode(result.blobURLString))
+ return false;
+
+ return true;
+}
+
void HTTPBody::encode(IPC::ArgumentEncoder& encoder) const
{
encoder << contentType;
encoder << elements;
}
+bool HTTPBody::decode(IPC::ArgumentDecoder& decoder, HTTPBody& result)
+{
+ if (!decoder.decode(result.contentType))
+ return false;
+ if (!decoder.decode(result.elements))
+ return false;
+
+ return true;
+}
+
void FrameState::encode(IPC::ArgumentEncoder& encoder) const
{
encoder << urlString;
@@ -68,15 +110,68 @@
encoder << children;
}
+bool FrameState::decode(IPC::ArgumentDecoder& decoder, FrameState& result)
+{
+ if (!decoder.decode(result.urlString))
+ return false;
+ if (!decoder.decode(result.originalURLString))
+ return false;
+ if (!decoder.decode(result.referrer))
+ return false;
+ if (!decoder.decode(result.target))
+ return false;
+
+ if (!decoder.decode(result.documentState))
+ return false;
+ if (!decoder.decode(result.stateObjectData))
+ return false;
+
+ if (!decoder.decode(result.documentSequenceNumber))
+ return false;
+ if (!decoder.decode(result.itemSequenceNumber))
+ return false;
+
+ if (!decoder.decode(result.scrollPoint))
+ return false;
+ if (!decoder.decode(result.pageScaleFactor))
+ return false;
+
+ if (!decoder.decode(result.httpBody))
+ return false;
+
+ if (!decoder.decode(result.children))
+ return false;
+
+ return true;
+}
+
void PageState::encode(IPC::ArgumentEncoder& encoder) const
{
encoder << mainFrameState;
}
+bool PageState::decode(IPC::ArgumentDecoder& decoder, PageState& result)
+{
+ if (!decoder.decode(result.mainFrameState))
+ return false;
+
+ return true;
+}
+
void BackForwardListState::encode(IPC::ArgumentEncoder& encoder) const
{
encoder << items;
encoder << currentIndex;
}
+bool BackForwardListState::decode(IPC::ArgumentDecoder& decoder, BackForwardListState& result)
+{
+ if (!decoder.decode(result.items))
+ return false;
+ if (!decoder.decode(result.currentIndex))
+ return false;
+
+ return true;
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/SessionState.h (170263 => 170264)
--- trunk/Source/WebKit2/Shared/SessionState.h 2014-06-22 16:47:20 UTC (rev 170263)
+++ trunk/Source/WebKit2/Shared/SessionState.h 2014-06-22 16:58:27 UTC (rev 170264)
@@ -42,6 +42,7 @@
struct HTTPBody {
struct Element {
void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, Element&);
enum class Type {
Data,
@@ -65,6 +66,7 @@
};
void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, HTTPBody&);
String contentType;
Vector<Element> elements;
@@ -72,6 +74,7 @@
struct FrameState {
void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, FrameState&);
String urlString;
String originalURLString;
@@ -94,6 +97,7 @@
struct PageState {
void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, PageState&);
String title;
FrameState mainFrameState;
@@ -101,6 +105,7 @@
struct BackForwardListState {
void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, BackForwardListState&);
Vector<PageState> items;
uint32_t currentIndex;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes