WebKit Bugzilla
Attachment 372738 Details for
Bug 187460
: ResourceResponseBase wastes a lot of space because of std::optional<>
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Pach
resourceResponse.diff (text/plain), 6.23 KB, created by
Rob Buis
on 2019-06-24 01:38:36 PDT
(
hide
)
Description:
Pach
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2019-06-24 01:38:36 PDT
Size:
6.23 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 80896f8e9f8..ae6b2185fb2 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2019-06-24 Rob Buis <rbuis@igalia.com> >+ >+ ResourceResponseBase wastes a lot of space because of std::optional<> >+ https://bugs.webkit.org/show_bug.cgi?id=187460 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Waste less space in ResourceResponseBase by shrinking >+ ParsedContentRange. >+ >+ No new tests because there is no behavior change. >+ >+ * platform/network/NetworkLoadMetrics.h: >+ * platform/network/ParsedContentRange.cpp: >+ (WebCore::areContentRangeValuesValid): >+ (WebCore::parseContentRange): >+ (WebCore::ParsedContentRange::ParsedContentRange): >+ (WebCore::ParsedContentRange::headerValue const): >+ * platform/network/ParsedContentRange.h: >+ (WebCore::ParsedContentRange::isValid const): >+ (WebCore::ParsedContentRange::lastBytePosition const): >+ > 2019-06-21 Sihui Liu <sihui_liu@apple.com> > > openDatabase should return an empty object when WebSQL is disabled >diff --git a/Source/WebCore/platform/network/NetworkLoadMetrics.h b/Source/WebCore/platform/network/NetworkLoadMetrics.h >index 03c18b6927a..b1170837f9c 100644 >--- a/Source/WebCore/platform/network/NetworkLoadMetrics.h >+++ b/Source/WebCore/platform/network/NetworkLoadMetrics.h >@@ -168,12 +168,12 @@ public: > String connectionIdentifier; > NetworkLoadPriority priority; > >- String tlsProtocol; >- String tlsCipher; >- > // Whether or not all of the properties (0 or otherwise) have been set. > bool complete { false }; > >+ String tlsProtocol; >+ String tlsCipher; >+ > HTTPHeaderMap requestHeaders; > > uint64_t requestHeaderBytesSent; >diff --git a/Source/WebCore/platform/network/ParsedContentRange.cpp b/Source/WebCore/platform/network/ParsedContentRange.cpp >index a3d4f044059..233ba399659 100644 >--- a/Source/WebCore/platform/network/ParsedContentRange.cpp >+++ b/Source/WebCore/platform/network/ParsedContentRange.cpp >@@ -31,7 +31,7 @@ > > namespace WebCore { > >-static bool areContentRangeValuesValid(int64_t firstBytePosition, int64_t lastBytePosition, int64_t instanceLength) >+static bool areContentRangeValuesValid(int64_t firstBytePosition, ParsedContentRange::BytePosition lastBytePosition, int64_t instanceLength) > { > // From <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html> > // 14.16 Content-Range >@@ -40,16 +40,16 @@ static bool areContentRangeValuesValid(int64_t firstBytePosition, int64_t lastBy > if (firstBytePosition < 0) > return false; > >- if (lastBytePosition < firstBytePosition) >+ if (lastBytePosition.value() < firstBytePosition) > return false; > > if (instanceLength == ParsedContentRange::UnknownLength) > return true; > >- return lastBytePosition < instanceLength; >+ return lastBytePosition.value() < instanceLength; > } > >-static bool parseContentRange(const String& headerValue, int64_t& firstBytePosition, int64_t& lastBytePosition, int64_t& instanceLength) >+static bool parseContentRange(const String& headerValue, int64_t& firstBytePosition, ParsedContentRange::BytePosition& lastBytePosition, int64_t& instanceLength) > { > // From <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html> > // 14.16 Content-Range >@@ -111,7 +111,8 @@ static bool parseContentRange(const String& headerValue, int64_t& firstBytePosit > > ParsedContentRange::ParsedContentRange(const String& headerValue) > { >- m_isValid = parseContentRange(headerValue, m_firstBytePosition, m_lastBytePosition, m_instanceLength); >+ if (!parseContentRange(headerValue, m_firstBytePosition, m_lastBytePosition, m_instanceLength)) >+ m_lastBytePosition = -1; > } > > ParsedContentRange::ParsedContentRange(int64_t firstBytePosition, int64_t lastBytePosition, int64_t instanceLength) >@@ -119,16 +120,17 @@ ParsedContentRange::ParsedContentRange(int64_t firstBytePosition, int64_t lastBy > , m_lastBytePosition(lastBytePosition) > , m_instanceLength(instanceLength) > { >- m_isValid = areContentRangeValuesValid(m_firstBytePosition, m_lastBytePosition, m_instanceLength); >+ if (!areContentRangeValuesValid(m_firstBytePosition, m_lastBytePosition, m_instanceLength)) >+ m_lastBytePosition = -1; > } > > String ParsedContentRange::headerValue() const > { >- if (!m_isValid) >+ if (!isValid()) > return String(); > if (m_instanceLength == UnknownLength) >- return makeString("bytes ", m_firstBytePosition, '-', m_lastBytePosition, "/*"); >- return makeString("bytes ", m_firstBytePosition, '-', m_lastBytePosition, '/', m_instanceLength); >+ return makeString("bytes ", m_firstBytePosition, '-', m_lastBytePosition.value(), "/*"); >+ return makeString("bytes ", m_firstBytePosition, '-', m_lastBytePosition.value(), '/', m_instanceLength); > } > > } >diff --git a/Source/WebCore/platform/network/ParsedContentRange.h b/Source/WebCore/platform/network/ParsedContentRange.h >index 5a0704bd4b9..426a96d0078 100644 >--- a/Source/WebCore/platform/network/ParsedContentRange.h >+++ b/Source/WebCore/platform/network/ParsedContentRange.h >@@ -27,6 +27,7 @@ > #define ParsedContentRange_h > > #include <wtf/Forward.h> >+#include <wtf/Markable.h> > > namespace WebCore { > >@@ -36,22 +37,23 @@ public: > ParsedContentRange() { } > WEBCORE_EXPORT ParsedContentRange(int64_t firstBytePosition, int64_t lastBytePosition, int64_t instanceLength); > >- bool isValid() const { return m_isValid; } >+ bool isValid() const { return (bool)m_lastBytePosition; } > int64_t firstBytePosition() const { return m_firstBytePosition; } >- int64_t lastBytePosition() const { return m_lastBytePosition; } >+ int64_t lastBytePosition() const { return m_lastBytePosition.value(); } > int64_t instanceLength() const { return m_instanceLength; } > > WEBCORE_EXPORT String headerValue() const; > > enum { UnknownLength = std::numeric_limits<int64_t>::max() }; > >+ using BytePosition = Markable<int64_t, IntegralMarkableTraits<int64_t, -1>>; >+ > private: > template<typename T> static bool isPositive(T); > > int64_t m_firstBytePosition { 0 }; >- int64_t m_lastBytePosition { 0 }; >+ BytePosition m_lastBytePosition; > int64_t m_instanceLength { UnknownLength }; >- bool m_isValid { false }; > }; > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187460
:
346147
|
372680
|
372681
|
372682
|
372683
|
372684
|
372698
|
372702
|
372703
|
372704
|
372706
|
372707
|
372708
|
372712
|
372713
|
372716
|
372738
|
372783
|
372788
|
372789
|
372799
|
372802
|
373173
|
373175
|
373176
|
373194