Diff
Modified: trunk/Source/WebCore/ChangeLog (185100 => 185101)
--- trunk/Source/WebCore/ChangeLog 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/ChangeLog 2015-06-02 03:13:26 UTC (rev 185101)
@@ -1,3 +1,98 @@
+2015-06-01 Hunseop Jeong <[email protected]>
+
+ Use modern for-loops in WebCore/Modules - 1
+ https://bugs.webkit.org/show_bug.cgi?id=145507
+
+ Reviewed by Darin Adler.
+
+ No new tests, no behavior changes.
+
+ * Modules/battery/BatteryController.cpp:
+ (WebCore::BatteryController::~BatteryController):
+ (WebCore::BatteryController::updateBatteryStatus):
+ (WebCore::BatteryController::didChangeBatteryStatus):
+ * Modules/encryptedmedia/CDM.cpp:
+ (WebCore::CDMFactoryForKeySystem):
+ * Modules/encryptedmedia/MediaKeys.cpp:
+ (WebCore::MediaKeys::~MediaKeys):
+ * Modules/geolocation/Geolocation.cpp:
+ (WebCore::Geolocation::resumeTimerFired):
+ (WebCore::Geolocation::resetAllGeolocationPermission):
+ (WebCore::Geolocation::makeCachedPositionCallbacks):
+ (WebCore::Geolocation::sendError):
+ (WebCore::Geolocation::sendPosition):
+ (WebCore::Geolocation::stopTimer):
+ (WebCore::Geolocation::cancelRequests):
+ (WebCore::Geolocation::extractNotifiersWithCachedPosition):
+ (WebCore::Geolocation::copyToSet):
+ (WebCore::Geolocation::handlePendingPermissionNotifiers):
+ * Modules/geolocation/GeolocationController.cpp:
+ (WebCore::GeolocationController::positionChanged):
+ (WebCore::GeolocationController::errorOccurred):
+ * Modules/indexeddb/IDBDatabase.cpp:
+ (WebCore::IDBDatabase::objectStoreNames):
+ (WebCore::IDBDatabase::transaction):
+ (WebCore::IDBDatabase::forceClose):
+ (WebCore::IDBDatabase::closeConnection):
+ (WebCore::IDBDatabase::findObjectStoreId):
+ * Modules/indexeddb/IDBDatabaseBackend.cpp:
+ (WebCore::IDBDatabaseBackend::runIntVersionChangeTransaction):
+ (WebCore::IDBDatabaseBackend::deleteDatabase):
+ (WebCore::IDBDatabaseBackend::close):
+ * Modules/indexeddb/IDBDatabaseMetadata.cpp:
+ (WebCore::IDBDatabaseMetadata::isolatedCopy):
+ (WebCore::IDBObjectStoreMetadata::isolatedCopy):
+ * Modules/indexeddb/IDBKey.cpp:
+ (WebCore::IDBKey::isValid):
+ * Modules/indexeddb/IDBKey.h:
+ (WebCore::IDBKey::createMultiEntryArray):
+ (WebCore::IDBKey::createArray):
+ * Modules/indexeddb/IDBKeyPath.cpp:
+ (WebCore::IDBKeyPath::IDBKeyPath):
+ (WebCore::IDBKeyPath::isValid):
+ (WebCore::IDBKeyPath::isolatedCopy):
+ * Modules/indexeddb/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::indexNames):
+ (WebCore::IDBObjectStore::put):
+ Rename the two 'i's to 'keyData' and 'indexKeyData'.
+ (WebCore::IDBObjectStore::index):
+ (WebCore::IDBObjectStore::findIndexId):
+ * Modules/indexeddb/IDBPendingTransactionMonitor.cpp:
+ (WebCore::IDBPendingTransactionMonitor::deactivateNewTransactions):
+ * Modules/indexeddb/IDBRequest.cpp:
+ (WebCore::IDBRequest::abort):
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::closeOpenCursors):
+ (WebCore::IDBTransaction::onAbort):
+ (WebCore::IDBTransaction::dispatchEvent):
+ * Modules/indexeddb/IDBTransactionBackend.cpp:
+ (WebCore::IDBTransactionBackend::create):
+ (WebCore::IDBTransactionBackend::closeOpenCursors):
+ * Modules/mediasource/MediaSource.cpp:
+ (WebCore::MediaSource::onReadyStateChange):
+ * Modules/mediastream/MediaConstraintsImpl.cpp:
+ (WebCore::MediaConstraintsImpl::initialize):
+ (WebCore::MediaConstraintsImpl::getMandatoryConstraints):
+ (WebCore::MediaConstraintsImpl::getOptionalConstraintValue):
+ * Modules/mediastream/MediaStream.cpp:
+ (WebCore::MediaStream::create):
+ (WebCore::MediaStream::cloneMediaStreamTrackVector):
+ (WebCore::MediaStream::addTrack):
+ (WebCore::MediaStream::removeTrack):
+ (WebCore::MediaStream::haveTrackWithSource):
+ (WebCore::MediaStream::getTrackById):
+ (WebCore::MediaStream::getTracks):
+ (WebCore::MediaStream::trackDidEnd):
+ (WebCore::MediaStream::scheduledEventTimerFired):
+ * Modules/mediastream/MediaStreamCapabilities.cpp:
+ (WebCore::MediaStreamCapabilities::sourceType):
+ (WebCore::MediaStreamCapabilities::sourceId):
+ (WebCore::MediaStreamCapabilities::facingMode):
+ * Modules/mediastream/MediaStreamTrack.cpp:
+ (WebCore::MediaStreamTrack::trackDidEnd):
+ * Modules/mediastream/MediaStreamTrackSourcesRequest.cpp:
+ (WebCore::MediaStreamTrackSourcesRequest::didCompleteRequest):
+
2015-06-01 Myles C. Maxfield <[email protected]>
[SVG -> OTF Converter] Remove unnecessary hacks
Modified: trunk/Source/WebCore/Modules/battery/BatteryController.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/battery/BatteryController.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/battery/BatteryController.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -37,8 +37,8 @@
BatteryController::~BatteryController()
{
- for (ListenerVector::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
- (*it)->batteryControllerDestroyed();
+ for (auto& listener : m_listeners)
+ listener->batteryControllerDestroyed();
m_client->batteryControllerDestroyed();
}
@@ -75,8 +75,8 @@
if (m_batteryStatus->level() != status->level())
didChangeBatteryStatus(WebCore::eventNames().levelchangeEvent, status);
} else {
- for (ListenerVector::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
- (*it)->updateBatteryStatus(status);
+ for (auto& listener : m_listeners)
+ listener->updateBatteryStatus(status);
}
m_batteryStatus = status.release();
@@ -86,8 +86,8 @@
{
RefPtr<Event> event = Event::create(eventType, false, false);
RefPtr<BatteryStatus> battery = batteryStatus;
- for (ListenerVector::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
- (*it)->didChangeBatteryStatus(event, battery);
+ for (auto& listener : m_listeners)
+ listener->didChangeBatteryStatus(event, battery);
}
const char* BatteryController::supplementName()
Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -89,10 +89,9 @@
static CDMFactory* CDMFactoryForKeySystem(const String& keySystem)
{
- Vector<CDMFactory*>& cdmFactories = installedCDMFactories();
- for (size_t i = 0; i < cdmFactories.size(); ++i) {
- if (cdmFactories[i]->supportsKeySystem(keySystem))
- return cdmFactories[i];
+ for (auto& factory : installedCDMFactories()) {
+ if (factory->supportsKeySystem(keySystem))
+ return factory;
}
return 0;
}
Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -77,9 +77,9 @@
{
// From <http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media.html#dom-media-keys-constructor>:
// When destroying a MediaKeys object, follow the steps in close().
- for (size_t i = 0; i < m_sessions.size(); ++i) {
- m_sessions[i]->close();
- m_sessions[i]->setKeys(0);
+ for (auto& session : m_sessions) {
+ session->close();
+ session->setKeys(0);
}
}
Modified: trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/geolocation/Geolocation.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -208,13 +208,12 @@
// Resume GeoNotifier timeout timers.
if (hasListeners()) {
- GeoNotifierSet::const_iterator end = m_oneShots.end();
- for (GeoNotifierSet::const_iterator it = m_oneShots.begin(); it != end; ++it)
- (*it)->startTimerIfNeeded();
+ for (auto& notifier : m_oneShots)
+ notifier->startTimerIfNeeded();
GeoNotifierVector watcherCopy;
m_watchers.getNotifiersVector(watcherCopy);
- for (size_t i = 0; i < watcherCopy.size(); ++i)
- watcherCopy[i]->startTimerIfNeeded();
+ for (auto& watcher : watcherCopy)
+ watcher->startTimerIfNeeded();
}
if ((isAllowed() || isDenied()) && !m_pendingForPermissionNotifiers.isEmpty()) {
@@ -269,14 +268,13 @@
stopTimers();
// Go over the one shot and re-request permission.
- GeoNotifierSet::iterator end = m_oneShots.end();
- for (GeoNotifierSet::iterator it = m_oneShots.begin(); it != end; ++it)
- startRequest((*it).get());
+ for (auto& notifier : m_oneShots)
+ startRequest(notifier.get());
// Go over the watchers and re-request permission.
GeoNotifierVector watcherCopy;
m_watchers.getNotifiersVector(watcherCopy);
- for (size_t i = 0; i < watcherCopy.size(); ++i)
- startRequest(watcherCopy[i].get());
+ for (auto& watcher : watcherCopy)
+ startRequest(watcher.get());
}
void Geolocation::stop()
@@ -392,15 +390,13 @@
// All modifications to m_requestsAwaitingCachedPosition are done
// asynchronously, so we don't need to worry about it being modified from
// the callbacks.
- GeoNotifierSet::const_iterator end = m_requestsAwaitingCachedPosition.end();
- for (GeoNotifierSet::const_iterator iter = m_requestsAwaitingCachedPosition.begin(); iter != end; ++iter) {
- GeoNotifier* notifier = iter->get();
+ for (auto& notifier : m_requestsAwaitingCachedPosition) {
notifier->runSuccessCallback(lastPosition());
// If this is a one-shot request, stop it. Otherwise, if the watch still
// exists, start the service to get updates.
- if (!m_oneShots.remove(notifier) && m_watchers.contains(notifier)) {
- if (notifier->hasZeroTimeout() || startUpdating(notifier))
+ if (!m_oneShots.remove(notifier.get()) && m_watchers.contains(notifier.get())) {
+ if (notifier->hasZeroTimeout() || startUpdating(notifier.get()))
notifier->startTimerIfNeeded();
else
notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, ASCIILiteral(failedToStartServiceErrorMessage)));
@@ -489,26 +485,20 @@
void Geolocation::sendError(GeoNotifierVector& notifiers, PositionError* error)
{
- GeoNotifierVector::const_iterator end = notifiers.end();
- for (GeoNotifierVector::const_iterator it = notifiers.begin(); it != end; ++it) {
- RefPtr<GeoNotifier> notifier = *it;
-
- notifier->runErrorCallback(error);
- }
+ for (auto& notifier : notifiers)
+ notifier->runErrorCallback(error);
}
void Geolocation::sendPosition(GeoNotifierVector& notifiers, Geoposition* position)
{
- GeoNotifierVector::const_iterator end = notifiers.end();
- for (GeoNotifierVector::const_iterator it = notifiers.begin(); it != end; ++it)
- (*it)->runSuccessCallback(position);
+ for (auto& notifier : notifiers)
+ notifier->runSuccessCallback(position);
}
void Geolocation::stopTimer(GeoNotifierVector& notifiers)
{
- GeoNotifierVector::const_iterator end = notifiers.end();
- for (GeoNotifierVector::const_iterator it = notifiers.begin(); it != end; ++it)
- (*it)->stopTimer();
+ for (auto& notifier : notifiers)
+ notifier->stopTimer();
}
void Geolocation::stopTimersForOneShots()
@@ -535,9 +525,8 @@
void Geolocation::cancelRequests(GeoNotifierVector& notifiers)
{
- GeoNotifierVector::const_iterator end = notifiers.end();
- for (GeoNotifierVector::const_iterator it = notifiers.begin(); it != end; ++it)
- (*it)->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, ASCIILiteral(framelessDocumentErrorMessage)));
+ for (auto& notifier : notifiers)
+ notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, ASCIILiteral(framelessDocumentErrorMessage)));
}
void Geolocation::cancelAllRequests()
@@ -552,25 +541,20 @@
void Geolocation::extractNotifiersWithCachedPosition(GeoNotifierVector& notifiers, GeoNotifierVector* cached)
{
GeoNotifierVector nonCached;
- GeoNotifierVector::iterator end = notifiers.end();
- for (GeoNotifierVector::const_iterator it = notifiers.begin(); it != end; ++it) {
- GeoNotifier* notifier = it->get();
+ for (auto& notifier : notifiers) {
if (notifier->useCachedPosition()) {
if (cached)
- cached->append(notifier);
+ cached->append(notifier.get());
} else
- nonCached.append(notifier);
+ nonCached.append(notifier.get());
}
notifiers.swap(nonCached);
}
void Geolocation::copyToSet(const GeoNotifierVector& src, GeoNotifierSet& dest)
{
- GeoNotifierVector::const_iterator end = src.end();
- for (GeoNotifierVector::const_iterator it = src.begin(); it != end; ++it) {
- GeoNotifier* notifier = it->get();
- dest.add(notifier);
- }
+ for (auto& notifier : src)
+ dest.add(notifier.get());
}
void Geolocation::handleError(PositionError* error)
@@ -695,14 +679,11 @@
{
// While we iterate through the list, we need not worry about list being modified as the permission
// is already set to Yes/No and no new listeners will be added to the pending list
- GeoNotifierSet::const_iterator end = m_pendingForPermissionNotifiers.end();
- for (GeoNotifierSet::const_iterator iter = m_pendingForPermissionNotifiers.begin(); iter != end; ++iter) {
- GeoNotifier* notifier = iter->get();
-
+ for (auto& notifier : m_pendingForPermissionNotifiers) {
if (isAllowed()) {
// start all pending notification requests as permission granted.
// The notifier is always ref'ed by m_oneShots or m_watchers.
- if (startUpdating(notifier))
+ if (startUpdating(notifier.get()))
notifier->startTimerIfNeeded();
else
notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, ASCIILiteral(failedToStartServiceErrorMessage)));
Modified: trunk/Source/WebCore/Modules/geolocation/GeolocationController.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/geolocation/GeolocationController.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/geolocation/GeolocationController.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -104,16 +104,16 @@
m_lastPosition = position;
Vector<RefPtr<Geolocation>> observersVector;
copyToVector(m_observers, observersVector);
- for (size_t i = 0; i < observersVector.size(); ++i)
- observersVector[i]->positionChanged();
+ for (auto& observer : observersVector)
+ observer->positionChanged();
}
void GeolocationController::errorOccurred(GeolocationError* error)
{
Vector<RefPtr<Geolocation>> observersVector;
copyToVector(m_observers, observersVector);
- for (size_t i = 0; i < observersVector.size(); ++i)
- observersVector[i]->setError(error);
+ for (auto& observer : observersVector)
+ observer->setError(error);
}
GeolocationPosition* GeolocationController::lastPosition()
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -145,8 +145,8 @@
PassRefPtr<DOMStringList> IDBDatabase::objectStoreNames() const
{
RefPtr<DOMStringList> objectStoreNames = DOMStringList::create();
- for (IDBDatabaseMetadata::ObjectStoreMap::const_iterator it = m_metadata.objectStores.begin(); it != m_metadata.objectStores.end(); ++it)
- objectStoreNames->append(it->value.name);
+ for (auto& objectStore : m_metadata.objectStores.values())
+ objectStoreNames->append(objectStore.name);
objectStoreNames->sort();
return objectStoreNames.release();
}
@@ -256,8 +256,8 @@
}
Vector<int64_t> objectStoreIds;
- for (size_t i = 0; i < scope.size(); ++i) {
- int64_t objectStoreId = findObjectStoreId(scope[i]);
+ for (auto& name : scope) {
+ int64_t objectStoreId = findObjectStoreId(name);
if (objectStoreId == IDBObjectStoreMetadata::InvalidId) {
ec = IDBDatabaseException::NotFoundError;
return 0;
@@ -281,8 +281,8 @@
void IDBDatabase::forceClose()
{
- for (TransactionMap::const_iterator::Values it = m_transactions.begin().values(), end = m_transactions.end().values(); it != end; ++it)
- (*it)->abort(IGNORE_EXCEPTION);
+ for (auto& transaction : m_transactions.values())
+ transaction->abort(IGNORE_EXCEPTION);
this->close();
}
@@ -317,8 +317,8 @@
// connection. They would have been scheduled by the backend when another
// connection called setVersion, but the frontend connection is being
// closed before they could fire.
- for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
- bool removed = eventQueue.cancelEvent(*m_enqueuedEvents[i]);
+ for (auto& event : m_enqueuedEvents) {
+ bool removed = eventQueue.cancelEvent(*event);
ASSERT_UNUSED(removed, removed);
}
@@ -360,10 +360,10 @@
int64_t IDBDatabase::findObjectStoreId(const String& name) const
{
- for (IDBDatabaseMetadata::ObjectStoreMap::const_iterator it = m_metadata.objectStores.begin(); it != m_metadata.objectStores.end(); ++it) {
- if (it->value.name == name) {
- ASSERT(it->key != IDBObjectStoreMetadata::InvalidId);
- return it->key;
+ for (auto& objectStore : m_metadata.objectStores) {
+ if (objectStore.value.name == name) {
+ ASSERT(objectStore.key != IDBObjectStoreMetadata::InvalidId);
+ return objectStore.key;
}
}
return IDBObjectStoreMetadata::InvalidId;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackend.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackend.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackend.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -497,10 +497,10 @@
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
RefPtr<IDBDatabaseCallbacks> databaseCallbacks = prpDatabaseCallbacks;
ASSERT(callbacks);
- for (DatabaseCallbacksSet::const_iterator it = m_databaseCallbacksSet.begin(); it != m_databaseCallbacksSet.end(); ++it) {
+ for (auto& callback : m_databaseCallbacksSet) {
// Front end ensures the event is not fired at connections that have closePending set.
- if (*it != databaseCallbacks)
- (*it)->onVersionChange(m_metadata.version, requestedVersion, IndexedDB::VersionNullness::Null);
+ if (callback != databaseCallbacks)
+ callback->onVersionChange(m_metadata.version, requestedVersion, IndexedDB::VersionNullness::Null);
}
// The spec dictates we wait until all the version change events are
// delivered and then check m_databaseCallbacks.empty() before proceeding
@@ -531,9 +531,9 @@
{
RefPtr<IDBCallbacks> callbacks = prpCallbacks;
if (isDeleteDatabaseBlocked()) {
- for (DatabaseCallbacksSet::const_iterator it = m_databaseCallbacksSet.begin(); it != m_databaseCallbacksSet.end(); ++it) {
+ for (auto& callback : m_databaseCallbacksSet) {
// Front end ensures the event is not fired at connections that have closePending set.
- (*it)->onVersionChange(m_metadata.version, 0, IndexedDB::VersionNullness::Null);
+ callback->onVersionChange(m_metadata.version, 0, IndexedDB::VersionNullness::Null);
}
// FIXME: Only fire onBlocked if there are open connections after the
// VersionChangeEvents are received, not just set up to fire.
@@ -603,8 +603,8 @@
if (!connectionCount() && !m_pendingOpenCalls.size() && !m_pendingDeleteCalls.size()) {
TransactionMap transactions(m_transactions);
RefPtr<IDBDatabaseError> error = IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Connection is closing.");
- for (TransactionMap::const_iterator::Values it = transactions.values().begin(), end = transactions.values().end(); it != end; ++it)
- (*it)->abort(error);
+ for (auto& transaction : transactions.values())
+ transaction->abort(error);
ASSERT(m_transactions.isEmpty());
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseMetadata.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseMetadata.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseMetadata.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -39,8 +39,8 @@
result.name = name.isolatedCopy();
- for (auto i = objectStores.begin(), end = objectStores.end(); i != end; ++i)
- result.objectStores.set(i->key, i->value.isolatedCopy());
+ for (auto& objectStore : objectStores)
+ result.objectStores.set(objectStore.key, objectStore.value.isolatedCopy());
return result;
}
@@ -55,8 +55,8 @@
result.name = name.isolatedCopy();
result.keyPath = keyPath.isolatedCopy();
- for (auto i = indexes.begin(), end = indexes.end(); i != end; ++i)
- result.indexes.set(i->key, i->value.isolatedCopy());
+ for (auto& index : indexes)
+ result.indexes.set(index.key, index.value.isolatedCopy());
return result;
}
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKey.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKey.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKey.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -42,8 +42,8 @@
return false;
if (m_type == ArrayType) {
- for (size_t i = 0; i < m_array.size(); i++) {
- if (!m_array[i]->isValid())
+ for (auto& key : m_array) {
+ if (!key->isValid())
return false;
}
}
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKey.h (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKey.h 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKey.h 2015-06-02 03:13:26 UTC (rev 185101)
@@ -64,20 +64,20 @@
KeyArray result;
size_t sizeEstimate = 0;
- for (size_t i = 0; i < array.size(); i++) {
- if (!array[i]->isValid())
+ for (auto& key : array) {
+ if (!key->isValid())
continue;
bool skip = false;
- for (size_t j = 0; j < result.size(); j++) {
- if (array[i]->isEqual(result[j].get())) {
+ for (auto& resultKey : result) {
+ if (key->isEqual(resultKey.get())) {
skip = true;
break;
}
}
if (!skip) {
- result.append(array[i]);
- sizeEstimate += array[i]->m_sizeEstimate;
+ result.append(key);
+ sizeEstimate += key->m_sizeEstimate;
}
}
RefPtr<IDBKey> idbKey = adoptRef(new IDBKey(result, sizeEstimate));
@@ -88,8 +88,8 @@
static Ref<IDBKey> createArray(const KeyArray& array)
{
size_t sizeEstimate = 0;
- for (size_t i = 0; i < array.size(); ++i)
- sizeEstimate += array[i]->m_sizeEstimate;
+ for (auto& key : array)
+ sizeEstimate += key->m_sizeEstimate;
return adoptRef(*new IDBKey(array, sizeEstimate));
}
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyPath.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -203,8 +203,8 @@
, m_array(array)
{
#ifndef NDEBUG
- for (size_t i = 0; i < m_array.size(); ++i)
- ASSERT(!m_array[i].isNull());
+ for (auto& key : array)
+ ASSERT(!key.isNull());
#endif
}
@@ -220,8 +220,8 @@
case ArrayType:
if (m_array.isEmpty())
return false;
- for (size_t i = 0; i < m_array.size(); ++i) {
- if (!IDBIsValidKeyPath(m_array[i]))
+ for (auto& key : m_array) {
+ if (!IDBIsValidKeyPath(key))
return false;
}
return true;
@@ -254,8 +254,8 @@
result.m_string = m_string.isolatedCopy();
result.m_array.reserveInitialCapacity(m_array.size());
- for (size_t i = 0; i < m_array.size(); ++i)
- result.m_array.uncheckedAppend(m_array[i].isolatedCopy());
+ for (auto& key : m_array)
+ result.m_array.uncheckedAppend(key.isolatedCopy());
return result;
}
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -61,8 +61,8 @@
{
LOG(StorageAPI, "IDBObjectStore::indexNames");
RefPtr<DOMStringList> indexNames = DOMStringList::create();
- for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexes.begin(); it != m_metadata.indexes.end(); ++it)
- indexNames->append(it->value.name);
+ for (auto& index : m_metadata.indexes.values())
+ indexNames->append(index.name);
indexNames->sort();
return indexNames.release();
}
@@ -194,15 +194,15 @@
Vector<int64_t> indexIds;
Vector<IndexKeys> indexKeys;
- for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexes.begin(); it != m_metadata.indexes.end(); ++it) {
+ for (auto& index : m_metadata.indexes) {
Vector<IDBKeyData> keyDatas;
- generateIndexKeysForValue(requestState.exec(), it->value, value, keyDatas);
- indexIds.append(it->key);
+ generateIndexKeysForValue(requestState.exec(), index.value, value, keyDatas);
+ indexIds.append(index.key);
// FIXME: Much of the Indexed DB code needs to use IDBKeyData directly to avoid wasteful conversions like this.
Vector<RefPtr<IDBKey>> keys;
- for (auto& i : keyDatas) {
- RefPtr<IDBKey> key = i.maybeCreateIDBKey();
+ for (auto& keyData : keyDatas) {
+ RefPtr<IDBKey> key = keyData.maybeCreateIDBKey();
if (key)
keys.append(key.release());
}
@@ -324,8 +324,8 @@
generateIndexKeysForValue(request->requestState()->exec(), m_indexMetadata, value, indexKeyDatas);
Vector<RefPtr<IDBKey>> indexKeys;
- for (auto& i : indexKeyDatas) {
- RefPtr<IDBKey> key = i.maybeCreateIDBKey();
+ for (auto& indexKeyData : indexKeyDatas) {
+ RefPtr<IDBKey> key = indexKeyData.maybeCreateIDBKey();
if (key)
indexKeys.append(key.release());
}
@@ -430,9 +430,9 @@
}
const IDBIndexMetadata* indexMetadata(0);
- for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexes.begin(); it != m_metadata.indexes.end(); ++it) {
- if (it->value.name == name) {
- indexMetadata = &it->value;
+ for (auto& index : m_metadata.indexes.values()) {
+ if (index.name == name) {
+ indexMetadata = &index;
break;
}
}
@@ -555,10 +555,10 @@
int64_t IDBObjectStore::findIndexId(const String& name) const
{
- for (IDBObjectStoreMetadata::IndexMap::const_iterator it = m_metadata.indexes.begin(); it != m_metadata.indexes.end(); ++it) {
- if (it->value.name == name) {
- ASSERT(it->key != IDBIndexMetadata::InvalidId);
- return it->key;
+ for (auto& index : m_metadata.indexes) {
+ if (index.value.name == name) {
+ ASSERT(index.key != IDBIndexMetadata::InvalidId);
+ return index.key;
}
}
return IDBIndexMetadata::InvalidId;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBPendingTransactionMonitor.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBPendingTransactionMonitor.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBPendingTransactionMonitor.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -58,10 +58,8 @@
void IDBPendingTransactionMonitor::deactivateNewTransactions()
{
ThreadSpecific<TransactionList>& list = transactions();
- for (size_t i = 0; i < list->size(); ++i) {
- RefPtr<IDBTransaction> transaction = list->at(i);
+ for (auto& transaction : *list)
transaction->setActive(false);
- }
// FIXME: Exercise this call to clear() in a layout test.
list->clear();
}
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -163,8 +163,8 @@
RefPtr<IDBRequest> self(this);
EventQueue& eventQueue = scriptExecutionContext()->eventQueue();
- for (size_t i = 0; i < m_enqueuedEvents.size(); ++i) {
- bool removed = eventQueue.cancelEvent(*m_enqueuedEvents[i]);
+ for (auto& event : m_enqueuedEvents) {
+ bool removed = eventQueue.cancelEvent(*event);
ASSERT_UNUSED(removed, removed);
}
m_enqueuedEvents.clear();
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -258,8 +258,8 @@
{
HashSet<IDBCursor*> cursors;
cursors.swap(m_openCursors);
- for (HashSet<IDBCursor*>::iterator i = cursors.begin(); i != cursors.end(); ++i)
- (*i)->close();
+ for (auto& cursor : cursors)
+ cursor->close();
}
void IDBTransaction::registerRequest(IDBRequest* request)
@@ -297,8 +297,8 @@
}
if (isVersionChange()) {
- for (IDBObjectStoreMetadataMap::iterator it = m_objectStoreCleanupMap.begin(); it != m_objectStoreCleanupMap.end(); ++it)
- it->key->setMetadata(it->value);
+ for (auto& objectStore : m_objectStoreCleanupMap)
+ objectStore.key->setMetadata(objectStore.value);
m_database->setMetadata(m_previousMetadata);
m_database->close();
}
@@ -370,11 +370,11 @@
m_state = Finished;
// Break reference cycles.
- for (IDBObjectStoreMap::iterator it = m_objectStoreMap.begin(); it != m_objectStoreMap.end(); ++it)
- it->value->transactionFinished();
+ for (auto& objectStore : m_objectStoreMap)
+ objectStore.value->transactionFinished();
m_objectStoreMap.clear();
- for (IDBObjectStoreSet::iterator it = m_deletedObjectStores.begin(); it != m_deletedObjectStores.end(); ++it)
- (*it)->transactionFinished();
+ for (auto& objectStore : m_deletedObjectStores)
+ objectStore->transactionFinished();
m_deletedObjectStores.clear();
Vector<RefPtr<EventTarget>> targets;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackend.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackend.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackend.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -44,8 +44,8 @@
Ref<IDBTransactionBackend> IDBTransactionBackend::create(IDBDatabaseBackend* databaseBackend, int64_t id, PassRefPtr<IDBDatabaseCallbacks> callbacks, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode)
{
HashSet<int64_t> objectStoreHashSet;
- for (size_t i = 0; i < objectStoreIds.size(); ++i)
- objectStoreHashSet.add(objectStoreIds[i]);
+ for (auto& id : objectStoreIds)
+ objectStoreHashSet.add(id);
return adoptRef(*new IDBTransactionBackend(databaseBackend, id, callbacks, objectStoreHashSet, mode));
}
@@ -307,8 +307,8 @@
void IDBTransactionBackend::closeOpenCursors()
{
- for (HashSet<IDBCursorBackend*>::iterator i = m_openCursors.begin(); i != m_openCursors.end(); ++i)
- (*i)->close();
+ for (auto& cursor : m_openCursors)
+ cursor->close();
m_openCursors.clear();
}
Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -836,8 +836,8 @@
m_activeSourceBuffers->clear();
// Clear SourceBuffer references to this object.
- for (unsigned long i = 0, length = m_sourceBuffers->length(); i < length; ++i)
- m_sourceBuffers->item(i)->removedFromMediaSource();
+ for (auto& buffer : *m_sourceBuffers)
+ buffer->removedFromMediaSource();
m_sourceBuffers->clear();
scheduleEvent(eventNames().sourcecloseEvent);
Modified: trunk/Source/WebCore/Modules/mediastream/MediaConstraintsImpl.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/mediastream/MediaConstraintsImpl.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/mediastream/MediaConstraintsImpl.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -67,8 +67,8 @@
String mandatory = ASCIILiteral("mandatory");
String optional = ASCIILiteral("optional");
- for (Vector<String>::iterator it = names.begin(); it != names.end(); ++it) {
- if (*it != mandatory && *it != optional)
+ for (auto& name : names) {
+ if (name != mandatory && name != optional)
return false;
}
@@ -122,9 +122,8 @@
void MediaConstraintsImpl::getMandatoryConstraints(Vector<MediaConstraint>& constraints) const
{
constraints.clear();
- HashMap<String, String>::const_iterator i = m_mandatoryConstraints.begin();
- for (; i != m_mandatoryConstraints.end(); ++i)
- constraints.append(MediaConstraint(i->key, i->value));
+ for (auto& constraint : m_mandatoryConstraints)
+ constraints.append(MediaConstraint(constraint.key, constraint.value));
}
void MediaConstraintsImpl::getOptionalConstraints(Vector<MediaConstraint>& constraints) const
@@ -145,10 +144,9 @@
bool MediaConstraintsImpl::getOptionalConstraintValue(const String& name, String& value) const
{
- Vector<MediaConstraint>::const_iterator i = m_optionalConstraints.begin();
- for (; i != m_optionalConstraints.end(); ++i) {
- if (i->m_name == name) {
- value = i->m_value;
+ for (auto& constraint : m_optionalConstraints) {
+ if (constraint.m_name == name) {
+ value = constraint.m_value;
return true;
}
}
Modified: trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStream.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -51,11 +51,11 @@
Vector<RefPtr<MediaStreamTrackPrivate>> audioTracks;
Vector<RefPtr<MediaStreamTrackPrivate>> videoTracks;
- for (size_t i = 0; i < stream->m_audioTracks.size(); ++i)
- audioTracks.append(&stream->m_audioTracks[i]->privateTrack());
+ for (auto& track : stream->m_audioTracks)
+ audioTracks.append(&track->privateTrack());
- for (size_t i = 0; i < stream->m_videoTracks.size(); ++i)
- videoTracks.append(&stream->m_videoTracks[i]->privateTrack());
+ for (auto& track : stream->m_videoTracks)
+ videoTracks.append(&track->privateTrack());
return MediaStream::create(context, MediaStreamPrivate::create(audioTracks, videoTracks));
}
@@ -65,11 +65,11 @@
Vector<RefPtr<MediaStreamTrackPrivate>> audioTracks;
Vector<RefPtr<MediaStreamTrackPrivate>> videoTracks;
- for (size_t i = 0; i < tracks.size(); ++i) {
- if (tracks[i]->kind() == "audio")
- audioTracks.append(&tracks[i]->privateTrack());
+ for (auto& track : tracks) {
+ if (track->kind() == "audio")
+ audioTracks.append(&track->privateTrack());
else
- videoTracks.append(&tracks[i]->privateTrack());
+ videoTracks.append(&track->privateTrack());
}
return MediaStream::create(context, MediaStreamPrivate::create(audioTracks, videoTracks));
@@ -134,8 +134,8 @@
void MediaStream::cloneMediaStreamTrackVector(Vector<RefPtr<MediaStreamTrack>>& destination, const Vector<RefPtr<MediaStreamTrack>>& source)
{
- for (auto it = source.begin(), end = source.end(); it != end; ++it)
- destination.append((*it)->clone());
+ for (auto& track : source)
+ destination.append(track->clone());
}
void MediaStream::addTrack(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionCode& ec)
@@ -146,8 +146,8 @@
}
if (addTrack(prpTrack)) {
- for (auto observer = m_observers.begin(), end = m_observers.end(); observer != end; ++observer)
- (*observer)->didAddOrRemoveTrack();
+ for (auto& observer : m_observers)
+ observer->didAddOrRemoveTrack();
}
}
@@ -181,8 +181,8 @@
}
if (removeTrack(prpTrack)) {
- for (auto observer = m_observers.begin(), end = m_observers.end(); observer != end; ++observer)
- (*observer)->didAddOrRemoveTrack();
+ for (auto& observer : m_observers)
+ observer->didAddOrRemoveTrack();
}
}
@@ -216,15 +216,15 @@
bool MediaStream::haveTrackWithSource(PassRefPtr<RealtimeMediaSource> source)
{
if (source->type() == RealtimeMediaSource::Audio) {
- for (auto it = m_audioTracks.begin(), end = m_audioTracks.end(); it != end; ++it) {
- if ((*it)->source() == source.get())
+ for (auto& track : m_audioTracks) {
+ if (track->source() == source.get())
return true;
}
return false;
}
- for (auto it = m_videoTracks.begin(), end = m_videoTracks.end(); it != end; ++it) {
- if ((*it)->source() == source.get())
+ for (auto& track : m_videoTracks) {
+ if (track->source() == source.get())
return true;
}
@@ -233,14 +233,14 @@
MediaStreamTrack* MediaStream::getTrackById(String id)
{
- for (auto it = m_audioTracks.begin(), end = m_audioTracks.end(); it != end; ++it) {
- if ((*it)->id() == id)
- return (*it).get();
+ for (auto& track : m_audioTracks) {
+ if (track->id() == id)
+ return track.get();
}
- for (auto it = m_videoTracks.begin(), end = m_videoTracks.end(); it != end; ++it) {
- if ((*it)->id() == id)
- return (*it).get();
+ for (auto& track : m_videoTracks) {
+ if (track->id() == id)
+ return track.get();
}
return nullptr;
@@ -249,22 +249,22 @@
Vector<RefPtr<MediaStreamTrack>> MediaStream::getTracks()
{
Vector<RefPtr<MediaStreamTrack>> tracks;
- for (auto it = m_audioTracks.begin(), end = m_audioTracks.end(); it != end; ++it)
- tracks.append((*it).get());
- for (auto it = m_videoTracks.begin(), end = m_videoTracks.end(); it != end; ++it)
- tracks.append((*it).get());
+ for (auto& track : m_audioTracks)
+ tracks.append(track.get());
+ for (auto& track : m_videoTracks)
+ tracks.append(track.get());
return tracks;
}
void MediaStream::trackDidEnd()
{
- for (auto it = m_audioTracks.begin(), end = m_audioTracks.end(); it != end; ++it) {
- if (!(*it)->ended())
+ for (auto& track : m_audioTracks) {
+ if (!track->ended())
return;
}
- for (auto it = m_videoTracks.begin(), end = m_videoTracks.end(); it != end; ++it) {
- if (!(*it)->ended())
+ for (auto& track : m_videoTracks) {
+ if (!track->ended())
return;
}
@@ -361,8 +361,8 @@
Vector<RefPtr<Event>> events;
events.swap(m_scheduledEvents);
- for (auto it = events.begin(), end = events.end(); it != end; ++it)
- dispatchEvent((*it).release());
+ for (auto& event : events)
+ dispatchEvent(event.release());
events.clear();
}
Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamCapabilities.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -58,12 +58,11 @@
if (!count)
return Vector<String>();
- const Vector<RealtimeMediaSourceStates::SourceType>& sourceTypes = m_SourceCapabilities->sourceTypes();
Vector<String> capabilities;
capabilities.reserveCapacity(count);
- for (size_t i = 0; i < count; ++i)
- capabilities.append(RealtimeMediaSourceStates::sourceType(sourceTypes[i]));
+ for (auto& type : m_SourceCapabilities->sourceTypes())
+ capabilities.append(RealtimeMediaSourceStates::sourceType(type));
return capabilities;
}
@@ -73,14 +72,13 @@
size_t count = m_SourceCapabilities->sourceId().size();
if (!count)
return Vector<String>();
-
- const Vector<AtomicString>& sourceIds = m_SourceCapabilities->sourceId();
+
Vector<String> capabilities;
capabilities.reserveCapacity(count);
+
+ for (auto& id : m_SourceCapabilities->sourceId())
+ capabilities.append(id);
- for (size_t i = 0; i < count; ++i)
- capabilities.append(sourceIds[i]);
-
return capabilities;
}
@@ -92,12 +90,11 @@
if (!count)
return Vector<String>();
- const Vector<RealtimeMediaSourceStates::VideoFacingMode>& facingModes = m_SourceCapabilities->facingModes();
Vector<String> capabilities;
capabilities.reserveCapacity(count);
- for (size_t i = 0; i < count; ++i)
- capabilities.append(RealtimeMediaSourceStates::facingMode(facingModes[i]));
+ for (auto& mode : m_SourceCapabilities->facingModes())
+ capabilities.append(RealtimeMediaSourceStates::facingMode(mode));
return capabilities;
}
Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -290,8 +290,8 @@
{
m_privateTrack->setReadyState(RealtimeMediaSource::Ended);
- for (Vector<Observer*>::iterator i = m_observers.begin(); i != m_observers.end(); ++i)
- (*i)->trackDidEnd();
+ for (auto& observer : m_observers)
+ observer->trackDidEnd();
}
void MediaStreamTrack::stop()
Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrackSourcesRequest.cpp (185100 => 185101)
--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrackSourcesRequest.cpp 2015-06-02 03:11:11 UTC (rev 185100)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrackSourcesRequest.cpp 2015-06-02 03:13:26 UTC (rev 185101)
@@ -52,8 +52,8 @@
{
ASSERT(m_callback);
- for (size_t i = 0; i < requestSourceInfos.size(); ++i)
- m_sourceInfos.append(SourceInfo::create(requestSourceInfos[i]));
+ for (auto& info : requestSourceInfos)
+ m_sourceInfos.append(SourceInfo::create(info));
RefPtr<MediaStreamTrackSourcesRequest> protectedThis(this);
callOnMainThread([protectedThis] {