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

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

Issue 1241613004: Rework dispatchEvent so it is consistent for isTrusted support. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Work around MSVC optimization bug Created 5 years, 5 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 // EventTarget 96 // EventTarget
97 const AtomicString& interfaceName() const override; 97 const AtomicString& interfaceName() const override;
98 ExecutionContext* executionContext() const override; 98 ExecutionContext* executionContext() const override;
99 99
100 bool isClosePending() const { return m_closePending; } 100 bool isClosePending() const { return m_closePending; }
101 void forceClose(); 101 void forceClose();
102 const IDBDatabaseMetadata& metadata() const { return m_metadata; } 102 const IDBDatabaseMetadata& metadata() const { return m_metadata; }
103 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); 103 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>);
104 104
105 using EventTarget::dispatchEvent;
106 bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) override;
107
108 int64_t findObjectStoreId(const String& name) const; 105 int64_t findObjectStoreId(const String& name) const;
109 bool containsObjectStore(const String& name) const 106 bool containsObjectStore(const String& name) const
110 { 107 {
111 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; 108 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId;
112 } 109 }
113 110
114 // Will return nullptr if this database is stopped. 111 // Will return nullptr if this database is stopped.
115 WebIDBDatabase* backend() const { return m_backend.get(); } 112 WebIDBDatabase* backend() const { return m_backend.get(); }
116 113
117 static int64_t nextTransactionId(); 114 static int64_t nextTransactionId();
118 115
119 static const char indexDeletedErrorMessage[]; 116 static const char indexDeletedErrorMessage[];
120 static const char isKeyCursorErrorMessage[]; 117 static const char isKeyCursorErrorMessage[];
121 static const char noKeyOrKeyRangeErrorMessage[]; 118 static const char noKeyOrKeyRangeErrorMessage[];
122 static const char noSuchIndexErrorMessage[]; 119 static const char noSuchIndexErrorMessage[];
123 static const char noSuchObjectStoreErrorMessage[]; 120 static const char noSuchObjectStoreErrorMessage[];
124 static const char noValueErrorMessage[]; 121 static const char noValueErrorMessage[];
125 static const char notValidKeyErrorMessage[]; 122 static const char notValidKeyErrorMessage[];
126 static const char notVersionChangeTransactionErrorMessage[]; 123 static const char notVersionChangeTransactionErrorMessage[];
127 static const char objectStoreDeletedErrorMessage[]; 124 static const char objectStoreDeletedErrorMessage[];
128 static const char requestNotFinishedErrorMessage[]; 125 static const char requestNotFinishedErrorMessage[];
129 static const char sourceDeletedErrorMessage[]; 126 static const char sourceDeletedErrorMessage[];
130 static const char transactionFinishedErrorMessage[]; 127 static const char transactionFinishedErrorMessage[];
131 static const char transactionInactiveErrorMessage[]; 128 static const char transactionInactiveErrorMessage[];
132 static const char transactionReadOnlyErrorMessage[]; 129 static const char transactionReadOnlyErrorMessage[];
133 static const char databaseClosedErrorMessage[]; 130 static const char databaseClosedErrorMessage[];
134 static const char notValidMaxCountErrorMessage[]; 131 static const char notValidMaxCountErrorMessage[];
135 132
133 protected:
134 // EventTarget
135 bool dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) override;
136
136 private: 137 private:
137 IDBDatabase(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, IDBDatabaseCallba cks*); 138 IDBDatabase(ExecutionContext*, PassOwnPtr<WebIDBDatabase>, IDBDatabaseCallba cks*);
138 139
139 IDBObjectStore* createObjectStore(const String& name, const IDBKeyPath&, boo l autoIncrement, ExceptionState&); 140 IDBObjectStore* createObjectStore(const String& name, const IDBKeyPath&, boo l autoIncrement, ExceptionState&);
140 void closeConnection(); 141 void closeConnection();
141 142
142 IDBDatabaseMetadata m_metadata; 143 IDBDatabaseMetadata m_metadata;
143 OwnPtr<WebIDBDatabase> m_backend; 144 OwnPtr<WebIDBDatabase> m_backend;
144 Member<IDBTransaction> m_versionChangeTransaction; 145 Member<IDBTransaction> m_versionChangeTransaction;
145 typedef HeapHashMap<int64_t, Member<IDBTransaction>> TransactionMap; 146 typedef HeapHashMap<int64_t, Member<IDBTransaction>> TransactionMap;
146 TransactionMap m_transactions; 147 TransactionMap m_transactions;
147 148
148 bool m_closePending; 149 bool m_closePending;
149 bool m_contextStopped; 150 bool m_contextStopped;
150 151
151 // Keep track of the versionchange events waiting to be fired on this 152 // Keep track of the versionchange events waiting to be fired on this
152 // database so that we can cancel them if the database closes. 153 // database so that we can cancel them if the database closes.
153 WillBeHeapVector<RefPtrWillBeMember<Event>> m_enqueuedEvents; 154 WillBeHeapVector<RefPtrWillBeMember<Event>> m_enqueuedEvents;
154 155
155 Member<IDBDatabaseCallbacks> m_databaseCallbacks; 156 Member<IDBDatabaseCallbacks> m_databaseCallbacks;
156 }; 157 };
157 158
158 } // namespace blink 159 } // namespace blink
159 160
160 #endif // IDBDatabase_h 161 #endif // IDBDatabase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698