Changeset 185316 in webkit
- Timestamp:
- Jun 8, 2015 7:36:47 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r185310 r185316 1 2015-06-08 Hunseop Jeong <hs85.jeong@samsung.com> 2 3 Use modern for-loops in WebCore/Modules - 2 4 https://bugs.webkit.org/show_bug.cgi?id=145541 5 6 Reviewed by Darin Adler. 7 8 No new tests, no behavior changes. 9 10 * Modules/mediastream/RTCConfiguration.h: 11 (WebCore::RTCConfiguration::iceServers): 12 * Modules/mediastream/RTCDTMFSender.cpp: 13 (WebCore::RTCDTMFSender::scheduledEventTimerFired): 14 * Modules/mediastream/RTCDataChannel.cpp: 15 (WebCore::RTCDataChannel::scheduledEventTimerFired): 16 * Modules/mediastream/RTCPeerConnection.cpp: 17 (WebCore::processIceServer): 18 (WebCore::RTCPeerConnection::~RTCPeerConnection): 19 (WebCore::RTCPeerConnection::getStreamById): 20 (WebCore::RTCPeerConnection::hasLocalStreamWithTrackId): 21 (WebCore::RTCPeerConnection::stop): 22 (WebCore::RTCPeerConnection::scheduledEventTimerFired): 23 * Modules/mediastream/RTCStatsReport.cpp: 24 (WebCore::RTCStatsReport::names): 25 * Modules/navigatorcontentutils/NavigatorContentUtils.cpp: 26 (WebCore::initProtocolHandlerWhitelist): 27 * Modules/speech/SpeechSynthesis.cpp: 28 (WebCore::SpeechSynthesis::getVoices): 29 * Modules/webaudio/AudioBuffer.cpp: 30 (WebCore::AudioBuffer::memoryCost): 31 * Modules/webaudio/AudioContext.cpp: 32 (WebCore::AudioContext::createMediaStreamSource): 33 (WebCore::AudioContext::derefFinishedSourceNodes): 34 (WebCore::AudioContext::derefUnfinishedSourceNodes): 35 (WebCore::AudioContext::handleDeferredFinishDerefs): 36 (WebCore::AudioContext::handleDirtyAudioSummingJunctions): 37 (WebCore::AudioContext::handleDirtyAudioNodeOutputs): 38 (WebCore::AudioContext::updateAutomaticPullNodes): 39 (WebCore::AudioContext::processAutomaticPullNodes): 40 * Modules/webaudio/AudioNode.cpp: 41 (WebCore::AudioNode::updateChannelsForInputs): 42 (WebCore::AudioNode::checkNumberOfChannelsForInput): 43 (WebCore::AudioNode::pullInputs): 44 (WebCore::AudioNode::inputsAreSilent): 45 (WebCore::AudioNode::silenceOutputs): 46 (WebCore::AudioNode::unsilenceOutputs): 47 (WebCore::AudioNode::enableOutputsIfNecessary): 48 (WebCore::AudioNode::disableOutputsIfNecessary): 49 (WebCore::AudioNode::finishDeref): 50 * Modules/webaudio/AudioNodeInput.cpp: 51 (WebCore::AudioNodeInput::numberOfChannels): 52 (WebCore::AudioNodeInput::sumAllConnections): 53 * Modules/webaudio/AudioNodeOutput.cpp: 54 (WebCore::AudioNodeOutput::propagateChannelCount): 55 (WebCore::AudioNodeOutput::disable): 56 (WebCore::AudioNodeOutput::enable): 57 * Modules/webaudio/AudioParam.cpp: 58 (WebCore::AudioParam::calculateFinalValues): 59 * Modules/webaudio/AudioParamTimeline.cpp: 60 (WebCore::AudioParamTimeline::insertEvent): 61 * Modules/webaudio/AudioSummingJunction.cpp: 62 (WebCore::AudioSummingJunction::updateRenderingState): 63 * Modules/webaudio/MediaStreamAudioSource.cpp: 64 (WebCore::MediaStreamAudioSource::setAudioFormat): 65 (WebCore::MediaStreamAudioSource::consumeAudio): 66 * Modules/webaudio/WaveShaperProcessor.cpp: 67 (WebCore::WaveShaperProcessor::setOversample): 68 * Modules/webdatabase/DatabaseThread.cpp: 69 (WebCore::DatabaseThread::handlePausedQueue): 70 (WebCore::DatabaseThread::databaseThread): 71 * Modules/webdatabase/DatabaseTracker.cpp: 72 (WebCore::DatabaseTracker::interruptAllDatabasesForContext): 73 (WebCore::DatabaseTracker::databaseNamesForOrigin): 74 (WebCore::DatabaseTracker::getOpenDatabases): 75 (WebCore::DatabaseTracker::usageForOrigin): 76 (WebCore::DatabaseTracker::deleteAllDatabases): 77 (WebCore::DatabaseTracker::deleteOrigin): 78 (WebCore::DatabaseTracker::deleteDatabaseFile): 79 (WebCore::DatabaseTracker::removeDeletedOpenedDatabases): 80 (WebCore::DatabaseTracker::setDatabasesPaused): 81 * Modules/webdatabase/SQLTransactionCoordinator.cpp: 82 (WebCore::SQLTransactionCoordinator::shutdown): 83 * Modules/websockets/WebSocket.cpp: 84 (WebCore::WebSocket::connect): 85 * Modules/websockets/WebSocketExtensionDispatcher.cpp: 86 (WebCore::WebSocketExtensionDispatcher::addProcessor): 87 (WebCore::WebSocketExtensionDispatcher::appendAcceptedExtension): 88 (WebCore::WebSocketExtensionDispatcher::processHeaderValue): 89 * Modules/websockets/WebSocketHandshake.cpp: 90 (WebCore::WebSocketHandshake::clientHandshakeMessage): 91 1 92 2015-06-07 Darin Adler <darin@apple.com> 2 93 … … 69252 69343 must either be on a separate object (more boilerplate), or the callback must be public for 69253 69344 HysteresisActivity to call them, or friends get involved. Without the boilerplate of extra 69254 delegate objects it's hard to scale use of these objects - 69345 delegate objects it's hard to scale use of these objects - a single object can't serve as a 69255 69346 delegate for multiple HysteresisActivity members. 69256 69347 -
trunk/Source/WebCore/Modules/mediastream/RTCConfiguration.h
r184940 r185316 68 68 { 69 69 Vector<RefPtr<RTCIceServer>> servers; 70 Vector<RefPtr<RTCIceServerPrivate>> privateServers = m_private->iceServers(); 71 72 for (auto iter = privateServers.begin(); iter != privateServers.end(); ++iter) 73 servers.append(RTCIceServer::create(*iter)); 70 for (auto& server : m_private->iceServers()) 71 servers.append(RTCIceServer::create(server)); 74 72 75 73 return servers; -
trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp
r185091 r185316 162 162 events.swap(m_scheduledEvents); 163 163 164 Vector<RefPtr<Event>>::iterator it = events.begin(); 165 for (; it != events.end(); ++it) 166 dispatchEvent((*it).release()); 164 for (auto& event : events) 165 dispatchEvent(event.release()); 167 166 } 168 167 -
trunk/Source/WebCore/Modules/mediastream/RTCDataChannel.cpp
r184709 r185316 321 321 events.swap(m_scheduledEvents); 322 322 323 Vector<RefPtr<Event>>::iterator it = events.begin(); 324 for (; it != events.end(); ++it) 325 dispatchEvent((*it).release()); 326 327 events.clear(); 323 for (auto& event : events) 324 dispatchEvent(event.release()); 328 325 } 329 326 -
trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
r185091 r185316 96 96 97 97 if (urlString.find(',') != notFound && iceServer.get("urls", urlsList) && urlsList.size()) { 98 for (auto iter = urlsList.begin(); iter != urlsList.end(); ++iter) {99 if (!validateIceServerURL( *iter))98 for (auto& url : urlsList) { 99 if (!validateIceServerURL(url)) 100 100 return INVALID_ACCESS_ERR; 101 101 } … … 204 204 stop(); 205 205 206 for (auto stream = m_localStreams.begin(), end = m_localStreams.end(); stream != end; ++stream)207 (*stream)->removeObserver(this);206 for (auto& localStream : m_localStreams) 207 localStream->removeObserver(this); 208 208 } 209 209 … … 515 515 MediaStream* RTCPeerConnection::getStreamById(const String& streamId) 516 516 { 517 for (auto iter = m_localStreams.begin(); iter != m_localStreams.end(); ++iter) {518 if ( (*iter)->id() == streamId)519 return iter->get();520 } 521 522 for (auto iter = m_remoteStreams.begin(); iter != m_remoteStreams.end(); ++iter) {523 if ( (*iter)->id() == streamId)524 return iter->get();517 for (auto& localStream : m_localStreams) { 518 if (localStream->id() == streamId) 519 return localStream.get(); 520 } 521 522 for (auto& remoteStream : m_remoteStreams) { 523 if (remoteStream->id() == streamId) 524 return remoteStream.get(); 525 525 } 526 526 … … 552 552 bool RTCPeerConnection::hasLocalStreamWithTrackId(const String& trackId) 553 553 { 554 for (auto iter = m_localStreams.begin(); iter != m_localStreams.end(); ++iter) {555 if ( (*iter)->getTrackById(trackId))554 for (auto& localStream : m_localStreams) { 555 if (localStream->getTrackById(trackId)) 556 556 return true; 557 557 } … … 686 686 m_signalingState = SignalingStateClosed; 687 687 688 Vector<RefPtr<RTCDataChannel>>::iterator i = m_dataChannels.begin(); 689 for (; i != m_dataChannels.end(); ++i) 690 (*i)->stop(); 688 for (auto& channel : m_dataChannels) 689 channel->stop(); 691 690 } 692 691 … … 744 743 events.swap(m_scheduledEvents); 745 744 746 Vector<RefPtr<Event>>::iterator it = events.begin(); 747 for (; it != events.end(); ++it) 748 dispatchEvent((*it).release()); 745 for (auto& event : events) 746 dispatchEvent(event.release()); 749 747 750 748 events.clear(); -
trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.cpp
r184940 r185316 49 49 { 50 50 Vector<String> result; 51 for (HashMap<String, String>::const_iterator it = m_stats.begin(); it != m_stats.end(); ++it) { 52 result.append(it->key); 53 } 51 for (auto& stat : m_stats.keys()) 52 result.append(stat); 54 53 return result; 55 54 } -
trunk/Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.cpp
r171911 r185316 45 45 { 46 46 protocolWhitelist = new HashSet<String>; 47 static const char* protocols[] = { 48 "bitcoin", 49 "geo", 50 "im", 51 "irc", 52 "ircs", 53 "magnet", 54 "mailto", 55 "mms", 56 "news", 57 "nntp", 58 "sip", 59 "sms", 60 "smsto", 61 "ssh", 62 "tel", 63 "urn", 64 "webcal", 65 "wtai", 66 "xmpp", 67 }; 68 for (size_t i = 0; i < WTF_ARRAY_LENGTH(protocols); ++i) 69 protocolWhitelist->add(protocols[i]); 47 for (auto* protocol : { "bitcoin", "geo", "im", "irc", "ircs", "magnet", "mailto", "mms", "news", "nntp", "sip", "sms", "smsto", "ssh", "tel", "urn", "webcal", "wtai", "xmpp" }) 48 protocolWhitelist->add(protocol); 70 49 } 71 50 -
trunk/Source/WebCore/Modules/speech/SpeechSynthesis.cpp
r184940 r185316 75 75 76 76 // If the voiceList is empty, that's the cue to get the voices from the platform again. 77 const Vector<RefPtr<PlatformSpeechSynthesisVoice>>& platformVoices = m_platformSpeechSynthesizer->voiceList(); 78 size_t voiceCount = platformVoices.size(); 79 for (size_t k = 0; k < voiceCount; k++) 80 m_voiceList.append(SpeechSynthesisVoice::create(platformVoices[k])); 77 for (auto& voice : m_platformSpeechSynthesizer->voiceList()) 78 m_voiceList.append(SpeechSynthesisVoice::create(voice)); 81 79 82 80 return m_voiceList; -
trunk/Source/WebCore/Modules/webaudio/AudioBuffer.cpp
r177733 r185316 126 126 { 127 127 size_t cost = 0; 128 for ( unsigned i = 0; i < m_channels.size() ; ++i)129 cost += m_channels[i]->byteLength();128 for (auto& channel : m_channels) 129 cost += channel->byteLength(); 130 130 return cost; 131 131 } -
trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp
r185091 r185316 461 461 AudioSourceProvider* provider = 0; 462 462 463 Vector<RefPtr<MediaStreamTrack>> audioTracks = mediaStream->getAudioTracks();464 463 RefPtr<MediaStreamTrack> audioTrack; 465 464 466 465 // FIXME: get a provider for non-local MediaStreams (like from a remote peer). 467 for ( size_t i = 0; i < audioTracks.size(); ++i) {468 audioTrack = audioTracks[i];466 for (auto& track : mediaStream->getAudioTracks()) { 467 audioTrack = track; 469 468 if (audioTrack->source()->isAudioStreamSource()) { 470 469 auto source = static_cast<MediaStreamAudioSource*>(audioTrack->source()); … … 665 664 ASSERT(isGraphOwner()); 666 665 ASSERT(isAudioThread() || isAudioThreadFinished()); 667 for ( unsigned i = 0; i < m_finishedNodes.size(); i++)668 derefNode( m_finishedNodes[i]);666 for (auto& node : m_finishedNodes) 667 derefNode(node); 669 668 670 669 m_finishedNodes.clear(); … … 693 692 { 694 693 ASSERT(isMainThread() && isAudioThreadFinished()); 695 for ( unsigned i = 0; i < m_referencedNodes.size(); ++i)696 m_referencedNodes[i]->deref(AudioNode::RefTypeConnection);694 for (auto& node : m_referencedNodes) 695 node->deref(AudioNode::RefTypeConnection); 697 696 698 697 m_referencedNodes.clear(); … … 826 825 { 827 826 ASSERT(isAudioThread() && isGraphOwner()); 828 for (unsigned i = 0; i < m_deferredFinishDerefList.size(); ++i) { 829 AudioNode* node = m_deferredFinishDerefList[i]; 827 for (auto& node : m_deferredFinishDerefList) 830 828 node->finishDeref(AudioNode::RefTypeConnection); 831 }832 829 833 830 m_deferredFinishDerefList.clear(); … … 923 920 ASSERT(isGraphOwner()); 924 921 925 for ( HashSet<AudioSummingJunction*>::iterator i = m_dirtySummingJunctions.begin(); i != m_dirtySummingJunctions.end(); ++i)926 (*i)->updateRenderingState();922 for (auto& junction : m_dirtySummingJunctions) 923 junction->updateRenderingState(); 927 924 928 925 m_dirtySummingJunctions.clear(); … … 933 930 ASSERT(isGraphOwner()); 934 931 935 for ( HashSet<AudioNodeOutput*>::iterator i = m_dirtyAudioNodeOutputs.begin(); i != m_dirtyAudioNodeOutputs.end(); ++i)936 (*i)->updateRenderingState();932 for (auto& output : m_dirtyAudioNodeOutputs) 933 output->updateRenderingState(); 937 934 938 935 m_dirtyAudioNodeOutputs.clear(); … … 963 960 m_renderingAutomaticPullNodes.resize(m_automaticPullNodes.size()); 964 961 965 unsigned j = 0; 966 for (HashSet<AudioNode*>::iterator i = m_automaticPullNodes.begin(); i != m_automaticPullNodes.end(); ++i, ++j) { 967 AudioNode* output = *i; 968 m_renderingAutomaticPullNodes[j] = output; 969 } 962 unsigned i = 0; 963 for (auto& output : m_automaticPullNodes) 964 m_renderingAutomaticPullNodes[i++] = output; 970 965 971 966 m_automaticPullNodesNeedUpdating = false; … … 977 972 ASSERT(isAudioThread()); 978 973 979 for ( unsigned i = 0; i < m_renderingAutomaticPullNodes.size(); ++i)980 m_renderingAutomaticPullNodes[i]->processIfNecessary(framesToProcess);974 for (auto& node : m_renderingAutomaticPullNodes) 975 node->processIfNecessary(framesToProcess); 981 976 } 982 977 -
trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp
r182889 r185316 278 278 void AudioNode::updateChannelsForInputs() 279 279 { 280 for ( unsigned i = 0; i < m_inputs.size(); ++i)281 input (i)->changedOutputs();280 for (auto& input : m_inputs) 281 input->changedOutputs(); 282 282 } 283 283 … … 326 326 ASSERT(context()->isAudioThread() && context()->isGraphOwner()); 327 327 328 for ( const std::unique_ptr<AudioNodeInput>& savedInput : m_inputs) {328 for (auto& savedInput : m_inputs) { 329 329 if (input == savedInput.get()) { 330 330 input->updateInternalBus(); … … 346 346 347 347 // Process all of the AudioNodes connected to our inputs. 348 for ( unsigned i = 0; i < m_inputs.size(); ++i)349 input (i)->pull(0, framesToProcess);348 for (auto& input : m_inputs) 349 input->pull(0, framesToProcess); 350 350 } 351 351 352 352 bool AudioNode::inputsAreSilent() 353 353 { 354 for ( unsigned i = 0; i < m_inputs.size(); ++i) {355 if (!input (i)->bus()->isSilent())354 for (auto& input : m_inputs) { 355 if (!input->bus()->isSilent()) 356 356 return false; 357 357 } … … 361 361 void AudioNode::silenceOutputs() 362 362 { 363 for ( unsigned i = 0; i < m_outputs.size(); ++i)364 output (i)->bus()->zero();363 for (auto& output : m_outputs) 364 output->bus()->zero(); 365 365 } 366 366 367 367 void AudioNode::unsilenceOutputs() 368 368 { 369 for ( unsigned i = 0; i < m_outputs.size(); ++i)370 output (i)->bus()->clearSilentFlag();369 for (auto& output : m_outputs) 370 output->bus()->clearSilentFlag(); 371 371 } 372 372 … … 378 378 379 379 m_isDisabled = false; 380 for ( unsigned i = 0; i < m_outputs.size(); ++i)381 output (i)->enable();380 for (auto& output : m_outputs) 381 output->enable(); 382 382 } 383 383 } … … 403 403 if (nodeType() != NodeTypeConvolver && nodeType() != NodeTypeDelay) { 404 404 m_isDisabled = true; 405 for ( unsigned i = 0; i < m_outputs.size(); ++i)406 output (i)->disable();405 for (auto& output : m_outputs) 406 output->disable(); 407 407 } 408 408 } … … 493 493 if (!m_isMarkedForDeletion) { 494 494 // All references are gone - we need to go away. 495 for ( unsigned i = 0; i < m_outputs.size(); ++i)496 output (i)->disconnectAll(); // This will deref() nodes we're connected to.495 for (auto& output : m_outputs) 496 output->disconnectAll(); // This will deref() nodes we're connected to. 497 497 498 498 // Mark for deletion at end of each render quantum or when context shuts down. -
trunk/Source/WebCore/Modules/webaudio/AudioNodeInput.cpp
r157971 r185316 152 152 unsigned maxChannels = 1; // one channel is the minimum allowed 153 153 154 for (HashSet<AudioNodeOutput*>::iterator i = m_outputs.begin(); i != m_outputs.end(); ++i) { 155 AudioNodeOutput* output = *i; 154 for (auto& output : m_outputs) { 156 155 // Use output()->numberOfChannels() instead of output->bus()->numberOfChannels(), 157 156 // because the calling of AudioNodeOutput::bus() is not safe here. … … 199 198 AudioBus::ChannelInterpretation interpretation = node()->internalChannelInterpretation(); 200 199 201 for (unsigned i = 0; i < numberOfRenderingConnections(); ++i) { 202 AudioNodeOutput* output = renderingOutput(i); 200 for (auto& output : m_renderingOutputs) { 203 201 ASSERT(output); 204 202 -
trunk/Source/WebCore/Modules/webaudio/AudioNodeOutput.cpp
r149817 r185316 99 99 if (isChannelCountKnown()) { 100 100 // Announce to any nodes we're connected to that we changed our channel count for its input. 101 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i) { 102 AudioNodeInput* input = *i; 101 for (auto& input : m_inputs) { 103 102 AudioNode* connectionNode = input->node(); 104 103 connectionNode->checkNumberOfChannelsForInput(input); … … 231 230 232 231 if (m_isEnabled) { 233 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i) { 234 AudioNodeInput* input = *i; 232 for (auto& input : m_inputs) 235 233 input->disable(this); 236 }237 234 m_isEnabled = false; 238 235 } … … 244 241 245 242 if (!m_isEnabled) { 246 for (InputsIterator i = m_inputs.begin(); i != m_inputs.end(); ++i) { 247 AudioNodeInput* input = *i; 243 for (auto& input : m_inputs) 248 244 input->enable(this); 249 }250 245 m_isEnabled = true; 251 246 } -
trunk/Source/WebCore/Modules/webaudio/AudioParam.cpp
r154967 r185316 140 140 summingBus->setChannelMemory(0, values, numberOfValues); 141 141 142 for (unsigned i = 0; i < numberOfRenderingConnections(); ++i) { 143 AudioNodeOutput* output = renderingOutput(i); 142 for (auto& output : m_renderingOutputs) { 144 143 ASSERT(output); 145 144 -
trunk/Source/WebCore/Modules/webaudio/AudioParamTimeline.cpp
r162296 r185316 85 85 unsigned i = 0; 86 86 float insertTime = event.time(); 87 for ( i = 0; i < m_events.size(); ++i) {87 for (auto& paramEvent : m_events) { 88 88 // Overwrite same event type and time. 89 if ( m_events[i].time() == insertTime && m_events[i].type() == event.type()) {90 m_events[i]= event;89 if (paramEvent.time() == insertTime && paramEvent.type() == event.type()) { 90 paramEvent = event; 91 91 return; 92 92 } 93 93 94 if ( m_events[i].time() > insertTime)94 if (paramEvent.time() > insertTime) 95 95 break; 96 97 ++i; 96 98 } 97 99 -
trunk/Source/WebCore/Modules/webaudio/AudioSummingJunction.cpp
r157971 r185316 63 63 // Copy from m_outputs to m_renderingOutputs. 64 64 m_renderingOutputs.resize(m_outputs.size()); 65 unsigned j = 0; 66 for (HashSet<AudioNodeOutput*>::iterator i = m_outputs.begin(); i != m_outputs.end(); ++i, ++j) { 67 AudioNodeOutput* output = *i; 68 m_renderingOutputs[j] = output; 65 unsigned i = 0; 66 for (auto& output : m_outputs) { 67 m_renderingOutputs[i++] = output; 69 68 output->updateRenderingState(); 70 69 } -
trunk/Source/WebCore/Modules/webaudio/MediaStreamAudioSource.cpp
r184940 r185316 82 82 { 83 83 MutexLocker locker(m_audioConsumersLock); 84 for ( Vector<RefPtr<AudioDestinationConsumer>>::iterator it = m_audioConsumers.begin(); it != m_audioConsumers.end(); ++it)85 (*it)->setFormat(numberOfChannels, sampleRate);84 for (auto& consumer : m_audioConsumers) 85 consumer->setFormat(numberOfChannels, sampleRate); 86 86 } 87 87 … … 89 89 { 90 90 MutexLocker locker(m_audioConsumersLock); 91 for ( Vector<RefPtr<AudioDestinationConsumer>>::iterator it = m_audioConsumers.begin(); it != m_audioConsumers.end(); ++it)92 (*it)->consumeAudio(bus, numberOfFrames);91 for (auto& consumer : m_audioConsumers) 92 consumer->consumeAudio(bus, numberOfFrames); 93 93 } 94 94 -
trunk/Source/WebCore/Modules/webaudio/WaveShaperProcessor.cpp
r162368 r185316 66 66 67 67 if (oversample != OverSampleNone) { 68 for ( unsigned i = 0; i < m_kernels.size(); ++i) {69 WaveShaperDSPKernel * kernel = static_cast<WaveShaperDSPKernel*>(m_kernels[i].get());70 kernel ->lazyInitializeOversampling();68 for (auto& audioDSPKernel : m_kernels) { 69 WaveShaperDSPKernel& kernel = static_cast<WaveShaperDSPKernel&>(*audioDSPKernel); 70 kernel.lazyInitializeOversampling(); 71 71 } 72 72 } -
trunk/Source/WebCore/Modules/webdatabase/DatabaseThread.cpp
r181577 r185316 151 151 pausedTasks.append(WTF::move(task)); 152 152 153 for ( unsigned i = 0; i < pausedTasks.size(); ++i) {153 for (auto& pausedTask : pausedTasks) { 154 154 AutodrainedPool pool; 155 155 156 std::unique_ptr<DatabaseTask> task(pausedTask s[i].release());156 std::unique_ptr<DatabaseTask> task(pausedTask.release()); 157 157 { 158 158 MutexLocker pausedLocker(m_pausedMutex); … … 204 204 DatabaseSet openSetCopy; 205 205 openSetCopy.swap(m_openDatabaseSet); 206 DatabaseSet::iterator end = openSetCopy.end(); 207 for (DatabaseSet::iterator it = openSetCopy.begin(); it != end; ++it) 208 (*it).get()->close(); 206 for (auto& openDatabase : openSetCopy) 207 openDatabase->close(); 209 208 } 210 209 -
trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp
r185129 r185316 339 339 return; 340 340 341 DatabaseNameMap::const_iterator dbNameMapEndIt = nameMap->end(); 342 for (DatabaseNameMap::const_iterator dbNameMapIt = nameMap->begin(); dbNameMapIt != dbNameMapEndIt; ++dbNameMapIt) { 343 DatabaseSet* databaseSet = dbNameMapIt->value; 344 DatabaseSet::const_iterator dbSetEndIt = databaseSet->end(); 345 for (DatabaseSet::const_iterator dbSetIt = databaseSet->begin(); dbSetIt != dbSetEndIt; ++dbSetIt) { 346 if ((*dbSetIt)->databaseContext() == context) 347 openDatabases.append(*dbSetIt); 341 for (auto& databaseSet : nameMap->values()) { 342 for (auto& database : *databaseSet) { 343 if (database->databaseContext() == context) 344 openDatabases.append(database); 348 345 } 349 346 } 350 347 } 351 348 352 Vector<RefPtr<DatabaseBackendBase>>::const_iterator openDatabasesEndIt = openDatabases.end(); 353 for (Vector<RefPtr<DatabaseBackendBase>>::const_iterator openDatabasesIt = openDatabases.begin(); openDatabasesIt != openDatabasesEndIt; ++openDatabasesIt) 354 (*openDatabasesIt)->interrupt(); 349 for (auto& openDatabase : openDatabases) 350 openDatabase->interrupt(); 355 351 } 356 352 … … 483 479 } 484 480 485 for ( Vector<String>::iterator iter = temp.begin(); iter != temp.end(); ++iter)486 resultVector.append( iter->isolatedCopy());481 for (auto& databaseName : temp) 482 resultVector.append(databaseName.isolatedCopy()); 487 483 return true; 488 484 } … … 671 667 return; 672 668 673 for ( DatabaseSet::iterator it = databaseSet->begin(); it != databaseSet->end(); ++it)674 databases->add( *it);669 for (auto& database : *databaseSet) 670 databases->add(database); 675 671 } 676 672 … … 725 721 String originPath = this->originPath(origin); 726 722 unsigned long long diskUsage = 0; 727 Vector<String> fileNames = listDirectory(originPath, String("*.db")); 728 Vector<String>::iterator fileName = fileNames.begin(); 729 Vector<String>::iterator lastFileName = fileNames.end(); 730 for (; fileName != lastFileName; ++fileName) { 723 for (auto& fileName : listDirectory(originPath, ASCIILiteral("*.db"))) { 731 724 long long size; 732 getFileSize( *fileName, size);725 getFileSize(fileName, size); 733 726 diskUsage += size; 734 727 } … … 856 849 origins(originsCopy); 857 850 858 for ( unsigned i = 0; i < originsCopy.size(); ++i)859 deleteOrigin(origin sCopy[i].get());851 for (auto& origin : originsCopy) 852 deleteOrigin(origin.get()); 860 853 } 861 854 … … 909 902 910 903 // We drop the lock here because holding locks during a call to deleteDatabaseFile will deadlock. 911 for ( unsigned i = 0; i < databaseNames.size(); ++i) {912 if (!deleteDatabaseFile(origin, databaseNames[i])) {904 for (auto& name : databaseNames) { 905 if (!deleteDatabaseFile(origin, name)) { 913 906 // Even if the file can't be deleted, we want to try and delete the rest, don't return early here. 914 LOG_ERROR("Unable to delete file for database %s in origin %s", databaseNames[i].ascii().data(), origin->databaseIdentifier().ascii().data());907 LOG_ERROR("Unable to delete file for database %s in origin %s", name.ascii().data(), origin->databaseIdentifier().ascii().data()); 915 908 } 916 909 } … … 974 967 m_client->dispatchDidDeleteDatabaseOrigin(); 975 968 #endif 976 for ( unsigned i = 0; i < databaseNames.size(); ++i)977 m_client->dispatchDidModifyDatabase(origin, databaseNames[i]);969 for (auto& name : databaseNames) 970 m_client->dispatchDidModifyDatabase(origin, name); 978 971 } 979 972 } … … 1179 1172 if (databaseSet && databaseSet->size()) { 1180 1173 // We have some database open with this name. Mark them as deleted. 1181 DatabaseSet::const_iterator end = databaseSet->end(); 1182 for (DatabaseSet::const_iterator it = databaseSet->begin(); it != end; ++it) 1183 deletedDatabases.append(*it); 1174 for (auto& database : *databaseSet) 1175 deletedDatabases.append(database); 1184 1176 } 1185 1177 } … … 1187 1179 } 1188 1180 1189 for ( unsigned i = 0; i < deletedDatabases.size(); ++i)1190 d eletedDatabases[i]->markAsDeletedAndClose();1181 for (auto& database : deletedDatabases) 1182 database->markAsDeletedAndClose(); 1191 1183 1192 1184 #if !PLATFORM(IOS) … … 1231 1223 MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); 1232 1224 if (m_openDatabaseMap) { 1233 DatabaseOriginMap::const_iterator originMapEnd = m_openDatabaseMap->end(); 1234 for (DatabaseOriginMap::const_iterator originMapIt = m_openDatabaseMap->begin(); originMapIt != originMapEnd; ++originMapIt) { 1235 RefPtr<SecurityOrigin> origin = originMapIt->key; 1236 DatabaseNameMap* databaseNameMap = originMapIt->value; 1225 for (auto& openDatabase : *m_openDatabaseMap) { 1226 auto& origin = openDatabase.key; 1227 DatabaseNameMap* databaseNameMap = openDatabase.value; 1237 1228 Vector<String> deletedDatabaseNamesForThisOrigin; 1238 1229 1239 1230 // Loop through all opened databases in this origin. Get the current database file path of each database and see if 1240 1231 // it still matches the path stored in the opened database object. 1241 DatabaseNameMap::const_iterator dbNameMapEnd = databaseNameMap->end(); 1242 for (DatabaseNameMap::const_iterator dbNameMapIt = databaseNameMap->begin(); dbNameMapIt != dbNameMapEnd; ++dbNameMapIt) { 1243 String databaseName = dbNameMapIt->key; 1232 for (auto& databases : *databaseNameMap) { 1233 String databaseName = databases.key; 1244 1234 String databaseFileName; 1245 1235 SQLiteStatement statement(m_database, "SELECT path FROM Databases WHERE origin=? AND name=?;"); … … 1253 1243 1254 1244 bool foundDeletedDatabase = false; 1255 DatabaseSet* databaseSet = dbNameMapIt->value; 1256 DatabaseSet::const_iterator dbEnd = databaseSet->end(); 1257 for (DatabaseSet::const_iterator dbIt = databaseSet->begin(); dbIt != dbEnd; ++dbIt) { 1258 Database* db = static_cast<Database*>(*dbIt); 1259 1245 for (auto& db : *databases.value) { 1260 1246 // We are done if this database has already been marked as deleted. 1261 1247 if (db->deleted()) … … 1280 1266 } 1281 1267 1282 for (unsigned i = 0; i < deletedDatabases.size(); ++i) 1283 deletedDatabases[i]->markAsDeletedAndClose(); 1284 1285 DeletedDatabaseMap::const_iterator end = deletedDatabaseMap.end(); 1286 for (DeletedDatabaseMap::const_iterator it = deletedDatabaseMap.begin(); it != end; ++it) { 1287 SecurityOrigin* origin = it->key.get(); 1268 for (auto& deletedDatabase : deletedDatabases) 1269 deletedDatabase->markAsDeletedAndClose(); 1270 1271 for (auto& deletedDatabase : deletedDatabaseMap) { 1272 SecurityOrigin* origin = deletedDatabase.key.get(); 1288 1273 if (m_client) 1289 1274 m_client->dispatchDidModifyOrigin(origin); 1290 1275 1291 const Vector<String>& databaseNames = it->value;1292 for ( unsigned i = 0; i < databaseNames.size(); ++i) {1276 const Vector<String>& databaseNames = deletedDatabase.value; 1277 for (auto& databaseName : databaseNames) { 1293 1278 if (m_client) 1294 m_client->dispatchDidModifyDatabase(origin, databaseName s[i]);1279 m_client->dispatchDidModifyDatabase(origin, databaseName); 1295 1280 } 1296 1281 } … … 1366 1351 // This walking is - sadly - the only reliable way to get at each open database thread. 1367 1352 // This will be cleaner once <rdar://problem/5680441> or some other DB thread consolidation takes place. 1368 DatabaseOriginMap::iterator i = m_openDatabaseMap.get()->begin(); 1369 DatabaseOriginMap::iterator end = m_openDatabaseMap.get()->end(); 1370 1371 for (; i != end; ++i) { 1372 DatabaseNameMap* databaseNameMap = i->value; 1373 DatabaseNameMap::iterator j = databaseNameMap->begin(); 1374 DatabaseNameMap::iterator dbNameMapEnd = databaseNameMap->end(); 1375 for (; j != dbNameMapEnd; ++j) { 1376 DatabaseSet* databaseSet = j->value; 1377 DatabaseSet::iterator k = databaseSet->begin(); 1378 DatabaseSet::iterator dbSetEnd = databaseSet->end(); 1379 for (; k != dbSetEnd; ++k) { 1380 DatabaseContext* context = (*k)->databaseContext(); 1381 context->setPaused(paused); 1382 } 1353 for (auto& databaseNameMap : m_openDatabaseMap->values()) { 1354 for (auto& databaseSet : databaseNameMap->values()) { 1355 for (auto& database : *databaseSet) 1356 database->databaseContext()->setPaused(paused); 1383 1357 } 1384 1358 } -
trunk/Source/WebCore/Modules/webdatabase/SQLTransactionCoordinator.cpp
r178575 r185316 120 120 121 121 // Notify all transactions in progress that the database thread is shutting down 122 for (CoordinationInfoMap::iterator coordinationInfoIterator = m_coordinationInfoMap.begin(); 123 coordinationInfoIterator != m_coordinationInfoMap.end(); ++coordinationInfoIterator) { 124 CoordinationInfo& info = coordinationInfoIterator->value; 125 122 for (auto& info : m_coordinationInfoMap.values()) { 126 123 // Clean up transactions that have reached "lockAcquired": 127 124 // Transaction phase 4 cleanup. See comment on "What happens if a … … 129 126 if (info.activeWriteTransaction) 130 127 info.activeWriteTransaction->notifyDatabaseThreadIsShuttingDown(); 131 for (HashSet<RefPtr<SQLTransactionBackend>>::iterator activeReadTransactionsIterator = 132 info.activeReadTransactions.begin(); 133 activeReadTransactionsIterator != info.activeReadTransactions.end(); 134 ++activeReadTransactionsIterator) { 135 (*activeReadTransactionsIterator)->notifyDatabaseThreadIsShuttingDown(); 136 } 128 for (auto& transaction : info.activeReadTransactions) 129 transaction->notifyDatabaseThreadIsShuttingDown(); 137 130 138 131 // Clean up transactions that have NOT reached "lockAcquired": -
trunk/Source/WebCore/Modules/websockets/WebSocket.cpp
r184709 r185316 261 261 // Here, we throw SYNTAX_ERR if the given protocols do not meet the latter criteria. This behavior does not 262 262 // comply with WebSocket API specification, but it seems to be the only reasonable way to handle this conflict. 263 for ( size_t i = 0; i < protocols.size(); ++i) {264 if (!isValidProtocolString(protocol s[i])) {265 scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, "Wrong protocol for WebSocket '" + encodeProtocolString(protocol s[i]) + "'");263 for (auto& protocol : protocols) { 264 if (!isValidProtocolString(protocol)) { 265 scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, "Wrong protocol for WebSocket '" + encodeProtocolString(protocol) + "'"); 266 266 m_state = CLOSED; 267 267 ec = SYNTAX_ERR; … … 270 270 } 271 271 HashSet<String> visited; 272 for ( size_t i = 0; i < protocols.size(); ++i) {273 if (!visited.add(protocol s[i]).isNewEntry) {274 scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, "WebSocket protocols contain duplicates: '" + encodeProtocolString(protocol s[i]) + "'");272 for (auto& protocol : protocols) { 273 if (!visited.add(protocol).isNewEntry) { 274 scriptExecutionContext()->addConsoleMessage(MessageSource::JS, MessageLevel::Error, "WebSocket protocols contain duplicates: '" + encodeProtocolString(protocol) + "'"); 275 275 m_state = CLOSED; 276 276 ec = SYNTAX_ERR; -
trunk/Source/WebCore/Modules/websockets/WebSocketExtensionDispatcher.cpp
r176009 r185316 51 51 void WebSocketExtensionDispatcher::addProcessor(std::unique_ptr<WebSocketExtensionProcessor> processor) 52 52 { 53 for ( size_t i = 0; i < m_processors.size(); ++i) {54 if ( m_processors[i]->extensionToken() == processor->extensionToken())53 for (auto& extensionProcessor : m_processors) { 54 if (extensionProcessor->extensionToken() == processor->extensionToken()) 55 55 return; 56 56 } … … 82 82 m_acceptedExtensionsBuilder.append(extensionToken); 83 83 // FIXME: Should use ListHashSet to keep the order of the parameters. 84 for ( HashMap<String, String>::const_iterator iterator = extensionParameters.begin(); iterator != extensionParameters.end(); ++iterator) {84 for (auto& parameter : extensionParameters) { 85 85 m_acceptedExtensionsBuilder.appendLiteral("; "); 86 m_acceptedExtensionsBuilder.append( iterator->key);87 if (! iterator->value.isNull()) {86 m_acceptedExtensionsBuilder.append(parameter.key); 87 if (!parameter.value.isNull()) { 88 88 m_acceptedExtensionsBuilder.append('='); 89 m_acceptedExtensionsBuilder.append( iterator->value);89 m_acceptedExtensionsBuilder.append(parameter.value); 90 90 } 91 91 } … … 119 119 } 120 120 121 size_t index; 122 for (index = 0; index < m_processors.size(); ++index) { 123 WebSocketExtensionProcessor* processor = m_processors[index].get(); 121 size_t index = 0; 122 for (auto& processor : m_processors) { 124 123 if (extensionToken == processor->extensionToken()) { 125 124 if (processor->processResponse(extensionParameters)) { … … 130 129 return false; 131 130 } 131 ++index; 132 132 } 133 133 // There is no extension which can process the response. -
trunk/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
r183901 r185316 225 225 // the fields. 226 226 227 for ( size_t i = 0; i < fields.size(); i++) {228 builder.append(field s[i]);227 for (auto& field : fields) { 228 builder.append(field); 229 229 builder.appendLiteral("\r\n"); 230 230 }
Note: See TracChangeset
for help on using the changeset viewer.