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

Unified Diff: third_party/WebKit/Source/platform/fonts/opentype/OpenTypeSanitizer.cpp

Issue 1659053002: Remove custom counts histogram from the blink API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a few thread_safe_static_local -> static_local as per feedback in reviews Created 4 years, 10 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/platform/fonts/opentype/OpenTypeSanitizer.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeSanitizer.cpp b/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeSanitizer.cpp
index 11d1753ffc3a10223883899078b8ff835a557c1c..f281fc1859d5afbc56d224387cfa1eddd4c02338 100644
--- a/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeSanitizer.cpp
+++ b/third_party/WebKit/Source/platform/fonts/opentype/OpenTypeSanitizer.cpp
@@ -32,6 +32,7 @@
#include "hb.h"
#include "ots-memory-stream.h"
+#include "platform/Histogram.h"
#include "platform/SharedBuffer.h"
#include "platform/TraceEvent.h"
#include "public/platform/Platform.h"
@@ -46,17 +47,24 @@ static void recordDecodeSpeedHistogram(SharedBuffer* buffer, double decodeTime,
if (decodeTime <= 0)
return;
- const char* histogramName = "WebFont.DecodeSpeed.SFNT";
+ double kbPerSecond = decodedSize / (1000 * decodeTime);
if (buffer->size() >= 4) {
const char* data = buffer->data();
- if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == 'F')
- histogramName = "WebFont.DecodeSpeed.WOFF";
- else if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == '2')
- histogramName = "WebFont.DecodeSpeed.WOFF2";
+ if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == 'F') {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, woffHistogram, new CustomCountHistogram("WebFont.DecodeSpeed.WOFF", 1000, 300000, 50));
+ woffHistogram.count(kbPerSecond);
+ return;
+ }
+
+ if (data[0] == 'w' && data[1] == 'O' && data[2] == 'F' && data[3] == '2') {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, woff2Histogram, new CustomCountHistogram("WebFont.DecodeSpeed.WOFF2", 1000, 300000, 50));
+ woff2Histogram.count(kbPerSecond);
+ return;
+ }
}
- double kbPerSecond = decodedSize / (1000 * decodeTime);
- Platform::current()->histogramCustomCounts(histogramName, kbPerSecond, 1000, 300000, 50);
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, sfntHistogram, new CustomCountHistogram("WebFont.DecodeSpeed.SFNT", 1000, 300000, 50));
+ sfntHistogram.count(kbPerSecond);
}
PassRefPtr<SharedBuffer> OpenTypeSanitizer::sanitize()
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/FontCache.cpp ('k') | third_party/WebKit/Source/platform/heap/Heap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698