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

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

Issue 2676403003: IndexedDB: Add histograms for key type (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/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..1736d0a5a97b4efe1f20ced221fee1719dbc14bb 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 <v8.h>
cmumford 2017/02/07 20:10:37 I think it was correct to move <memory> up here, b
jsbell 2017/02/07 21:58:24 D'oh - it should be further down at any rate. htt
+
+#include <memory>
+
#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;
@@ -447,9 +450,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 +494,21 @@ IDBRequest* IDBObjectStore::put(ScriptState* scriptState,
return nullptr;
}
+ if (key && usesInLineKeys) {
+ DEFINE_THREAD_SAFE_STATIC_LOCAL(
+ EnumerationHistogram, keyTypeHistogram,
+ new EnumerationHistogram("WebCore.IndexedDB.ObjectStoreRecord.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);

Powered by Google App Engine
This is Rietveld 408576698