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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); | 59 USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); |
60 DEFINE_WRAPPERTYPEINFO(); | 60 DEFINE_WRAPPERTYPEINFO(); |
61 | 61 |
62 public: | 62 public: |
63 static IDBDatabase* create(ExecutionContext*, | 63 static IDBDatabase* create(ExecutionContext*, |
64 std::unique_ptr<WebIDBDatabase>, | 64 std::unique_ptr<WebIDBDatabase>, |
65 IDBDatabaseCallbacks*); | 65 IDBDatabaseCallbacks*); |
66 ~IDBDatabase() override; | 66 ~IDBDatabase() override; |
67 DECLARE_VIRTUAL_TRACE(); | 67 DECLARE_VIRTUAL_TRACE(); |
68 | 68 |
69 void setMetadata(const IDBDatabaseMetadata& metadata) { | 69 // Overwrites the database metadata, including object store and index |
70 m_metadata = metadata; | 70 // metadata. |
jsbell
2016/10/06 20:01:31
Can you clarify in the comments why we need both o
pwnall
2016/10/06 22:15:22
Done.
| |
71 } | 71 void setMetadata(const IDBDatabaseMetadata&); |
72 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); | 72 // Overwrites the database's own metadata, but does not change object store |
73 void indexDeleted(int64_t objectStoreId, int64_t indexId); | 73 // and index metadata. |
74 void indexRenamed(int64_t objectStoreId, | 74 void setDatabaseMetadata(const IDBDatabaseMetadata&); |
75 int64_t indexId, | |
76 const String& newName); | |
77 void transactionCreated(IDBTransaction*); | 75 void transactionCreated(IDBTransaction*); |
78 void transactionFinished(const IDBTransaction*); | 76 void transactionFinished(const IDBTransaction*); |
79 const String& getObjectStoreName(int64_t objectStoreId) const; | 77 const String& getObjectStoreName(int64_t objectStoreId) const; |
80 | 78 |
81 // Implement the IDL | 79 // Implement the IDL |
82 const String& name() const { return m_metadata.name; } | 80 const String& name() const { return m_metadata.name; } |
83 unsigned long long version() const { return m_metadata.version; } | 81 unsigned long long version() const { return m_metadata.version; } |
84 DOMStringList* objectStoreNames() const; | 82 DOMStringList* objectStoreNames() const; |
85 | 83 |
86 IDBObjectStore* createObjectStore(const String& name, | 84 IDBObjectStore* createObjectStore(const String& name, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 | 117 |
120 bool isClosePending() const { return m_closePending; } | 118 bool isClosePending() const { return m_closePending; } |
121 void forceClose(); | 119 void forceClose(); |
122 const IDBDatabaseMetadata& metadata() const { return m_metadata; } | 120 const IDBDatabaseMetadata& metadata() const { return m_metadata; } |
123 void enqueueEvent(Event*); | 121 void enqueueEvent(Event*); |
124 | 122 |
125 int64_t findObjectStoreId(const String& name) const; | 123 int64_t findObjectStoreId(const String& name) const; |
126 bool containsObjectStore(const String& name) const { | 124 bool containsObjectStore(const String& name) const { |
127 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; | 125 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; |
128 } | 126 } |
129 void objectStoreRenamed(int64_t storeId, const String& newName); | 127 void renameObjectStore(int64_t storeId, const String& newName); |
128 void revertObjectStoreCreation(int64_t objectStoreId); | |
129 void revertObjectStoreMetadata(RefPtr<IDBObjectStoreMetadata> oldMetadata); | |
130 | 130 |
131 // Will return nullptr if this database is stopped. | 131 // Will return nullptr if this database is stopped. |
132 WebIDBDatabase* backend() const { return m_backend.get(); } | 132 WebIDBDatabase* backend() const { return m_backend.get(); } |
133 | 133 |
134 static int64_t nextTransactionId(); | 134 static int64_t nextTransactionId(); |
135 | 135 |
136 static const char indexDeletedErrorMessage[]; | 136 static const char indexDeletedErrorMessage[]; |
137 static const char indexNameTakenErrorMessage[]; | 137 static const char indexNameTakenErrorMessage[]; |
138 static const char isKeyCursorErrorMessage[]; | 138 static const char isKeyCursorErrorMessage[]; |
139 static const char noKeyOrKeyRangeErrorMessage[]; | 139 static const char noKeyOrKeyRangeErrorMessage[]; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 // Keep track of the versionchange events waiting to be fired on this | 179 // Keep track of the versionchange events waiting to be fired on this |
180 // database so that we can cancel them if the database closes. | 180 // database so that we can cancel them if the database closes. |
181 HeapVector<Member<Event>> m_enqueuedEvents; | 181 HeapVector<Member<Event>> m_enqueuedEvents; |
182 | 182 |
183 Member<IDBDatabaseCallbacks> m_databaseCallbacks; | 183 Member<IDBDatabaseCallbacks> m_databaseCallbacks; |
184 }; | 184 }; |
185 | 185 |
186 } // namespace blink | 186 } // namespace blink |
187 | 187 |
188 #endif // IDBDatabase_h | 188 #endif // IDBDatabase_h |
OLD | NEW |