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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class ExceptionState; | 49 class ExceptionState; |
50 class ExecutionContext; | 50 class ExecutionContext; |
51 | 51 |
52 class IDBDatabase FINAL | 52 class IDBDatabase FINAL |
53 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<IDBDataba
se> | 53 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<IDBDataba
se> |
54 , public EventTargetWithInlineData | 54 , public EventTargetWithInlineData |
55 , public ActiveDOMObject { | 55 , public ActiveDOMObject { |
56 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<I
DBDatabase>); | 56 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<I
DBDatabase>); |
57 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); | 57 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); |
58 public: | 58 public: |
59 static IDBDatabase* create(ExecutionContext*, PassOwnPtr<blink::WebIDBDataba
se>, IDBDatabaseCallbacks*); | 59 static IDBDatabase* create(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, ID
BDatabaseCallbacks*); |
60 virtual ~IDBDatabase(); | 60 virtual ~IDBDatabase(); |
61 virtual void trace(Visitor*) OVERRIDE; | 61 virtual void trace(Visitor*) OVERRIDE; |
62 | 62 |
63 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } | 63 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } |
64 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); | 64 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); |
65 void indexDeleted(int64_t objectStoreId, int64_t indexId); | 65 void indexDeleted(int64_t objectStoreId, int64_t indexId); |
66 void transactionCreated(IDBTransaction*); | 66 void transactionCreated(IDBTransaction*); |
67 void transactionFinished(const IDBTransaction*); | 67 void transactionFinished(const IDBTransaction*); |
68 | 68 |
69 // Implement the IDL | 69 // Implement the IDL |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 using EventTarget::dispatchEvent; | 105 using EventTarget::dispatchEvent; |
106 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; | 106 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; |
107 | 107 |
108 int64_t findObjectStoreId(const String& name) const; | 108 int64_t findObjectStoreId(const String& name) const; |
109 bool containsObjectStore(const String& name) const | 109 bool containsObjectStore(const String& name) const |
110 { | 110 { |
111 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; | 111 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; |
112 } | 112 } |
113 | 113 |
114 // Will return nullptr if this database is stopped. | 114 // Will return nullptr if this database is stopped. |
115 blink::WebIDBDatabase* backend() const { return m_backend.get(); } | 115 WebIDBDatabase* backend() const { return m_backend.get(); } |
116 | 116 |
117 static int64_t nextTransactionId(); | 117 static int64_t nextTransactionId(); |
118 | 118 |
119 void ackReceivedBlobs(const Vector<blink::WebBlobInfo>*); | 119 void ackReceivedBlobs(const Vector<WebBlobInfo>*); |
120 | 120 |
121 static const char indexDeletedErrorMessage[]; | 121 static const char indexDeletedErrorMessage[]; |
122 static const char isKeyCursorErrorMessage[]; | 122 static const char isKeyCursorErrorMessage[]; |
123 static const char noKeyOrKeyRangeErrorMessage[]; | 123 static const char noKeyOrKeyRangeErrorMessage[]; |
124 static const char noSuchIndexErrorMessage[]; | 124 static const char noSuchIndexErrorMessage[]; |
125 static const char noSuchObjectStoreErrorMessage[]; | 125 static const char noSuchObjectStoreErrorMessage[]; |
126 static const char noValueErrorMessage[]; | 126 static const char noValueErrorMessage[]; |
127 static const char notValidKeyErrorMessage[]; | 127 static const char notValidKeyErrorMessage[]; |
128 static const char notVersionChangeTransactionErrorMessage[]; | 128 static const char notVersionChangeTransactionErrorMessage[]; |
129 static const char objectStoreDeletedErrorMessage[]; | 129 static const char objectStoreDeletedErrorMessage[]; |
130 static const char requestNotFinishedErrorMessage[]; | 130 static const char requestNotFinishedErrorMessage[]; |
131 static const char sourceDeletedErrorMessage[]; | 131 static const char sourceDeletedErrorMessage[]; |
132 static const char transactionFinishedErrorMessage[]; | 132 static const char transactionFinishedErrorMessage[]; |
133 static const char transactionInactiveErrorMessage[]; | 133 static const char transactionInactiveErrorMessage[]; |
134 static const char transactionReadOnlyErrorMessage[]; | 134 static const char transactionReadOnlyErrorMessage[]; |
135 static const char databaseClosedErrorMessage[]; | 135 static const char databaseClosedErrorMessage[]; |
136 | 136 |
137 private: | 137 private: |
138 IDBDatabase(ExecutionContext*, PassOwnPtr<blink::WebIDBDatabase>, IDBDatabas
eCallbacks*); | 138 IDBDatabase(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, IDBDatabaseCallba
cks*); |
139 | 139 |
140 void closeConnection(); | 140 void closeConnection(); |
141 | 141 |
142 IDBDatabaseMetadata m_metadata; | 142 IDBDatabaseMetadata m_metadata; |
143 OwnPtr<blink::WebIDBDatabase> m_backend; | 143 OwnPtr<WebIDBDatabase> m_backend; |
144 Member<IDBTransaction> m_versionChangeTransaction; | 144 Member<IDBTransaction> m_versionChangeTransaction; |
145 typedef HeapHashMap<int64_t, Member<IDBTransaction> > TransactionMap; | 145 typedef HeapHashMap<int64_t, Member<IDBTransaction> > TransactionMap; |
146 TransactionMap m_transactions; | 146 TransactionMap m_transactions; |
147 | 147 |
148 bool m_closePending; | 148 bool m_closePending; |
149 bool m_contextStopped; | 149 bool m_contextStopped; |
150 | 150 |
151 // Keep track of the versionchange events waiting to be fired on this | 151 // Keep track of the versionchange events waiting to be fired on this |
152 // database so that we can cancel them if the database closes. | 152 // database so that we can cancel them if the database closes. |
153 WillBeHeapVector<RefPtrWillBeMember<Event> > m_enqueuedEvents; | 153 WillBeHeapVector<RefPtrWillBeMember<Event> > m_enqueuedEvents; |
154 | 154 |
155 Member<IDBDatabaseCallbacks> m_databaseCallbacks; | 155 Member<IDBDatabaseCallbacks> m_databaseCallbacks; |
156 }; | 156 }; |
157 | 157 |
158 } // namespace blink | 158 } // namespace blink |
159 | 159 |
160 #endif // IDBDatabase_h | 160 #endif // IDBDatabase_h |
OLD | NEW |