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

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: Remove unnecessary change 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 01ce75df29d537f8b830bdb70a6bd5dac4334f64..ea5bc0f61565b16d297a10ada1537da4d25aaa84 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -303,6 +303,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),
@@ -791,10 +792,19 @@ 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) {
yhirano 2016/10/14 09:20:00 Can you remove this function, and set m_encodedSiz
hajimehoshi 2016/10/14 09:29:51 Hmm, your suggestion would affect other resources
+ if (encodedSize == m_encodedSizeMemoryUsage)
+ return;
+ size_t oldSize = size();
+ m_encodedSizeMemoryUsage = encodedSize;
memoryCache()->update(this, oldSize, size());
yhirano 2016/10/14 09:20:00 This is now not needed, right?
hajimehoshi 2016/10/14 09:29:51 Done.
}
@@ -859,11 +869,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