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

Side by Side Diff: Source/WebCore/loader/SubresourceLoader.cpp

Issue 8920011: Merge 102602 - Source/WebCore: A SubresourceLoader in the middle of revalidating (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 9 years 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
« no previous file with comments | « Source/WebCore/loader/SubresourceLoader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 ASSERT(!response.isNull()); 149 ASSERT(!response.isNull());
150 150
151 // Reference the object in this method since the additional processing can d o 151 // Reference the object in this method since the additional processing can d o
152 // anything including removing the last reference to this object; one exampl e of this is 3266216. 152 // anything including removing the last reference to this object; one exampl e of this is 3266216.
153 RefPtr<SubresourceLoader> protect(this); 153 RefPtr<SubresourceLoader> protect(this);
154 154
155 if (m_resource->resourceToRevalidate()) { 155 if (m_resource->resourceToRevalidate()) {
156 if (response.httpStatusCode() == 304) { 156 if (response.httpStatusCode() == 304) {
157 // 304 Not modified / Use local copy 157 // 304 Not modified / Use local copy
158 // Existing resource is ok, just use it updating the expiration time . 158 // Existing resource is ok, just use it updating the expiration time .
159 m_state = Revalidating;
159 memoryCache()->revalidationSucceeded(m_resource, response); 160 memoryCache()->revalidationSucceeded(m_resource, response);
160 ResourceLoader::didReceiveResponse(response); 161 if (!reachedTerminalState()) {
162 ResourceLoader::didReceiveResponse(response);
163 didFinishLoading(currentTime());
164 }
161 return; 165 return;
162 } 166 }
163 // Did not get 304 response, continue as a regular resource load. 167 // Did not get 304 response, continue as a regular resource load.
164 memoryCache()->revalidationFailed(m_resource); 168 memoryCache()->revalidationFailed(m_resource);
165 } 169 }
166 170
167 m_resource->setResponse(response); 171 m_resource->setResponse(response);
168 if (reachedTerminalState()) 172 if (reachedTerminalState())
169 return; 173 return;
170 ResourceLoader::didReceiveResponse(response); 174 ResourceLoader::didReceiveResponse(response);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 237 }
234 238
235 void SubresourceLoader::didReceiveCachedMetadata(const char* data, int length) 239 void SubresourceLoader::didReceiveCachedMetadata(const char* data, int length)
236 { 240 {
237 ASSERT(!m_resource->resourceToRevalidate()); 241 ASSERT(!m_resource->resourceToRevalidate());
238 m_resource->setSerializedCachedMetadata(data, length); 242 m_resource->setSerializedCachedMetadata(data, length);
239 } 243 }
240 244
241 void SubresourceLoader::didFinishLoading(double finishTime) 245 void SubresourceLoader::didFinishLoading(double finishTime)
242 { 246 {
243 if (m_state != Initialized) 247 if (m_state != Initialized && m_state != Revalidating)
244 return; 248 return;
245 ASSERT(!reachedTerminalState()); 249 ASSERT(!reachedTerminalState());
246 ASSERT(!m_resource->resourceToRevalidate()); 250 ASSERT(!m_resource->resourceToRevalidate());
247 ASSERT(!m_resource->errorOccurred()); 251 ASSERT(!m_resource->errorOccurred());
248 LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().d ata()); 252 LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().d ata());
249 253
250 RefPtr<SubresourceLoader> protect(this); 254 RefPtr<SubresourceLoader> protect(this);
251 CachedResourceHandle<CachedResource> protectResource(m_resource); 255 CachedResourceHandle<CachedResource> protectResource(m_resource);
252 m_state = Finishing; 256 m_state = Finishing;
253 m_resource->setLoadFinishTime(finishTime); 257 m_resource->setLoadFinishTime(finishTime);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 if (reachedTerminalState()) 302 if (reachedTerminalState())
299 return; 303 return;
300 m_resource->stopLoading(); 304 m_resource->stopLoading();
301 m_documentLoader->removeSubresourceLoader(this); 305 m_documentLoader->removeSubresourceLoader(this);
302 } 306 }
303 m_document = 0; 307 m_document = 0;
304 ResourceLoader::releaseResources(); 308 ResourceLoader::releaseResources();
305 } 309 }
306 310
307 } 311 }
OLDNEW
« no previous file with comments | « Source/WebCore/loader/SubresourceLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698