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

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

Issue 2709033003: Migrate WTF::HashMap::get() to ::at() (Closed)
Patch Set: rebase Created 3 years, 10 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 int64_t objectStoreId = m_database->findObjectStoreId(name); 211 int64_t objectStoreId = m_database->findObjectStoreId(name);
212 if (objectStoreId == IDBObjectStoreMetadata::InvalidId) { 212 if (objectStoreId == IDBObjectStoreMetadata::InvalidId) {
213 DCHECK(isVersionChange()); 213 DCHECK(isVersionChange());
214 exceptionState.throwDOMException( 214 exceptionState.throwDOMException(
215 NotFoundError, IDBDatabase::noSuchObjectStoreErrorMessage); 215 NotFoundError, IDBDatabase::noSuchObjectStoreErrorMessage);
216 return nullptr; 216 return nullptr;
217 } 217 }
218 218
219 DCHECK(m_database->metadata().objectStores.contains(objectStoreId)); 219 DCHECK(m_database->metadata().objectStores.contains(objectStoreId));
220 RefPtr<IDBObjectStoreMetadata> objectStoreMetadata = 220 RefPtr<IDBObjectStoreMetadata> objectStoreMetadata =
221 m_database->metadata().objectStores.get(objectStoreId); 221 m_database->metadata().objectStores.at(objectStoreId);
222 DCHECK(objectStoreMetadata.get()); 222 DCHECK(objectStoreMetadata.get());
223 223
224 IDBObjectStore* objectStore = 224 IDBObjectStore* objectStore =
225 IDBObjectStore::create(std::move(objectStoreMetadata), this); 225 IDBObjectStore::create(std::move(objectStoreMetadata), this);
226 DCHECK(!m_objectStoreMap.contains(name)); 226 DCHECK(!m_objectStoreMap.contains(name));
227 m_objectStoreMap.set(name, objectStore); 227 m_objectStoreMap.set(name, objectStore);
228 228
229 if (isVersionChange()) { 229 if (isVersionChange()) {
230 DCHECK(!objectStore->isNewlyCreated()) 230 DCHECK(!objectStore->isNewlyCreated())
231 << "Object store IDs are not assigned sequentially"; 231 << "Object store IDs are not assigned sequentially";
(...skipping 25 matching lines...) Expand all
257 << "A non-versionchange transaction deleted an object store"; 257 << "A non-versionchange transaction deleted an object store";
258 IDBObjectStoreMap::iterator it = m_objectStoreMap.find(name); 258 IDBObjectStoreMap::iterator it = m_objectStoreMap.find(name);
259 if (it == m_objectStoreMap.end()) { 259 if (it == m_objectStoreMap.end()) {
260 // No IDBObjectStore instance was created for the deleted store in this 260 // No IDBObjectStore instance was created for the deleted store in this
261 // transaction. This happens if IDBDatabase.deleteObjectStore() is called 261 // transaction. This happens if IDBDatabase.deleteObjectStore() is called
262 // with the name of a store that wasn't instantated. We need to be able to 262 // with the name of a store that wasn't instantated. We need to be able to
263 // revert the metadata change if the transaction aborts, in order to return 263 // revert the metadata change if the transaction aborts, in order to return
264 // correct values from IDB{Database, Transaction}.objectStoreNames. 264 // correct values from IDB{Database, Transaction}.objectStoreNames.
265 DCHECK(m_database->metadata().objectStores.contains(objectStoreId)); 265 DCHECK(m_database->metadata().objectStores.contains(objectStoreId));
266 RefPtr<IDBObjectStoreMetadata> metadata = 266 RefPtr<IDBObjectStoreMetadata> metadata =
267 m_database->metadata().objectStores.get(objectStoreId); 267 m_database->metadata().objectStores.at(objectStoreId);
268 DCHECK(metadata.get()); 268 DCHECK(metadata.get());
269 DCHECK_EQ(metadata->name, name); 269 DCHECK_EQ(metadata->name, name);
270 m_deletedObjectStores.push_back(std::move(metadata)); 270 m_deletedObjectStores.push_back(std::move(metadata));
271 } else { 271 } else {
272 IDBObjectStore* objectStore = it->value; 272 IDBObjectStore* objectStore = it->value;
273 m_objectStoreMap.erase(name); 273 m_objectStoreMap.erase(name);
274 objectStore->markDeleted(); 274 objectStore->markDeleted();
275 if (objectStore->id() > m_oldDatabaseMetadata.maxObjectStoreId) { 275 if (objectStore->id() > m_oldDatabaseMetadata.maxObjectStoreId) {
276 // The store was created and deleted in this transaction, so it will 276 // The store was created and deleted in this transaction, so it will
277 // not be restored even if the transaction aborts. We have just 277 // not be restored even if the transaction aborts. We have just
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 IDBObjectStore* objectStore = it.key; 595 IDBObjectStore* objectStore = it.key;
596 objectStore->clearIndexCache(); 596 objectStore->clearIndexCache();
597 } 597 }
598 m_oldStoreMetadata.clear(); 598 m_oldStoreMetadata.clear();
599 599
600 m_deletedIndexes.clear(); 600 m_deletedIndexes.clear();
601 m_deletedObjectStores.clear(); 601 m_deletedObjectStores.clear();
602 } 602 }
603 603
604 } // namespace blink 604 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698