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

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. Created 4 years, 3 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void setMetadata(const IDBDatabaseMetadata&);
68 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); 68 void setOwnMetadata(const IDBDatabaseOwnMetadata&);
69 void indexDeleted(int64_t objectStoreId, int64_t indexId);
70 void indexRenamed(int64_t objectStoreId, int64_t indexId, const String& newN ame);
71 void transactionCreated(IDBTransaction*); 69 void transactionCreated(IDBTransaction*);
72 void transactionFinished(const IDBTransaction*); 70 void transactionFinished(const IDBTransaction*);
73 const String& getObjectStoreName(int64_t objectStoreId) const; 71 const String& getObjectStoreName(int64_t objectStoreId) const;
74 72
75 // Implement the IDL 73 // Implement the IDL
76 const String& name() const { return m_metadata.name; } 74 const String& name() const { return m_metadata.own.name; }
77 unsigned long long version() const { return m_metadata.version; } 75 unsigned long long version() const { return m_metadata.own.version; }
78 DOMStringList* objectStoreNames() const; 76 DOMStringList* objectStoreNames() const;
79 77
80 IDBObjectStore* createObjectStore(const String& name, const IDBObjectStorePa rameters& options, ExceptionState& exceptionState) { return createObjectStore(na me, IDBKeyPath(options.keyPath()), options.autoIncrement(), exceptionState); } 78 IDBObjectStore* createObjectStore(const String& name, const IDBObjectStorePa rameters& options, ExceptionState& exceptionState) { return createObjectStore(na me, IDBKeyPath(options.keyPath()), options.autoIncrement(), exceptionState); }
81 IDBTransaction* transaction(ScriptState*, const StringOrStringSequenceOrDOMS tringList&, const String& mode, ExceptionState&); 79 IDBTransaction* transaction(ScriptState*, const StringOrStringSequenceOrDOMS tringList&, const String& mode, ExceptionState&);
82 void deleteObjectStore(const String& name, ExceptionState&); 80 void deleteObjectStore(const String& name, ExceptionState&);
83 void close(); 81 void close();
84 82
85 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); 83 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
86 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(close);
87 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
(...skipping 17 matching lines...) Expand all
105 bool isClosePending() const { return m_closePending; } 103 bool isClosePending() const { return m_closePending; }
106 void forceClose(); 104 void forceClose();
107 const IDBDatabaseMetadata& metadata() const { return m_metadata; } 105 const IDBDatabaseMetadata& metadata() const { return m_metadata; }
108 void enqueueEvent(Event*); 106 void enqueueEvent(Event*);
109 107
110 int64_t findObjectStoreId(const String& name) const; 108 int64_t findObjectStoreId(const String& name) const;
111 bool containsObjectStore(const String& name) const 109 bool containsObjectStore(const String& name) const
112 { 110 {
113 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; 111 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId;
114 } 112 }
115 void objectStoreRenamed(int64_t storeId, const String& newName); 113 void renameObjectStore(int64_t storeId, const String& newName);
114 void revertObjectStoreCreation(int64_t objectStoreId);
115 void revertObjectStoreMetadata(RefPtr<IDBObjectStoreMetadata> oldMetadata);
116 116
117 // Will return nullptr if this database is stopped. 117 // Will return nullptr if this database is stopped.
118 WebIDBDatabase* backend() const { return m_backend.get(); } 118 WebIDBDatabase* backend() const { return m_backend.get(); }
119 119
120 static int64_t nextTransactionId(); 120 static int64_t nextTransactionId();
121 121
122 static const char indexDeletedErrorMessage[]; 122 static const char indexDeletedErrorMessage[];
123 static const char indexNameTakenErrorMessage[]; 123 static const char indexNameTakenErrorMessage[];
124 static const char isKeyCursorErrorMessage[]; 124 static const char isKeyCursorErrorMessage[];
125 static const char noKeyOrKeyRangeErrorMessage[]; 125 static const char noKeyOrKeyRangeErrorMessage[];
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Keep track of the versionchange events waiting to be fired on this 160 // Keep track of the versionchange events waiting to be fired on this
161 // database so that we can cancel them if the database closes. 161 // database so that we can cancel them if the database closes.
162 HeapVector<Member<Event>> m_enqueuedEvents; 162 HeapVector<Member<Event>> m_enqueuedEvents;
163 163
164 Member<IDBDatabaseCallbacks> m_databaseCallbacks; 164 Member<IDBDatabaseCallbacks> m_databaseCallbacks;
165 }; 165 };
166 166
167 } // namespace blink 167 } // namespace blink
168 168
169 #endif // IDBDatabase_h 169 #endif // IDBDatabase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698