Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(582)

Unified Diff: third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp

Issue 2232083002: Fix incorrect usage of StringImpl::sizeInBytes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: size_teeee Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp
diff --git a/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp b/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp
index fd93123c3892a69d2ef31f6f47e711611b5258aa..f159f5400ecd8a39ceb1d8d4480477757fc141d5 100644
--- a/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp
+++ b/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp
@@ -95,14 +95,9 @@ void NetworkResourcesData::ResourceData::setContent(const String& content, bool
m_base64Encoded = base64Encoded;
}
-static size_t contentSizeInBytes(const String& content)
+size_t NetworkResourcesData::ResourceData::removeContent()
{
- return content.isNull() ? 0 : content.impl()->sizeInBytes();
-}
-
-unsigned NetworkResourcesData::ResourceData::removeContent()
-{
- unsigned result = 0;
+ size_t result = 0;
if (hasData()) {
ASSERT(!hasContent());
result = m_dataBuffer->size();
@@ -111,13 +106,13 @@ unsigned NetworkResourcesData::ResourceData::removeContent()
if (hasContent()) {
ASSERT(!hasData());
- result = contentSizeInBytes(m_content);
+ result = m_content.charactersSizeInBytes();
m_content = String();
}
return result;
}
-unsigned NetworkResourcesData::ResourceData::evictContent()
+size_t NetworkResourcesData::ResourceData::evictContent()
{
m_isContentEvicted = true;
return removeContent();
@@ -170,7 +165,7 @@ size_t NetworkResourcesData::ResourceData::decodeDataToContent()
bool success = InspectorPageAgent::sharedBufferContent(m_dataBuffer, m_mimeType, m_textEncodingName, &m_content, &m_base64Encoded);
DCHECK(success);
m_dataBuffer = nullptr;
- return contentSizeInBytes(m_content) - dataLength;
+ return m_content.charactersSizeInBytes() - dataLength;
}
// NetworkResourcesData
@@ -243,7 +238,7 @@ void NetworkResourcesData::setResourceContent(const String& requestId, const Str
ResourceData* resourceData = resourceDataForRequestId(requestId);
if (!resourceData)
return;
- size_t dataLength = contentSizeInBytes(content);
+ size_t dataLength = content.charactersSizeInBytes();
if (dataLength > m_maximumSingleResourceContentSize)
return;
if (resourceData->isContentEvicted())
@@ -282,7 +277,7 @@ void NetworkResourcesData::maybeDecodeDataToContent(const String& requestId)
if (!resourceData->hasData())
return;
m_contentSize += resourceData->decodeDataToContent();
- size_t dataLength = contentSizeInBytes(resourceData->content());
+ size_t dataLength = resourceData->content().charactersSizeInBytes();
if (dataLength > m_maximumSingleResourceContentSize)
m_contentSize -= resourceData->evictContent();
}

Powered by Google App Engine
This is Rietveld 408576698