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

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

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 11 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 auto it = m_observers.find(map_entry.first); 186 auto it = m_observers.find(map_entry.first);
187 if (it != m_observers.end()) { 187 if (it != m_observers.end()) {
188 IDBObserver* observer = it->value; 188 IDBObserver* observer = it->value;
189 189
190 IDBTransaction* transaction = nullptr; 190 IDBTransaction* transaction = nullptr;
191 auto it = transactions.find(map_entry.first); 191 auto it = transactions.find(map_entry.first);
192 if (it != transactions.end()) { 192 if (it != transactions.end()) {
193 const std::pair<int64_t, std::vector<int64_t>>& obs_txn = it->second; 193 const std::pair<int64_t, std::vector<int64_t>>& obs_txn = it->second;
194 HashSet<String> stores; 194 HashSet<String> stores;
195 for (int64_t store_id : obs_txn.second) { 195 for (int64_t store_id : obs_txn.second) {
196 stores.add(m_metadata.objectStores.get(store_id)->name); 196 stores.insert(m_metadata.objectStores.get(store_id)->name);
197 } 197 }
198 198
199 transaction = IDBTransaction::createObserver( 199 transaction = IDBTransaction::createObserver(
200 getExecutionContext(), obs_txn.first, stores, this); 200 getExecutionContext(), obs_txn.first, stores, this);
201 } 201 }
202 202
203 observer->callback()->call( 203 observer->callback()->call(
204 observer, IDBObserverChanges::create(this, transaction, observations, 204 observer, IDBObserverChanges::create(this, transaction, observations,
205 map_entry.second)); 205 map_entry.second));
206 if (transaction) 206 if (transaction)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 IDBTransaction* IDBDatabase::transaction( 354 IDBTransaction* IDBDatabase::transaction(
355 ScriptState* scriptState, 355 ScriptState* scriptState,
356 const StringOrStringSequenceOrDOMStringList& storeNames, 356 const StringOrStringSequenceOrDOMStringList& storeNames,
357 const String& modeString, 357 const String& modeString,
358 ExceptionState& exceptionState) { 358 ExceptionState& exceptionState) {
359 IDB_TRACE("IDBDatabase::transaction"); 359 IDB_TRACE("IDBDatabase::transaction");
360 recordApiCallsHistogram(IDBTransactionCall); 360 recordApiCallsHistogram(IDBTransactionCall);
361 361
362 HashSet<String> scope; 362 HashSet<String> scope;
363 if (storeNames.isString()) { 363 if (storeNames.isString()) {
364 scope.add(storeNames.getAsString()); 364 scope.insert(storeNames.getAsString());
365 } else if (storeNames.isStringSequence()) { 365 } else if (storeNames.isStringSequence()) {
366 for (const String& name : storeNames.getAsStringSequence()) 366 for (const String& name : storeNames.getAsStringSequence())
367 scope.add(name); 367 scope.insert(name);
368 } else if (storeNames.isDOMStringList()) { 368 } else if (storeNames.isDOMStringList()) {
369 const Vector<String>& list = *storeNames.getAsDOMStringList(); 369 const Vector<String>& list = *storeNames.getAsDOMStringList();
370 for (const String& name : list) 370 for (const String& name : list)
371 scope.add(name); 371 scope.insert(name);
372 } else { 372 } else {
373 NOTREACHED(); 373 NOTREACHED();
374 } 374 }
375 375
376 if (m_versionChangeTransaction) { 376 if (m_versionChangeTransaction) {
377 exceptionState.throwDOMException( 377 exceptionState.throwDOMException(
378 InvalidStateError, "A version change transaction is running."); 378 InvalidStateError, "A version change transaction is running.");
379 return nullptr; 379 return nullptr;
380 } 380 }
381 381
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 598
599 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) { 599 void IDBDatabase::recordApiCallsHistogram(IndexedDatabaseMethods method) {
600 DEFINE_THREAD_SAFE_STATIC_LOCAL( 600 DEFINE_THREAD_SAFE_STATIC_LOCAL(
601 EnumerationHistogram, apiCallsHistogram, 601 EnumerationHistogram, apiCallsHistogram,
602 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls", 602 new EnumerationHistogram("WebCore.IndexedDB.FrontEndAPICalls",
603 IDBMethodsMax)); 603 IDBMethodsMax));
604 apiCallsHistogram.count(method); 604 apiCallsHistogram.count(method);
605 } 605 }
606 606
607 } // namespace blink 607 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698