| 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 29 matching lines...) Expand all Loading... |
| 40 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
| 41 #include "wtf/RefCounted.h" | 41 #include "wtf/RefCounted.h" |
| 42 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 class DOMError; | 46 class DOMError; |
| 47 class ExceptionState; | 47 class ExceptionState; |
| 48 class ScriptExecutionContext; | 48 class ScriptExecutionContext; |
| 49 | 49 |
| 50 class IDBDatabase : public RefCounted<IDBDatabase>, public ScriptWrappable, publ
ic EventTarget, public ActiveDOMObject { | 50 class IDBDatabase : public RefCounted<IDBDatabase>, public ScriptWrappable, publ
ic EventTargetWithInlineData, public ActiveDOMObject { |
| 51 public: | 51 public: |
| 52 static PassRefPtr<IDBDatabase> create(ScriptExecutionContext*, PassRefPtr<ID
BDatabaseBackendInterface>, PassRefPtr<IDBDatabaseCallbacks>); | 52 static PassRefPtr<IDBDatabase> create(ScriptExecutionContext*, PassRefPtr<ID
BDatabaseBackendInterface>, PassRefPtr<IDBDatabaseCallbacks>); |
| 53 ~IDBDatabase(); | 53 ~IDBDatabase(); |
| 54 | 54 |
| 55 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } | 55 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } |
| 56 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); | 56 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); |
| 57 void indexDeleted(int64_t objectStoreId, int64_t indexId); | 57 void indexDeleted(int64_t objectStoreId, int64_t indexId); |
| 58 void transactionCreated(IDBTransaction*); | 58 void transactionCreated(IDBTransaction*); |
| 59 void transactionFinished(IDBTransaction*); | 59 void transactionFinished(IDBTransaction*); |
| 60 | 60 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 79 // IDBDatabaseCallbacks | 79 // IDBDatabaseCallbacks |
| 80 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion); | 80 virtual void onVersionChange(int64_t oldVersion, int64_t newVersion); |
| 81 virtual void onAbort(int64_t, PassRefPtr<DOMError>); | 81 virtual void onAbort(int64_t, PassRefPtr<DOMError>); |
| 82 virtual void onComplete(int64_t); | 82 virtual void onComplete(int64_t); |
| 83 | 83 |
| 84 // ActiveDOMObject | 84 // ActiveDOMObject |
| 85 virtual bool hasPendingActivity() const OVERRIDE; | 85 virtual bool hasPendingActivity() const OVERRIDE; |
| 86 virtual void stop() OVERRIDE; | 86 virtual void stop() OVERRIDE; |
| 87 | 87 |
| 88 // EventTarget | 88 // EventTarget |
| 89 virtual const AtomicString& interfaceName() const; | 89 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 90 virtual ScriptExecutionContext* scriptExecutionContext() const; | 90 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; |
| 91 | 91 |
| 92 bool isClosePending() const { return m_closePending; } | 92 bool isClosePending() const { return m_closePending; } |
| 93 void forceClose(); | 93 void forceClose(); |
| 94 const IDBDatabaseMetadata& metadata() const { return m_metadata; } | 94 const IDBDatabaseMetadata& metadata() const { return m_metadata; } |
| 95 void enqueueEvent(PassRefPtr<Event>); | 95 void enqueueEvent(PassRefPtr<Event>); |
| 96 | 96 |
| 97 using EventTarget::dispatchEvent; | 97 using EventTarget::dispatchEvent; |
| 98 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; | 98 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; |
| 99 | 99 |
| 100 int64_t findObjectStoreId(const String& name) const; | 100 int64_t findObjectStoreId(const String& name) const; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 121 static const char transactionFinishedErrorMessage[]; | 121 static const char transactionFinishedErrorMessage[]; |
| 122 static const char transactionInactiveErrorMessage[]; | 122 static const char transactionInactiveErrorMessage[]; |
| 123 | 123 |
| 124 using RefCounted<IDBDatabase>::ref; | 124 using RefCounted<IDBDatabase>::ref; |
| 125 using RefCounted<IDBDatabase>::deref; | 125 using RefCounted<IDBDatabase>::deref; |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 IDBDatabase(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendInterface>
, PassRefPtr<IDBDatabaseCallbacks>); | 128 IDBDatabase(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendInterface>
, PassRefPtr<IDBDatabaseCallbacks>); |
| 129 | 129 |
| 130 // EventTarget | 130 // EventTarget |
| 131 virtual void refEventTarget() { ref(); } | 131 virtual void refEventTarget() OVERRIDE { ref(); } |
| 132 virtual void derefEventTarget() { deref(); } | 132 virtual void derefEventTarget() OVERRIDE { deref(); } |
| 133 virtual EventTargetData* eventTargetData(); | |
| 134 virtual EventTargetData* ensureEventTargetData(); | |
| 135 | 133 |
| 136 void closeConnection(); | 134 void closeConnection(); |
| 137 | 135 |
| 138 IDBDatabaseMetadata m_metadata; | 136 IDBDatabaseMetadata m_metadata; |
| 139 RefPtr<IDBDatabaseBackendInterface> m_backend; | 137 RefPtr<IDBDatabaseBackendInterface> m_backend; |
| 140 RefPtr<IDBTransaction> m_versionChangeTransaction; | 138 RefPtr<IDBTransaction> m_versionChangeTransaction; |
| 141 typedef HashMap<int64_t, RefPtr<IDBTransaction> > TransactionMap; | 139 typedef HashMap<int64_t, RefPtr<IDBTransaction> > TransactionMap; |
| 142 TransactionMap m_transactions; | 140 TransactionMap m_transactions; |
| 143 | 141 |
| 144 bool m_closePending; | 142 bool m_closePending; |
| 145 bool m_contextStopped; | 143 bool m_contextStopped; |
| 146 | 144 |
| 147 EventTargetData m_eventTargetData; | |
| 148 | |
| 149 // Keep track of the versionchange events waiting to be fired on this | 145 // Keep track of the versionchange events waiting to be fired on this |
| 150 // database so that we can cancel them if the database closes. | 146 // database so that we can cancel them if the database closes. |
| 151 Vector<RefPtr<Event> > m_enqueuedEvents; | 147 Vector<RefPtr<Event> > m_enqueuedEvents; |
| 152 | 148 |
| 153 RefPtr<IDBDatabaseCallbacks> m_databaseCallbacks; | 149 RefPtr<IDBDatabaseCallbacks> m_databaseCallbacks; |
| 154 }; | 150 }; |
| 155 | 151 |
| 156 } // namespace WebCore | 152 } // namespace WebCore |
| 157 | 153 |
| 158 #endif // IDBDatabase_h | 154 #endif // IDBDatabase_h |
| OLD | NEW |