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

Unified Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 1992253002: Adding performance tracking for canvas API calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 4 years, 7 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/html/HTMLCanvasElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index 52556b3111db5cba61a8c639ea8039108964a793..dea002e57120f7a454f0167fe63cca35b3e374b3 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -612,6 +612,36 @@ String HTMLCanvasElement::toDataURL(const String& mimeType, const ScriptValue& q
exceptionState.throwSecurityError("Tainted canvases may not be exported.");
return String();
}
+ Optional<ScopedUsHistogramTimer> timer;
+ String lowercaseMimeType = mimeType.lower();
+ if (mimeType.isNull())
+ lowercaseMimeType = DefaultMimeType;
+ if (lowercaseMimeType == "image/png") {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterPNG, ("Blink.Canvas.ToDataURL.PNG", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterPNG);
+ } else if (lowercaseMimeType == "image/jpeg") {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterJPEG, ("Blink.Canvas.ToDataURL.JPEG", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterJPEG);
+ } else if (lowercaseMimeType == "image/webp") {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterWEBP, ("Blink.Canvas.ToDataURL.WEBP", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterWEBP);
+ } else if (lowercaseMimeType == "image/gif") {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterGIF, ("Blink.Canvas.ToDataURL.GIF", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterGIF);
+ } else if (lowercaseMimeType == "image/bmp" || lowercaseMimeType == "image/x-windows-bmp") {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterBMP, ("Blink.Canvas.ToDataURL.BMP", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterBMP);
+ } else if (lowercaseMimeType == "image/x-icon") {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterICON, ("Blink.Canvas.ToDataURL.ICON", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterICON);
+ } else if (lowercaseMimeType == "image/tiff" || lowercaseMimeType == "image/x-tiff") {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterTIFF, ("Blink.Canvas.ToDataURL.TIFF", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterTIFF);
+ } else {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterUnknown, ("Blink.Canvas.ToDataURL.Unknown", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterUnknown);
+ }
+
double quality = UndefinedQualityValue;
if (!qualityArgument.isEmpty()) {
v8::Local<v8::Value> v8Value = qualityArgument.v8Value();

Powered by Google App Engine
This is Rietveld 408576698