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

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: use thread safe static local 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 72bf3360613b99fdb274b9ee1b1bc5081285b300..ceebfd501035a0a9f250aa662cfd7ee32b70fdf8 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_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterPNG, new CustomCountHistogram("Blink.Canvas.ToDataURL.PNG", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterPNG);
+ } else if (lowercaseMimeType == "image/jpeg") {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterJPEG, new CustomCountHistogram("Blink.Canvas.ToDataURL.JPEG", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterJPEG);
+ } else if (lowercaseMimeType == "image/webp") {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterWEBP, new CustomCountHistogram("Blink.Canvas.ToDataURL.WEBP", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterWEBP);
+ } else if (lowercaseMimeType == "image/gif") {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterGIF, new CustomCountHistogram("Blink.Canvas.ToDataURL.GIF", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterGIF);
+ } else if (lowercaseMimeType == "image/bmp" || lowercaseMimeType == "image/x-windows-bmp") {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterBMP, new CustomCountHistogram("Blink.Canvas.ToDataURL.BMP", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterBMP);
+ } else if (lowercaseMimeType == "image/x-icon") {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterICON, new CustomCountHistogram("Blink.Canvas.ToDataURL.ICON", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterICON);
+ } else if (lowercaseMimeType == "image/tiff" || lowercaseMimeType == "image/x-tiff") {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterTIFF, new CustomCountHistogram("Blink.Canvas.ToDataURL.TIFF", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterTIFF);
+ } else {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounterUnknown, new CustomCountHistogram("Blink.Canvas.ToDataURL.Unknown", 0, 10000000, 50));
+ timer.emplace(scopedUsCounterUnknown);
+ }
+
double quality = UndefinedQualityValue;
if (!qualityArgument.isEmpty()) {
v8::Local<v8::Value> v8Value = qualityArgument.v8Value();
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698