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

Unified Diff: third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp

Issue 2694093002: Add a use counter and histogram to FileReaderSync. (Closed)
Patch Set: Created 3 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/core/fileapi/FileReaderSync.cpp
diff --git a/third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp b/third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp
index 2b967df96e5a43a235f75466b039ad1598954ae1..05dc1e43ef4be857448212d4450f97d2f0c3c0b1 100644
--- a/third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp
+++ b/third_party/WebKit/Source/core/fileapi/FileReaderSync.cpp
@@ -36,10 +36,36 @@
#include "core/fileapi/Blob.h"
#include "core/fileapi/FileError.h"
#include "core/fileapi/FileReaderLoader.h"
+#include "platform/Histogram.h"
namespace blink {
-FileReaderSync::FileReaderSync() {}
+namespace {
+// These values are written to logs. New enum values can be added, but existing
+// enums must never be renumbered or deleted and reused.
+enum class WorkerType {
+ OTHER = 0,
+ DEDICATED_WORKER = 1,
+ SHARED_WORKER = 2,
+ SERVICE_WORKER = 3,
+ MAX
+};
+} // namespace
+
+FileReaderSync::FileReaderSync(ExecutionContext* context) {
+ WorkerType type = WorkerType::OTHER;
+ if (context->isDedicatedWorkerGlobalScope())
+ type = WorkerType::DEDICATED_WORKER;
+ else if (context->isSharedWorkerGlobalScope())
+ type = WorkerType::SHARED_WORKER;
+ else if (context->isServiceWorkerGlobalScope())
+ type = WorkerType::SERVICE_WORKER;
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(
+ EnumerationHistogram, workerTypeHistogram,
+ new EnumerationHistogram("FileReaderSync.WorkerType",
+ static_cast<int>(WorkerType::MAX)));
+ workerTypeHistogram.count(static_cast<int>(type));
+}
DOMArrayBuffer* FileReaderSync::readAsArrayBuffer(
ScriptState* scriptState,
« no previous file with comments | « third_party/WebKit/Source/core/fileapi/FileReaderSync.h ('k') | third_party/WebKit/Source/core/fileapi/FileReaderSync.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698