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

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

Issue 44453002: Remove HistogramSupport abstraction layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/xml/XMLHttpRequest.cpp ('k') | Source/modules/indexeddb/IDBFactory.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 14 matching lines...) Expand all
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "modules/indexeddb/IDBDatabase.h" 27 #include "modules/indexeddb/IDBDatabase.h"
28 28
29 #include "bindings/v8/ExceptionState.h" 29 #include "bindings/v8/ExceptionState.h"
30 #include "bindings/v8/ExceptionStatePlaceholder.h" 30 #include "bindings/v8/ExceptionStatePlaceholder.h"
31 #include "core/dom/DOMStringList.h" 31 #include "core/dom/DOMStringList.h"
32 #include "core/dom/ExecutionContext.h" 32 #include "core/dom/ExecutionContext.h"
33 #include "core/events/EventQueue.h" 33 #include "core/events/EventQueue.h"
34 #include "core/inspector/ScriptCallStack.h" 34 #include "core/inspector/ScriptCallStack.h"
35 #include "core/platform/HistogramSupport.h"
36 #include "modules/indexeddb/IDBAny.h" 35 #include "modules/indexeddb/IDBAny.h"
37 #include "modules/indexeddb/IDBDatabaseCallbacks.h" 36 #include "modules/indexeddb/IDBDatabaseCallbacks.h"
38 #include "modules/indexeddb/IDBEventDispatcher.h" 37 #include "modules/indexeddb/IDBEventDispatcher.h"
39 #include "modules/indexeddb/IDBHistograms.h" 38 #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/IDBObjectStore.h" 41 #include "modules/indexeddb/IDBObjectStore.h"
43 #include "modules/indexeddb/IDBTracing.h" 42 #include "modules/indexeddb/IDBTracing.h"
44 #include "modules/indexeddb/IDBTransaction.h" 43 #include "modules/indexeddb/IDBTransaction.h"
45 #include "modules/indexeddb/IDBVersionChangeEvent.h" 44 #include "modules/indexeddb/IDBVersionChangeEvent.h"
45 #include "public/platform/Platform.h"
46 #include "wtf/Atomics.h"
46 #include <limits> 47 #include <limits>
47 #include "wtf/Atomics.h"
48 48
49 namespace WebCore { 49 namespace WebCore {
50 50
51 const char IDBDatabase::indexDeletedErrorMessage[] = "The index or its object st ore has been deleted."; 51 const char IDBDatabase::indexDeletedErrorMessage[] = "The index or its object st ore has been deleted.";
52 const char IDBDatabase::isKeyCursorErrorMessage[] = "The cursor is a key cursor. "; 52 const char IDBDatabase::isKeyCursorErrorMessage[] = "The cursor is a key cursor. ";
53 const char IDBDatabase::noKeyOrKeyRangeErrorMessage[] = "No key or key range spe cified."; 53 const char IDBDatabase::noKeyOrKeyRangeErrorMessage[] = "No key or key range spe cified.";
54 const char IDBDatabase::noSuchIndexErrorMessage[] = "The specified index was not found."; 54 const char IDBDatabase::noSuchIndexErrorMessage[] = "The specified index was not found.";
55 const char IDBDatabase::noSuchObjectStoreErrorMessage[] = "The specified object store was not found."; 55 const char IDBDatabase::noSuchObjectStoreErrorMessage[] = "The specified object store was not found.";
56 const char IDBDatabase::noValueErrorMessage[] = "The cursor is being iterated or has iterated past its end."; 56 const char IDBDatabase::noValueErrorMessage[] = "The cursor is being iterated or has iterated past its end.";
57 const char IDBDatabase::notValidKeyErrorMessage[] = "The parameter is not a vali d key."; 57 const char IDBDatabase::notValidKeyErrorMessage[] = "The parameter is not a vali d key.";
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 options.get("autoIncrement", autoIncrement); 180 options.get("autoIncrement", autoIncrement);
181 } 181 }
182 182
183 return createObjectStore(name, keyPath, autoIncrement, es); 183 return createObjectStore(name, keyPath, autoIncrement, es);
184 } 184 }
185 185
186 PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, co nst IDBKeyPath& keyPath, bool autoIncrement, ExceptionState& es) 186 PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, co nst IDBKeyPath& keyPath, bool autoIncrement, ExceptionState& es)
187 { 187 {
188 IDB_TRACE("IDBDatabase::createObjectStore"); 188 IDB_TRACE("IDBDatabase::createObjectStore");
189 HistogramSupport::histogramEnumeration("WebCore.IndexedDB.FrontEndAPICalls", IDBCreateObjectStoreCall, IDBMethodsMax); 189 WebKit::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEn dAPICalls", IDBCreateObjectStoreCall, IDBMethodsMax);
190 if (!m_versionChangeTransaction) { 190 if (!m_versionChangeTransaction) {
191 es.throwDOMException(InvalidStateError, IDBDatabase::notVersionChangeTra nsactionErrorMessage); 191 es.throwDOMException(InvalidStateError, IDBDatabase::notVersionChangeTra nsactionErrorMessage);
192 return 0; 192 return 0;
193 } 193 }
194 if (m_versionChangeTransaction->isFinished()) { 194 if (m_versionChangeTransaction->isFinished()) {
195 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionF inishedErrorMessage); 195 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionF inishedErrorMessage);
196 return 0; 196 return 0;
197 } 197 }
198 if (!m_versionChangeTransaction->isActive()) { 198 if (!m_versionChangeTransaction->isActive()) {
199 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionI nactiveErrorMessage); 199 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionI nactiveErrorMessage);
(...skipping 23 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.release(); 227 return objectStore.release();
228 } 228 }
229 229
230 void IDBDatabase::deleteObjectStore(const String& name, ExceptionState& es) 230 void IDBDatabase::deleteObjectStore(const String& name, ExceptionState& es)
231 { 231 {
232 IDB_TRACE("IDBDatabase::deleteObjectStore"); 232 IDB_TRACE("IDBDatabase::deleteObjectStore");
233 HistogramSupport::histogramEnumeration("WebCore.IndexedDB.FrontEndAPICalls", IDBDeleteObjectStoreCall, IDBMethodsMax); 233 WebKit::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEn dAPICalls", IDBDeleteObjectStoreCall, IDBMethodsMax);
234 if (!m_versionChangeTransaction) { 234 if (!m_versionChangeTransaction) {
235 es.throwDOMException(InvalidStateError, IDBDatabase::notVersionChangeTra nsactionErrorMessage); 235 es.throwDOMException(InvalidStateError, IDBDatabase::notVersionChangeTra nsactionErrorMessage);
236 return; 236 return;
237 } 237 }
238 if (m_versionChangeTransaction->isFinished()) { 238 if (m_versionChangeTransaction->isFinished()) {
239 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionF inishedErrorMessage); 239 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionF inishedErrorMessage);
240 return; 240 return;
241 } 241 }
242 if (!m_versionChangeTransaction->isActive()) { 242 if (!m_versionChangeTransaction->isActive()) {
243 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionI nactiveErrorMessage); 243 es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionI nactiveErrorMessage);
244 return; 244 return;
245 } 245 }
246 246
247 int64_t objectStoreId = findObjectStoreId(name); 247 int64_t objectStoreId = findObjectStoreId(name);
248 if (objectStoreId == IDBObjectStoreMetadata::InvalidId) { 248 if (objectStoreId == IDBObjectStoreMetadata::InvalidId) {
249 es.throwDOMException(NotFoundError, "The specified object store was not found."); 249 es.throwDOMException(NotFoundError, "The specified object store was not found.");
250 return; 250 return;
251 } 251 }
252 252
253 m_backend->deleteObjectStore(m_versionChangeTransaction->id(), objectStoreId ); 253 m_backend->deleteObjectStore(m_versionChangeTransaction->id(), objectStoreId );
254 m_versionChangeTransaction->objectStoreDeleted(name); 254 m_versionChangeTransaction->objectStoreDeleted(name);
255 m_metadata.objectStores.remove(objectStoreId); 255 m_metadata.objectStores.remove(objectStoreId);
256 } 256 }
257 257
258 PassRefPtr<IDBTransaction> IDBDatabase::transaction(ExecutionContext* context, c onst Vector<String>& scope, const String& modeString, ExceptionState& es) 258 PassRefPtr<IDBTransaction> IDBDatabase::transaction(ExecutionContext* context, c onst Vector<String>& scope, const String& modeString, ExceptionState& es)
259 { 259 {
260 IDB_TRACE("IDBDatabase::transaction"); 260 IDB_TRACE("IDBDatabase::transaction");
261 HistogramSupport::histogramEnumeration("WebCore.IndexedDB.FrontEndAPICalls", IDBTransactionCall, IDBMethodsMax); 261 WebKit::Platform::current()->histogramEnumeration("WebCore.IndexedDB.FrontEn dAPICalls", IDBTransactionCall, IDBMethodsMax);
262 if (!scope.size()) { 262 if (!scope.size()) {
263 es.throwDOMException(InvalidAccessError, "The storeNames parameter was e mpty."); 263 es.throwDOMException(InvalidAccessError, "The storeNames parameter was e mpty.");
264 return 0; 264 return 0;
265 } 265 }
266 266
267 IndexedDB::TransactionMode mode = IDBTransaction::stringToMode(modeString, e s); 267 IndexedDB::TransactionMode mode = IDBTransaction::stringToMode(modeString, e s);
268 if (es.hadException()) 268 if (es.hadException())
269 return 0; 269 return 0;
270 270
271 if (m_versionChangeTransaction) { 271 if (m_versionChangeTransaction) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 { 408 {
409 return EventTargetNames::IDBDatabase; 409 return EventTargetNames::IDBDatabase;
410 } 410 }
411 411
412 ExecutionContext* IDBDatabase::executionContext() const 412 ExecutionContext* IDBDatabase::executionContext() const
413 { 413 {
414 return ActiveDOMObject::executionContext(); 414 return ActiveDOMObject::executionContext();
415 } 415 }
416 416
417 } // namespace WebCore 417 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/xml/XMLHttpRequest.cpp ('k') | Source/modules/indexeddb/IDBFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698