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

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

Issue 2682223006: Add a use counter and histogram to FileReaderSync. (Closed)
Patch Set: add new histogram to histograms.xml 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..85cba56d496fcc8ac24c092bd51518ffaf93817c 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 {
+ DEDICATED_WORKER = 0,
+ SHARED_WORKER = 1,
+ SERVICE_WORKER = 2,
+ OTHER = 3,
kinuko 2017/02/10 00:41:38 nit: as far as we follow the above comment values
Marijn Kruisselbrink 2017/02/10 17:42:53 The documentation at https://chromium.googlesource
+ 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,

Powered by Google App Engine
This is Rietveld 408576698