Changeset 32871 in webkit
- Timestamp:
- May 5, 2008 9:09:00 AM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r32868 r32871 1 2008-05-05 Antti Koivisto <antti@apple.com> 2 3 Reviewed by Darin. 4 5 Speculative fix for <rdar://problem/5906790> 6 Crash in Loader::servePendingRequests() due to hash table being modified during iteration 7 8 I don't know how to reproduce this. It would require the load to fail (or succeed) 9 synchronously, something that should not usually happen. 10 11 * loader/loader.cpp: 12 (WebCore::Loader::Loader): 13 (WebCore::Loader::load): 14 (WebCore::Loader::servePendingRequests): 15 (WebCore::Loader::cancelRequests): 16 (WebCore::Loader::Host::Host): 17 * loader/loader.h: 18 (WebCore::Loader::Host::name): 19 1 20 2008-05-05 Ariya Hidayat <ariya.hidayat@trolltech.com> 2 21 -
trunk/WebCore/loader/loader.cpp
r31926 r32871 59 59 60 60 Loader::Loader() 61 : m_nonHTTPProtocolHost( maxRequestsInFlightForNonHTTPProtocols)61 : m_nonHTTPProtocolHost("non-http-protocol-host", maxRequestsInFlightForNonHTTPProtocols) 62 62 , m_requestTimer(this, &Loader::requestTimerFired) 63 63 { … … 103 103 bool isHTTP = url.protocolIs("http") || url.protocolIs("https"); 104 104 if (isHTTP) { 105 String hostName = url.host();106 host = m_hosts.get(hostName );105 AtomicString hostName = url.host(); 106 host = m_hosts.get(hostName.impl()); 107 107 if (!host) { 108 host = new Host( maxRequestsInFlightPerHost);109 m_hosts.add(hostName , host);108 host = new Host(hostName, maxRequestsInFlightPerHost); 109 m_hosts.add(hostName.impl(), host); 110 110 } 111 111 } else … … 142 142 m_nonHTTPProtocolHost.servePendingRequests(minimumPriority); 143 143 144 HostMap::iterator end = m_hosts.end();145 Vector<String> toRemove;146 for ( HostMap::iterator it = m_hosts.begin(); it != end; ++it) {147 Host* host = it->second;144 Vector<Host*> hostsToServe; 145 copyValuesToVector(m_hosts, hostsToServe); 146 for (unsigned n = 0; n < hostsToServe.size(); ++n) { 147 Host* host = hostsToServe[n]; 148 148 if (host->hasRequests()) 149 149 host->servePendingRequests(minimumPriority); 150 else 151 toRemove.append(it->first); 152 } 153 for (unsigned n = 0; n < toRemove.size(); ++n) { 154 HostMap::iterator it = m_hosts.find(toRemove[n]); 155 delete it->second; 156 m_hosts.remove(it); 150 else { 151 AtomicString name = host->name(); 152 delete host; 153 m_hosts.remove(name.impl()); 154 } 157 155 } 158 156 } … … 163 161 m_nonHTTPProtocolHost.cancelRequests(docLoader); 164 162 165 HostMap::iterator end = m_hosts.end(); 166 for (HostMap::iterator it = m_hosts.begin(); it != end; ++it) { 167 Host* host = it->second; 163 Vector<Host*> hostsToCancel; 164 copyValuesToVector(m_hosts, hostsToCancel); 165 for (unsigned n = 0; n < hostsToCancel.size(); ++n) { 166 Host* host = hostsToCancel[n]; 168 167 if (host->hasRequests()) 169 168 host->cancelRequests(docLoader); … … 178 177 } 179 178 180 Loader::Host::Host(unsigned maxRequestsInFlight) 181 : m_maxRequestsInFlight(maxRequestsInFlight) 179 Loader::Host::Host(const AtomicString& name, unsigned maxRequestsInFlight) 180 : m_name(name) 181 , m_maxRequestsInFlight(maxRequestsInFlight) 182 182 { 183 183 } -
trunk/WebCore/loader/loader.h
r31038 r32871 23 23 #define loader_h 24 24 25 #include "AtomicString.h" 26 #include "AtomicStringImpl.h" 25 27 #include "PlatformString.h" 26 #include "StringHash.h"27 28 #include "SubresourceLoaderClient.h" 28 29 #include "Timer.h" … … 57 58 class Host : private SubresourceLoaderClient { 58 59 public: 59 Host( unsigned maxRequestsInFlight);60 Host(const AtomicString& name, unsigned maxRequestsInFlight); 60 61 ~Host(); 61 62 63 const AtomicString& name() const { return m_name; } 62 64 void addRequest(Request*, Priority); 63 65 void servePendingRequests(Priority minimumPriority = Low); … … 79 81 typedef HashMap<RefPtr<SubresourceLoader>, Request*> RequestMap; 80 82 RequestMap m_requestsLoading; 83 const AtomicString m_name; 81 84 const int m_maxRequestsInFlight; 82 85 }; 83 typedef HashMap< String, Host*> HostMap;86 typedef HashMap<AtomicStringImpl*, Host*> HostMap; 84 87 HostMap m_hosts; 85 88 Host m_nonHTTPProtocolHost;
Note: See TracChangeset
for help on using the changeset viewer.