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

Unified Diff: Source/WebCore/loader/cache/CachedImage.cpp

Issue 13814024: Add a runtime flag in WebRuntimeFeatures to enable 'image/webp' accept header (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased patch Created 7 years, 8 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 | « Source/WebCore/loader/cache/CachedImage.h ('k') | Source/WebKit/chromium/public/WebRuntimeFeatures.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/loader/cache/CachedImage.cpp
diff --git a/Source/WebCore/loader/cache/CachedImage.cpp b/Source/WebCore/loader/cache/CachedImage.cpp
index 4f99e86a10a14697fa21b0efad4ef1387bb87af4..f5822d88cc434ffcea9f66c662fa4829e974a2cb 100644
--- a/Source/WebCore/loader/cache/CachedImage.cpp
+++ b/Source/WebCore/loader/cache/CachedImage.cpp
@@ -47,6 +47,10 @@
#include "SVGImage.h"
#endif
+#if USE(WEBP)
+#include "RuntimeEnabledFeatures.h"
+#endif
+
using std::max;
namespace WebCore {
@@ -56,6 +60,7 @@ CachedImage::CachedImage(const ResourceRequest& resourceRequest)
, m_image(0)
{
setStatus(Unknown);
+ setCustomAcceptHeader();
}
CachedImage::CachedImage(Image* image)
@@ -64,6 +69,7 @@ CachedImage::CachedImage(Image* image)
{
setStatus(Cached);
setLoading(false);
+ setCustomAcceptHeader();
}
CachedImage::~CachedImage()
@@ -293,6 +299,14 @@ void CachedImage::clear()
setEncodedSize(0);
}
+void CachedImage::setCustomAcceptHeader()
+{
+#if USE(WEBP)
+ if (RuntimeEnabledFeatures::webPInAcceptHeaderEnabled())
+ setAccept("image/webp,*/*;q=0.8");
+#endif
+}
+
inline void CachedImage::createImage()
{
// Create the image if it doesn't yet exist.
« no previous file with comments | « Source/WebCore/loader/cache/CachedImage.h ('k') | Source/WebKit/chromium/public/WebRuntimeFeatures.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698