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

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

Issue 9283038: Merge 105226 - Ensure we don't cancel revalidation of a CachedResource (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 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
« no previous file with comments | « Source/WebCore/loader/SubresourceLoader.h ('k') | Source/WebCore/loader/cache/CachedResource.h » ('j') | 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;
160 memoryCache()->revalidationSucceeded(m_resource, response); 159 memoryCache()->revalidationSucceeded(m_resource, response);
161 if (!reachedTerminalState()) { 160 if (!reachedTerminalState())
162 ResourceLoader::didReceiveResponse(response); 161 ResourceLoader::didReceiveResponse(response);
163 didFinishLoading(monotonicallyIncreasingTime());
164 }
165 return; 162 return;
166 } 163 }
167 // Did not get 304 response, continue as a regular resource load. 164 // Did not get 304 response, continue as a regular resource load.
168 memoryCache()->revalidationFailed(m_resource); 165 memoryCache()->revalidationFailed(m_resource);
169 } 166 }
170 167
171 m_resource->setResponse(response); 168 m_resource->setResponse(response);
172 if (reachedTerminalState()) 169 if (reachedTerminalState())
173 return; 170 return;
174 ResourceLoader::didReceiveResponse(response); 171 ResourceLoader::didReceiveResponse(response);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 234 }
238 235
239 void SubresourceLoader::didReceiveCachedMetadata(const char* data, int length) 236 void SubresourceLoader::didReceiveCachedMetadata(const char* data, int length)
240 { 237 {
241 ASSERT(!m_resource->resourceToRevalidate()); 238 ASSERT(!m_resource->resourceToRevalidate());
242 m_resource->setSerializedCachedMetadata(data, length); 239 m_resource->setSerializedCachedMetadata(data, length);
243 } 240 }
244 241
245 void SubresourceLoader::didFinishLoading(double finishTime) 242 void SubresourceLoader::didFinishLoading(double finishTime)
246 { 243 {
247 if (m_state != Initialized && m_state != Revalidating) 244 if (m_state != Initialized)
248 return; 245 return;
249 ASSERT(!reachedTerminalState()); 246 ASSERT(!reachedTerminalState());
250 ASSERT(!m_resource->resourceToRevalidate()); 247 ASSERT(!m_resource->resourceToRevalidate());
251 ASSERT(!m_resource->errorOccurred()); 248 ASSERT(!m_resource->errorOccurred());
252 LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().d ata()); 249 LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().d ata());
253 250
254 RefPtr<SubresourceLoader> protect(this); 251 RefPtr<SubresourceLoader> protect(this);
255 CachedResourceHandle<CachedResource> protectResource(m_resource); 252 CachedResourceHandle<CachedResource> protectResource(m_resource);
256 m_state = Finishing; 253 m_state = Finishing;
257 m_resource->setLoadFinishTime(finishTime); 254 m_resource->setLoadFinishTime(finishTime);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 if (reachedTerminalState()) 299 if (reachedTerminalState())
303 return; 300 return;
304 m_resource->stopLoading(); 301 m_resource->stopLoading();
305 m_documentLoader->removeSubresourceLoader(this); 302 m_documentLoader->removeSubresourceLoader(this);
306 } 303 }
307 m_document = 0; 304 m_document = 0;
308 ResourceLoader::releaseResources(); 305 ResourceLoader::releaseResources();
309 } 306 }
310 307
311 } 308 }
OLDNEW
« no previous file with comments | « Source/WebCore/loader/SubresourceLoader.h ('k') | Source/WebCore/loader/cache/CachedResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698