Changeset 214115 in webkit


Ignore:
Timestamp:
Mar 17, 2017, 1:42:50 PM (8 years ago)
Author:
achristensen@apple.com
Message:

Add encoder for SocketStreamError
https://bugs.webkit.org/show_bug.cgi?id=169831

Reviewed by Andy Estes.

This isn't used yet, but we'll soon need to send these across IPC.

  • platform/network/SocketStreamError.h:

(WebCore::SocketStreamError::encode):
(WebCore::SocketStreamError::decode):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r214114 r214115  
     12017-03-17  Alex Christensen  <achristensen@webkit.org>
     2
     3        Add encoder for SocketStreamError
     4        https://bugs.webkit.org/show_bug.cgi?id=169831
     5
     6        Reviewed by Andy Estes.
     7
     8        This isn't used yet, but we'll soon need to send these across IPC.
     9
     10        * platform/network/SocketStreamError.h:
     11        (WebCore::SocketStreamError::encode):
     12        (WebCore::SocketStreamError::decode):
     13
    1142017-03-17  Alex Christensen  <achristensen@webkit.org>
    215
  • trunk/Source/WebCore/platform/network/SocketStreamError.h

    r204501 r214115  
    3838class SocketStreamError {
    3939public:
    40     SocketStreamError()
    41     {
    42     }
     40    SocketStreamError() = default;
    4341
    4442    explicit SocketStreamError(int errorCode)
     
    6159    const String& localizedDescription() const { return m_localizedDescription; }
    6260
     61    template<class Encoder> void encode(Encoder&) const;
     62    template<class Decoder> static bool decode(Decoder&, SocketStreamError&);
     63
    6364private:
    6465    int m_errorCode { 0 };
     
    6869};
    6970
     71template<class Encoder>
     72void SocketStreamError::encode(Encoder& encoder) const
     73{
     74    encoder << m_isNull;
     75    if (m_isNull)
     76        return;
     77    encoder << m_errorCode;
     78    encoder << m_failingURL;
     79    encoder << m_localizedDescription;
    7080}
     81
     82template<class Decoder>
     83bool SocketStreamError::decode(Decoder& decoder, SocketStreamError& error)
     84{
     85    if (!decoder.decode(error.m_isNull))
     86        return false;
     87    if (error.m_isNull)
     88        return true;
     89    if (!decoder.decode(error.m_errorCode))
     90        return false;
     91    if (!decoder.decode(error.m_failingURL))
     92        return false;
     93    if (!decoder.decode(error.m_localizedDescription))
     94        return false;
     95    return true;
     96}
     97
     98}
Note: See TracChangeset for help on using the changeset viewer.