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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp

Issue 2676403003: IndexedDB: Add histograms for key type (Closed)
Patch Set: Leave number off enum max 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
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBKey.cpp ('k') | third_party/WebKit/Source/web/WebIDBKey.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
index eb6d1fd58abfb01b6967fa102ccc47930a4e400c..7971e809ea219436a10b86091c6b38d07fb27e56 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -25,6 +25,10 @@
#include "modules/indexeddb/IDBObjectStore.h"
+#include <memory>
+
+#include <v8.h>
+
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/SerializedScriptValueFactory.h"
@@ -38,14 +42,13 @@
#include "modules/indexeddb/IDBDatabase.h"
#include "modules/indexeddb/IDBKeyPath.h"
#include "modules/indexeddb/IDBTracing.h"
+#include "platform/Histogram.h"
#include "platform/SharedBuffer.h"
#include "public/platform/WebBlobInfo.h"
#include "public/platform/WebData.h"
#include "public/platform/WebVector.h"
#include "public/platform/modules/indexeddb/WebIDBKey.h"
#include "public/platform/modules/indexeddb/WebIDBKeyRange.h"
-#include <memory>
-#include <v8.h>
using blink::WebBlobInfo;
using blink::WebIDBCallbacks;
@@ -321,15 +324,25 @@ static void generateIndexKeysForValue(v8::Isolate* isolate,
if (!indexKey)
return;
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(
+ EnumerationHistogram, keyTypeHistogram,
+ new EnumerationHistogram(
+ "WebCore.IndexedDB.ObjectStore.IndexEntry.KeyType",
+ static_cast<int>(IDBKey::TypeEnumMax)));
+
if (!indexMetadata.multiEntry || indexKey->getType() != IDBKey::ArrayType) {
if (!indexKey->isValid())
return;
indexKeys->push_back(indexKey);
+ keyTypeHistogram.count(static_cast<int>(indexKey->getType()));
} else {
DCHECK(indexMetadata.multiEntry);
DCHECK_EQ(indexKey->getType(), IDBKey::ArrayType);
- indexKeys->appendVector(indexKey->toMultiEntryArray());
+ IDBKey::KeyArray array = indexKey->toMultiEntryArray();
+ for (const IDBKey* key : array)
+ keyTypeHistogram.count(static_cast<int>(key->getType()));
+ indexKeys->appendVector(array);
}
}
@@ -447,9 +460,10 @@ IDBRequest* IDBObjectStore::put(ScriptState* scriptState,
return nullptr;
}
if (usesInLineKeys) {
- if (clone.isEmpty())
+ if (clone.isEmpty()) {
clone =
deserializeScriptValue(scriptState, serializedValue.get(), &blobInfo);
+ }
IDBKey* keyPathKey = ScriptValue::to<IDBKey*>(scriptState->isolate(), clone,
exceptionState, keyPath);
if (exceptionState.hadException())
@@ -490,12 +504,21 @@ IDBRequest* IDBObjectStore::put(ScriptState* scriptState,
return nullptr;
}
+ if (key && usesInLineKeys) {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(
+ EnumerationHistogram, keyTypeHistogram,
+ new EnumerationHistogram("WebCore.IndexedDB.ObjectStore.Record.KeyType",
+ static_cast<int>(IDBKey::TypeEnumMax)));
+ keyTypeHistogram.count(static_cast<int>(key->getType()));
+ }
+
Vector<int64_t> indexIds;
HeapVector<IndexKeys> indexKeys;
for (const auto& it : metadata().indexes) {
- if (clone.isEmpty())
+ if (clone.isEmpty()) {
clone =
deserializeScriptValue(scriptState, serializedValue.get(), &blobInfo);
+ }
IndexKeys keys;
generateIndexKeysForValue(scriptState->isolate(), *it.value, clone, &keys);
indexIds.push_back(it.key);
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBKey.cpp ('k') | third_party/WebKit/Source/web/WebIDBKey.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698