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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp

Issue 2276593002: Support renaming of IndexedDB indexes and object stores. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test coverage for the (slightly incorrect) behavior in strict mode when our flag is not enabl… 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 IDBObjectStoreMap::iterator it = m_objectStoreMap.find(name); 184 IDBObjectStoreMap::iterator it = m_objectStoreMap.find(name);
185 if (it != m_objectStoreMap.end()) { 185 if (it != m_objectStoreMap.end()) {
186 IDBObjectStore* objectStore = it->value; 186 IDBObjectStore* objectStore = it->value;
187 m_objectStoreMap.remove(name); 187 m_objectStoreMap.remove(name);
188 objectStore->markDeleted(); 188 objectStore->markDeleted();
189 m_objectStoreCleanupMap.set(objectStore, objectStore->metadata()); 189 m_objectStoreCleanupMap.set(objectStore, objectStore->metadata());
190 m_deletedObjectStores.add(objectStore); 190 m_deletedObjectStores.add(objectStore);
191 } 191 }
192 } 192 }
193 193
194 void IDBTransaction::objectStoreRenamed(const String& oldName, const String& new Name)
195 {
196 DCHECK(m_state != Finished);
197 DCHECK(isVersionChange());
198
199 DCHECK(!m_objectStoreMap.contains(newName));
200 DCHECK(m_objectStoreMap.contains(oldName)) << "The object store had to be ac cessed in order to be renamed.";
201
202 IDBObjectStoreMap::iterator it = m_objectStoreMap.find(oldName);
203 m_objectStoreMap.set(newName, it->value);
204 m_objectStoreMap.remove(oldName);
205 }
206
194 void IDBTransaction::setActive(bool active) 207 void IDBTransaction::setActive(bool active)
195 { 208 {
196 DCHECK_NE(m_state, Finished) << "A finished transaction tried to setActive(" << (active ? "true" : "false") << ")"; 209 DCHECK_NE(m_state, Finished) << "A finished transaction tried to setActive(" << (active ? "true" : "false") << ")";
197 if (m_state == Finishing) 210 if (m_state == Finishing)
198 return; 211 return;
199 ASSERT(active != (m_state == Active)); 212 ASSERT(active != (m_state == Active));
200 m_state = active ? Active : Inactive; 213 m_state = active ? Active : Inactive;
201 214
202 if (!active && m_requestList.isEmpty() && backendDB()) 215 if (!active && m_requestList.isEmpty() && backendDB())
203 backendDB()->commit(m_id); 216 backendDB()->commit(m_id);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 event->setTarget(this); 436 event->setTarget(this);
424 eventQueue->enqueueEvent(event); 437 eventQueue->enqueueEvent(event);
425 } 438 }
426 439
427 WebIDBDatabase* IDBTransaction::backendDB() const 440 WebIDBDatabase* IDBTransaction::backendDB() const
428 { 441 {
429 return m_database->backend(); 442 return m_database->backend();
430 } 443 }
431 444
432 } // namespace blink 445 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698