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

Unified Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 2393113002: ImageResource: Reset the encoded image size after receiving all data (Closed)
Patch Set: Rename encodedSizeMemoryUsage -> encodedSizeMemoryUsageForTesting Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index 46a06cd63061565546509cb35eba678139840d3e..797293a9237202c027308a2c090d1bc15d54068d 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -304,6 +304,7 @@ Resource::Resource(const ResourceRequest& request,
: m_loadFinishTime(0),
m_identifier(0),
m_encodedSize(0),
+ m_encodedSizeMemoryUsage(0),
m_decodedSize(0),
m_overheadSize(calculateOverheadSize()),
m_preloadCount(0),
@@ -793,13 +794,18 @@ void Resource::setDecodedSize(size_t decodedSize) {
}
void Resource::setEncodedSize(size_t encodedSize) {
- if (encodedSize == m_encodedSize)
+ if (encodedSize == m_encodedSize && encodedSize == m_encodedSizeMemoryUsage)
return;
size_t oldSize = size();
m_encodedSize = encodedSize;
+ m_encodedSizeMemoryUsage = encodedSize;
memoryCache()->update(this, oldSize, size());
}
+void Resource::setEncodedSizeMemoryUsage(size_t encodedSize) {
+ m_encodedSizeMemoryUsage = encodedSize;
+}
+
void Resource::didAccessDecodedData() {
memoryCache()->updateDecodedResource(this, UpdateForAccess);
memoryCache()->prune();
@@ -861,11 +867,11 @@ void Resource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail,
const String dumpName = getMemoryDumpName();
WebMemoryAllocatorDump* dump =
memoryDump->createMemoryAllocatorDump(dumpName);
- dump->addScalar("encoded_size", "bytes", m_encodedSize);
+ dump->addScalar("encoded_size", "bytes", m_encodedSizeMemoryUsage);
if (hasClientsOrObservers())
- dump->addScalar("live_size", "bytes", m_encodedSize);
+ dump->addScalar("live_size", "bytes", m_encodedSizeMemoryUsage);
else
- dump->addScalar("dead_size", "bytes", m_encodedSize);
+ dump->addScalar("dead_size", "bytes", m_encodedSizeMemoryUsage);
if (m_data)
m_data->onMemoryDump(dumpName, memoryDump);
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698