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

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

Issue 2499263002: Add UMA to estimate deroppable memory usage of encoded data size in Resources (Closed)
Patch Set: Use platform/Histgram.h instead of adding depencency from core to base Created 4 years, 1 month 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/fetch/ImageResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
index dba77fe8f5ee36c3f854c9ad3502e47b888015f0..fcabc7736e2b8494f8ee88c912e6a08044a8b5e3 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -30,6 +30,7 @@
#include "core/fetch/ResourceLoader.h"
#include "core/fetch/ResourceLoadingLog.h"
#include "core/svg/graphics/SVGImage.h"
+#include "platform/Histogram.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/SharedBuffer.h"
#include "platform/geometry/IntSize.h"
@@ -114,7 +115,8 @@ ImageResource::ImageResource(const ResourceRequest& resourceRequest,
m_hasDevicePixelRatioHeaderValue(false),
m_isSchedulingReload(false),
m_isPlaceholder(isPlaceholder),
- m_flushTimer(this, &ImageResource::flushImageIfNeeded) {
+ m_flushTimer(this, &ImageResource::flushImageIfNeeded),
+ m_isRefetchableDataFromDiskCache(true) {
RESOURCE_LOADING_DVLOG(1) << "new ImageResource(ResourceRequest) " << this;
}
@@ -126,7 +128,8 @@ ImageResource::ImageResource(blink::Image* image,
m_hasDevicePixelRatioHeaderValue(false),
m_isSchedulingReload(false),
m_isPlaceholder(false),
- m_flushTimer(this, &ImageResource::flushImageIfNeeded) {
+ m_flushTimer(this, &ImageResource::flushImageIfNeeded),
+ m_isRefetchableDataFromDiskCache(true) {
RESOURCE_LOADING_DVLOG(1) << "new ImageResource(Image) " << this;
setStatus(Cached);
}
@@ -260,6 +263,10 @@ void ImageResource::destroyDecodedDataIfPossible() {
return;
CHECK(!errorOccurred());
m_image->destroyDecodedData();
+ if (!isPreloaded() && m_isRefetchableDataFromDiskCache) {
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer.EstimatedDroppableEncodedSize",
+ encodedSize() / 1024);
+ }
}
void ImageResource::doResetAnimation() {
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/style/StyleFetchedImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698