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

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

Issue 2276593002: Support renaming of IndexedDB indexes and object stores. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added tests for create rename in the same aborted transaction. 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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& metadata) { m_metadata = metadat a; }
68 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); 68 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&);
69 void indexDeleted(int64_t objectStoreId, int64_t indexId); 69 void indexDeleted(int64_t objectStoreId, int64_t indexId);
70 void indexRenamed(int64_t objectStoreId, int64_t indexId, const String& newN ame);
70 void transactionCreated(IDBTransaction*); 71 void transactionCreated(IDBTransaction*);
71 void transactionFinished(const IDBTransaction*); 72 void transactionFinished(const IDBTransaction*);
72 const String& getObjectStoreName(int64_t objectStoreId) const; 73 const String& getObjectStoreName(int64_t objectStoreId) const;
73 74
74 // Implement the IDL 75 // Implement the IDL
75 const String& name() const { return m_metadata.name; } 76 const String& name() const { return m_metadata.name; }
76 unsigned long long version() const { return m_metadata.version; } 77 unsigned long long version() const { return m_metadata.version; }
77 DOMStringList* objectStoreNames() const; 78 DOMStringList* objectStoreNames() const;
78 79
79 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
104 bool isClosePending() const { return m_closePending; } 105 bool isClosePending() const { return m_closePending; }
105 void forceClose(); 106 void forceClose();
106 const IDBDatabaseMetadata& metadata() const { return m_metadata; } 107 const IDBDatabaseMetadata& metadata() const { return m_metadata; }
107 void enqueueEvent(Event*); 108 void enqueueEvent(Event*);
108 109
109 int64_t findObjectStoreId(const String& name) const; 110 int64_t findObjectStoreId(const String& name) const;
110 bool containsObjectStore(const String& name) const 111 bool containsObjectStore(const String& name) const
111 { 112 {
112 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; 113 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId;
113 } 114 }
115 void objectStoreRenamed(int64_t storeId, const String& newName);
114 116
115 // Will return nullptr if this database is stopped. 117 // Will return nullptr if this database is stopped.
116 WebIDBDatabase* backend() const { return m_backend.get(); } 118 WebIDBDatabase* backend() const { return m_backend.get(); }
117 119
118 static int64_t nextTransactionId(); 120 static int64_t nextTransactionId();
119 121
120 static const char indexDeletedErrorMessage[]; 122 static const char indexDeletedErrorMessage[];
123 static const char indexNameTakenErrorMessage[];
121 static const char isKeyCursorErrorMessage[]; 124 static const char isKeyCursorErrorMessage[];
122 static const char noKeyOrKeyRangeErrorMessage[]; 125 static const char noKeyOrKeyRangeErrorMessage[];
123 static const char noSuchIndexErrorMessage[]; 126 static const char noSuchIndexErrorMessage[];
124 static const char noSuchObjectStoreErrorMessage[]; 127 static const char noSuchObjectStoreErrorMessage[];
125 static const char noValueErrorMessage[]; 128 static const char noValueErrorMessage[];
126 static const char notValidKeyErrorMessage[]; 129 static const char notValidKeyErrorMessage[];
127 static const char notVersionChangeTransactionErrorMessage[]; 130 static const char notVersionChangeTransactionErrorMessage[];
128 static const char objectStoreDeletedErrorMessage[]; 131 static const char objectStoreDeletedErrorMessage[];
132 static const char objectStoreNameTakenErrorMessage[];
129 static const char requestNotFinishedErrorMessage[]; 133 static const char requestNotFinishedErrorMessage[];
130 static const char sourceDeletedErrorMessage[]; 134 static const char sourceDeletedErrorMessage[];
131 static const char transactionFinishedErrorMessage[]; 135 static const char transactionFinishedErrorMessage[];
132 static const char transactionInactiveErrorMessage[]; 136 static const char transactionInactiveErrorMessage[];
133 static const char transactionReadOnlyErrorMessage[]; 137 static const char transactionReadOnlyErrorMessage[];
134 static const char databaseClosedErrorMessage[]; 138 static const char databaseClosedErrorMessage[];
135 139
136 static void recordApiCallsHistogram(IndexedDatabaseMethods); 140 static void recordApiCallsHistogram(IndexedDatabaseMethods);
137 141
138 protected: 142 protected:
(...skipping 17 matching lines...) Expand all
156 // 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
157 // database so that we can cancel them if the database closes. 161 // database so that we can cancel them if the database closes.
158 HeapVector<Member<Event>> m_enqueuedEvents; 162 HeapVector<Member<Event>> m_enqueuedEvents;
159 163
160 Member<IDBDatabaseCallbacks> m_databaseCallbacks; 164 Member<IDBDatabaseCallbacks> m_databaseCallbacks;
161 }; 165 };
162 166
163 } // namespace blink 167 } // namespace blink
164 168
165 #endif // IDBDatabase_h 169 #endif // IDBDatabase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698