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

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

Issue 2314933005: Align IndexedDB metadata rollback on transaction abort to spec. (Closed)
Patch Set: Rebased past the big reformat. Created 4 years, 2 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 metadata .
70 m_metadata = metadata; 70 void setMetadata(const IDBDatabaseMetadata&);
71 } 71 // Overwrites the database's own metadata, but does not change object store an d index metadata.
72 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); 72 void setDatabaseMetadata(const IDBDatabaseMetadata&);
73 void indexDeleted(int64_t objectStoreId, int64_t indexId);
74 void indexRenamed(int64_t objectStoreId,
75 int64_t indexId,
76 const String& newName);
77 void transactionCreated(IDBTransaction*); 73 void transactionCreated(IDBTransaction*);
78 void transactionFinished(const IDBTransaction*); 74 void transactionFinished(const IDBTransaction*);
79 const String& getObjectStoreName(int64_t objectStoreId) const; 75 const String& getObjectStoreName(int64_t objectStoreId) const;
80 76
81 // Implement the IDL 77 // Implement the IDL
82 const String& name() const { return m_metadata.name; } 78 const String& name() const { return m_metadata.name; }
83 unsigned long long version() const { return m_metadata.version; } 79 unsigned long long version() const { return m_metadata.version; }
84 DOMStringList* objectStoreNames() const; 80 DOMStringList* objectStoreNames() const;
85 81
86 IDBObjectStore* createObjectStore(const String& name, 82 IDBObjectStore* createObjectStore(const String& name,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 115
120 bool isClosePending() const { return m_closePending; } 116 bool isClosePending() const { return m_closePending; }
121 void forceClose(); 117 void forceClose();
122 const IDBDatabaseMetadata& metadata() const { return m_metadata; } 118 const IDBDatabaseMetadata& metadata() const { return m_metadata; }
123 void enqueueEvent(Event*); 119 void enqueueEvent(Event*);
124 120
125 int64_t findObjectStoreId(const String& name) const; 121 int64_t findObjectStoreId(const String& name) const;
126 bool containsObjectStore(const String& name) const { 122 bool containsObjectStore(const String& name) const {
127 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; 123 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId;
128 } 124 }
129 void objectStoreRenamed(int64_t storeId, const String& newName); 125 void renameObjectStore(int64_t storeId, const String& newName);
126 void revertObjectStoreCreation(int64_t objectStoreId);
127 void revertObjectStoreMetadata(RefPtr<IDBObjectStoreMetadata> oldMetadata);
130 128
131 // Will return nullptr if this database is stopped. 129 // Will return nullptr if this database is stopped.
132 WebIDBDatabase* backend() const { return m_backend.get(); } 130 WebIDBDatabase* backend() const { return m_backend.get(); }
133 131
134 static int64_t nextTransactionId(); 132 static int64_t nextTransactionId();
135 133
136 static const char indexDeletedErrorMessage[]; 134 static const char indexDeletedErrorMessage[];
137 static const char indexNameTakenErrorMessage[]; 135 static const char indexNameTakenErrorMessage[];
138 static const char isKeyCursorErrorMessage[]; 136 static const char isKeyCursorErrorMessage[];
139 static const char noKeyOrKeyRangeErrorMessage[]; 137 static const char noKeyOrKeyRangeErrorMessage[];
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // Keep track of the versionchange events waiting to be fired on this 177 // Keep track of the versionchange events waiting to be fired on this
180 // database so that we can cancel them if the database closes. 178 // database so that we can cancel them if the database closes.
181 HeapVector<Member<Event>> m_enqueuedEvents; 179 HeapVector<Member<Event>> m_enqueuedEvents;
182 180
183 Member<IDBDatabaseCallbacks> m_databaseCallbacks; 181 Member<IDBDatabaseCallbacks> m_databaseCallbacks;
184 }; 182 };
185 183
186 } // namespace blink 184 } // namespace blink
187 185
188 #endif // IDBDatabase_h 186 #endif // IDBDatabase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698