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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 : public EventTargetWithInlineData | 57 : public EventTargetWithInlineData |
58 , public ActiveScriptWrappable | 58 , public ActiveScriptWrappable |
59 , public ActiveDOMObject { | 59 , public ActiveDOMObject { |
60 USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); | 60 USING_GARBAGE_COLLECTED_MIXIN(IDBDatabase); |
61 DEFINE_WRAPPERTYPEINFO(); | 61 DEFINE_WRAPPERTYPEINFO(); |
62 public: | 62 public: |
63 static IDBDatabase* create(ExecutionContext*, std::unique_ptr<WebIDBDatabase
>, IDBDatabaseCallbacks*); | 63 static IDBDatabase* create(ExecutionContext*, std::unique_ptr<WebIDBDatabase
>, IDBDatabaseCallbacks*); |
64 ~IDBDatabase() override; | 64 ~IDBDatabase() override; |
65 DECLARE_VIRTUAL_TRACE(); | 65 DECLARE_VIRTUAL_TRACE(); |
66 | 66 |
67 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } | 67 // Overwrites the database metadata, including object store and index metada
ta. |
68 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); | 68 void setMetadata(const IDBDatabaseMetadata&); |
69 void indexDeleted(int64_t objectStoreId, int64_t indexId); | 69 // Overwrites the database's own metadata, but does not change object store
and index metadata. |
70 void indexRenamed(int64_t objectStoreId, int64_t indexId, const String& newN
ame); | 70 void setDatabaseMetadata(const IDBDatabaseMetadata&); |
71 void transactionCreated(IDBTransaction*); | 71 void transactionCreated(IDBTransaction*); |
72 void transactionFinished(const IDBTransaction*); | 72 void transactionFinished(const IDBTransaction*); |
73 const String& getObjectStoreName(int64_t objectStoreId) const; | 73 const String& getObjectStoreName(int64_t objectStoreId) const; |
74 | 74 |
75 // Implement the IDL | 75 // Implement the IDL |
76 const String& name() const { return m_metadata.name; } | 76 const String& name() const { return m_metadata.name; } |
77 unsigned long long version() const { return m_metadata.version; } | 77 unsigned long long version() const { return m_metadata.version; } |
78 DOMStringList* objectStoreNames() const; | 78 DOMStringList* objectStoreNames() const; |
79 | 79 |
80 IDBObjectStore* createObjectStore(const String& name, const IDBObjectStorePa
rameters& options, ExceptionState& exceptionState) { return createObjectStore(na
me, IDBKeyPath(options.keyPath()), options.autoIncrement(), exceptionState); } | 80 IDBObjectStore* createObjectStore(const String& name, const IDBObjectStorePa
rameters& options, ExceptionState& exceptionState) { return createObjectStore(na
me, IDBKeyPath(options.keyPath()), options.autoIncrement(), exceptionState); } |
(...skipping 24 matching lines...) Expand all Loading... |
105 bool isClosePending() const { return m_closePending; } | 105 bool isClosePending() const { return m_closePending; } |
106 void forceClose(); | 106 void forceClose(); |
107 const IDBDatabaseMetadata& metadata() const { return m_metadata; } | 107 const IDBDatabaseMetadata& metadata() const { return m_metadata; } |
108 void enqueueEvent(Event*); | 108 void enqueueEvent(Event*); |
109 | 109 |
110 int64_t findObjectStoreId(const String& name) const; | 110 int64_t findObjectStoreId(const String& name) const; |
111 bool containsObjectStore(const String& name) const | 111 bool containsObjectStore(const String& name) const |
112 { | 112 { |
113 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; | 113 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; |
114 } | 114 } |
115 void objectStoreRenamed(int64_t storeId, const String& newName); | 115 void renameObjectStore(int64_t storeId, const String& newName); |
| 116 void revertObjectStoreCreation(int64_t objectStoreId); |
| 117 void revertObjectStoreMetadata(RefPtr<IDBObjectStoreMetadata> oldMetadata); |
116 | 118 |
117 // Will return nullptr if this database is stopped. | 119 // Will return nullptr if this database is stopped. |
118 WebIDBDatabase* backend() const { return m_backend.get(); } | 120 WebIDBDatabase* backend() const { return m_backend.get(); } |
119 | 121 |
120 static int64_t nextTransactionId(); | 122 static int64_t nextTransactionId(); |
121 | 123 |
122 static const char indexDeletedErrorMessage[]; | 124 static const char indexDeletedErrorMessage[]; |
123 static const char indexNameTakenErrorMessage[]; | 125 static const char indexNameTakenErrorMessage[]; |
124 static const char isKeyCursorErrorMessage[]; | 126 static const char isKeyCursorErrorMessage[]; |
125 static const char noKeyOrKeyRangeErrorMessage[]; | 127 static const char noKeyOrKeyRangeErrorMessage[]; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // Keep track of the versionchange events waiting to be fired on this | 162 // Keep track of the versionchange events waiting to be fired on this |
161 // database so that we can cancel them if the database closes. | 163 // database so that we can cancel them if the database closes. |
162 HeapVector<Member<Event>> m_enqueuedEvents; | 164 HeapVector<Member<Event>> m_enqueuedEvents; |
163 | 165 |
164 Member<IDBDatabaseCallbacks> m_databaseCallbacks; | 166 Member<IDBDatabaseCallbacks> m_databaseCallbacks; |
165 }; | 167 }; |
166 | 168 |
167 } // namespace blink | 169 } // namespace blink |
168 | 170 |
169 #endif // IDBDatabase_h | 171 #endif // IDBDatabase_h |
OLD | NEW |