| OLD | NEW |
| 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 16 matching lines...) Expand all Loading... |
| 27 #define IDBDatabase_h | 27 #define IDBDatabase_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScriptState.h" | 29 #include "bindings/core/v8/ScriptState.h" |
| 30 #include "bindings/modules/v8/UnionTypesModules.h" | 30 #include "bindings/modules/v8/UnionTypesModules.h" |
| 31 #include "core/dom/ActiveDOMObject.h" | 31 #include "core/dom/ActiveDOMObject.h" |
| 32 #include "core/dom/DOMStringList.h" | 32 #include "core/dom/DOMStringList.h" |
| 33 #include "modules/EventModules.h" | 33 #include "modules/EventModules.h" |
| 34 #include "modules/EventTargetModules.h" | 34 #include "modules/EventTargetModules.h" |
| 35 #include "modules/ModulesExport.h" | 35 #include "modules/ModulesExport.h" |
| 36 #include "modules/indexeddb/IDBDatabaseCallbacks.h" | 36 #include "modules/indexeddb/IDBDatabaseCallbacks.h" |
| 37 #include "modules/indexeddb/IDBHistograms.h" |
| 37 #include "modules/indexeddb/IDBMetadata.h" | 38 #include "modules/indexeddb/IDBMetadata.h" |
| 38 #include "modules/indexeddb/IDBObjectStore.h" | 39 #include "modules/indexeddb/IDBObjectStore.h" |
| 39 #include "modules/indexeddb/IDBObjectStoreParameters.h" | 40 #include "modules/indexeddb/IDBObjectStoreParameters.h" |
| 40 #include "modules/indexeddb/IDBTransaction.h" | 41 #include "modules/indexeddb/IDBTransaction.h" |
| 41 #include "modules/indexeddb/IndexedDB.h" | 42 #include "modules/indexeddb/IndexedDB.h" |
| 42 #include "platform/heap/Handle.h" | 43 #include "platform/heap/Handle.h" |
| 43 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" | 44 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" |
| 44 #include "wtf/OwnPtr.h" | 45 #include "wtf/OwnPtr.h" |
| 45 #include "wtf/PassOwnPtr.h" | 46 #include "wtf/PassOwnPtr.h" |
| 46 #include "wtf/PassRefPtr.h" | 47 #include "wtf/PassRefPtr.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 static const char notValidKeyErrorMessage[]; | 123 static const char notValidKeyErrorMessage[]; |
| 123 static const char notVersionChangeTransactionErrorMessage[]; | 124 static const char notVersionChangeTransactionErrorMessage[]; |
| 124 static const char objectStoreDeletedErrorMessage[]; | 125 static const char objectStoreDeletedErrorMessage[]; |
| 125 static const char requestNotFinishedErrorMessage[]; | 126 static const char requestNotFinishedErrorMessage[]; |
| 126 static const char sourceDeletedErrorMessage[]; | 127 static const char sourceDeletedErrorMessage[]; |
| 127 static const char transactionFinishedErrorMessage[]; | 128 static const char transactionFinishedErrorMessage[]; |
| 128 static const char transactionInactiveErrorMessage[]; | 129 static const char transactionInactiveErrorMessage[]; |
| 129 static const char transactionReadOnlyErrorMessage[]; | 130 static const char transactionReadOnlyErrorMessage[]; |
| 130 static const char databaseClosedErrorMessage[]; | 131 static const char databaseClosedErrorMessage[]; |
| 131 | 132 |
| 133 static void recordApiCallsHistogram(IndexedDatabaseMethods); |
| 134 |
| 132 protected: | 135 protected: |
| 133 // EventTarget | 136 // EventTarget |
| 134 bool dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) override; | 137 bool dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) override; |
| 135 | 138 |
| 136 private: | 139 private: |
| 137 IDBDatabase(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, IDBDatabaseCallba
cks*); | 140 IDBDatabase(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, IDBDatabaseCallba
cks*); |
| 138 | 141 |
| 139 IDBObjectStore* createObjectStore(const String& name, const IDBKeyPath&, boo
l autoIncrement, ExceptionState&); | 142 IDBObjectStore* createObjectStore(const String& name, const IDBKeyPath&, boo
l autoIncrement, ExceptionState&); |
| 140 void closeConnection(); | 143 void closeConnection(); |
| 141 | 144 |
| 142 IDBDatabaseMetadata m_metadata; | 145 IDBDatabaseMetadata m_metadata; |
| 143 OwnPtr<WebIDBDatabase> m_backend; | 146 OwnPtr<WebIDBDatabase> m_backend; |
| 144 Member<IDBTransaction> m_versionChangeTransaction; | 147 Member<IDBTransaction> m_versionChangeTransaction; |
| 145 HeapHashMap<int64_t, Member<IDBTransaction>> m_transactions; | 148 HeapHashMap<int64_t, Member<IDBTransaction>> m_transactions; |
| 146 | 149 |
| 147 bool m_closePending = false; | 150 bool m_closePending = false; |
| 148 bool m_contextStopped = false; | 151 bool m_contextStopped = false; |
| 149 | 152 |
| 150 // Keep track of the versionchange events waiting to be fired on this | 153 // Keep track of the versionchange events waiting to be fired on this |
| 151 // database so that we can cancel them if the database closes. | 154 // database so that we can cancel them if the database closes. |
| 152 WillBeHeapVector<RefPtrWillBeMember<Event>> m_enqueuedEvents; | 155 WillBeHeapVector<RefPtrWillBeMember<Event>> m_enqueuedEvents; |
| 153 | 156 |
| 154 Member<IDBDatabaseCallbacks> m_databaseCallbacks; | 157 Member<IDBDatabaseCallbacks> m_databaseCallbacks; |
| 155 }; | 158 }; |
| 156 | 159 |
| 157 } // namespace blink | 160 } // namespace blink |
| 158 | 161 |
| 159 #endif // IDBDatabase_h | 162 #endif // IDBDatabase_h |
| OLD | NEW |