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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp

Issue 1652983005: Remove Enumeration Histograms from the Blink Platform API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_blink_histograms_5a
Patch Set: Fix misplaced bracket on android 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 18 matching lines...) Expand all
29 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 29 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
30 #include "bindings/core/v8/Nullable.h" 30 #include "bindings/core/v8/Nullable.h"
31 #include "bindings/core/v8/SerializedScriptValue.h" 31 #include "bindings/core/v8/SerializedScriptValue.h"
32 #include "bindings/modules/v8/V8BindingForModules.h" 32 #include "bindings/modules/v8/V8BindingForModules.h"
33 #include "core/dom/ExceptionCode.h" 33 #include "core/dom/ExceptionCode.h"
34 #include "core/dom/ExecutionContext.h" 34 #include "core/dom/ExecutionContext.h"
35 #include "core/events/EventQueue.h" 35 #include "core/events/EventQueue.h"
36 #include "core/inspector/ScriptCallStack.h" 36 #include "core/inspector/ScriptCallStack.h"
37 #include "modules/indexeddb/IDBAny.h" 37 #include "modules/indexeddb/IDBAny.h"
38 #include "modules/indexeddb/IDBEventDispatcher.h" 38 #include "modules/indexeddb/IDBEventDispatcher.h"
39 #include "modules/indexeddb/IDBHistograms.h"
40 #include "modules/indexeddb/IDBIndex.h" 39 #include "modules/indexeddb/IDBIndex.h"
41 #include "modules/indexeddb/IDBKeyPath.h" 40 #include "modules/indexeddb/IDBKeyPath.h"
42 #include "modules/indexeddb/IDBTracing.h" 41 #include "modules/indexeddb/IDBTracing.h"
43 #include "modules/indexeddb/IDBVersionChangeEvent.h" 42 #include "modules/indexeddb/IDBVersionChangeEvent.h"
44 #include "modules/indexeddb/WebIDBDatabaseCallbacksImpl.h" 43 #include "modules/indexeddb/WebIDBDatabaseCallbacksImpl.h"
45 #include "public/platform/Platform.h" 44 #include "platform/Histogram.h"
46 #include "public/platform/modules/indexeddb/WebIDBKeyPath.h" 45 #include "public/platform/modules/indexeddb/WebIDBKeyPath.h"
47 #include "public/platform/modules/indexeddb/WebIDBTypes.h" 46 #include "public/platform/modules/indexeddb/WebIDBTypes.h"
48 #include "wtf/Atomics.h" 47 #include "wtf/Atomics.h"
49 #include <limits> 48 #include <limits>
50 49
51 using blink::WebIDBDatabase; 50 using blink::WebIDBDatabase;
52 51
53 namespace blink { 52 namespace blink {
54 53
55 const char IDBDatabase::indexDeletedErrorMessage[] = "The index or its object st ore has been deleted."; 54 const char IDBDatabase::indexDeletedErrorMessage[] = "The index or its object st ore has been deleted.";
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 { 173 {
175 if (m_metadata.intVersion == IDBDatabaseMetadata::NoIntVersion) 174 if (m_metadata.intVersion == IDBDatabaseMetadata::NoIntVersion)
176 result.setString(m_metadata.version); 175 result.setString(m_metadata.version);
177 else 176 else
178 result.setUnsignedLongLong(m_metadata.intVersion); 177 result.setUnsignedLongLong(m_metadata.intVersion);
179 } 178 }
180 179
181 IDBObjectStore* IDBDatabase::createObjectStore(const String& name, const IDBKeyP ath& keyPath, bool autoIncrement, ExceptionState& exceptionState) 180 IDBObjectStore* IDBDatabase::createObjectStore(const String& name, const IDBKeyP ath& keyPath, bool autoIncrement, ExceptionState& exceptionState)
182 { 181 {
183 IDB_TRACE("IDBDatabase::createObjectStore"); 182 IDB_TRACE("IDBDatabase::createObjectStore");
184 Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEndAPICall s", IDBCreateObjectStoreCall, IDBMethodsMax); 183 recordApiCallsHistogram(IDBCreateObjectStoreCall);
184
185 if (!m_versionChangeTransaction) { 185 if (!m_versionChangeTransaction) {
186 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVers ionChangeTransactionErrorMessage); 186 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVers ionChangeTransactionErrorMessage);
187 return nullptr; 187 return nullptr;
188 } 188 }
189 if (m_versionChangeTransaction->isFinished() || m_versionChangeTransaction-> isFinishing()) { 189 if (m_versionChangeTransaction->isFinished() || m_versionChangeTransaction-> isFinishing()) {
190 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage); 190 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage);
191 return nullptr; 191 return nullptr;
192 } 192 }
193 if (!m_versionChangeTransaction->isActive()) { 193 if (!m_versionChangeTransaction->isActive()) {
194 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage); 194 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage);
(...skipping 28 matching lines...) Expand all
223 m_metadata.objectStores.set(metadata.id, metadata); 223 m_metadata.objectStores.set(metadata.id, metadata);
224 ++m_metadata.maxObjectStoreId; 224 ++m_metadata.maxObjectStoreId;
225 225
226 m_versionChangeTransaction->objectStoreCreated(name, objectStore); 226 m_versionChangeTransaction->objectStoreCreated(name, objectStore);
227 return objectStore; 227 return objectStore;
228 } 228 }
229 229
230 void IDBDatabase::deleteObjectStore(const String& name, ExceptionState& exceptio nState) 230 void IDBDatabase::deleteObjectStore(const String& name, ExceptionState& exceptio nState)
231 { 231 {
232 IDB_TRACE("IDBDatabase::deleteObjectStore"); 232 IDB_TRACE("IDBDatabase::deleteObjectStore");
233 Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEndAPICall s", IDBDeleteObjectStoreCall, IDBMethodsMax); 233 recordApiCallsHistogram(IDBDeleteObjectStoreCall);
234 if (!m_versionChangeTransaction) { 234 if (!m_versionChangeTransaction) {
235 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVers ionChangeTransactionErrorMessage); 235 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVers ionChangeTransactionErrorMessage);
236 return; 236 return;
237 } 237 }
238 if (m_versionChangeTransaction->isFinished() || m_versionChangeTransaction-> isFinishing()) { 238 if (m_versionChangeTransaction->isFinished() || m_versionChangeTransaction-> isFinishing()) {
239 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage); 239 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage);
240 return; 240 return;
241 } 241 }
242 if (!m_versionChangeTransaction->isActive()) { 242 if (!m_versionChangeTransaction->isActive()) {
243 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage); 243 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage);
(...skipping 12 matching lines...) Expand all
256 } 256 }
257 257
258 m_backend->deleteObjectStore(m_versionChangeTransaction->id(), objectStoreId ); 258 m_backend->deleteObjectStore(m_versionChangeTransaction->id(), objectStoreId );
259 m_versionChangeTransaction->objectStoreDeleted(name); 259 m_versionChangeTransaction->objectStoreDeleted(name);
260 m_metadata.objectStores.remove(objectStoreId); 260 m_metadata.objectStores.remove(objectStoreId);
261 } 261 }
262 262
263 IDBTransaction* IDBDatabase::transaction(ScriptState* scriptState, const StringO rStringSequenceOrDOMStringList& storeNames, const String& modeString, ExceptionS tate& exceptionState) 263 IDBTransaction* IDBDatabase::transaction(ScriptState* scriptState, const StringO rStringSequenceOrDOMStringList& storeNames, const String& modeString, ExceptionS tate& exceptionState)
264 { 264 {
265 IDB_TRACE("IDBDatabase::transaction"); 265 IDB_TRACE("IDBDatabase::transaction");
266 Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEndAPICall s", IDBTransactionCall, IDBMethodsMax); 266 recordApiCallsHistogram(IDBTransactionCall);
267 267
268 HashSet<String> scope; 268 HashSet<String> scope;
269 if (storeNames.isString()) { 269 if (storeNames.isString()) {
270 scope.add(storeNames.getAsString()); 270 scope.add(storeNames.getAsString());
271 } else if (storeNames.isStringSequence()) { 271 } else if (storeNames.isStringSequence()) {
272 for (const String& name : storeNames.getAsStringSequence()) 272 for (const String& name : storeNames.getAsStringSequence())
273 scope.add(name); 273 scope.add(name);
274 } else if (storeNames.isDOMStringList()) { 274 } else if (storeNames.isDOMStringList()) {
275 const Vector<String>& list = *storeNames.getAsDOMStringList(); 275 const Vector<String>& list = *storeNames.getAsDOMStringList();
276 for (const String& name : list) 276 for (const String& name : list)
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 const AtomicString& IDBDatabase::interfaceName() const 447 const AtomicString& IDBDatabase::interfaceName() const
448 { 448 {
449 return EventTargetNames::IDBDatabase; 449 return EventTargetNames::IDBDatabase;
450 } 450 }
451 451
452 ExecutionContext* IDBDatabase::executionContext() const 452 ExecutionContext* IDBDatabase::executionContext() const
453 { 453 {
454 return ActiveDOMObject::executionContext(); 454 return ActiveDOMObject::executionContext();
455 } 455 }
456 456
457 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method)
458 {
459 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, apiCallsHistogram, new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", IDBMethodsMax));
460 apiCallsHistogram.count(method);
461 }
462
457 } // namespace blink 463 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698