| OLD | NEW |
| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 m_resource->setSerializedCachedMetadata(data, length); | 274 m_resource->setSerializedCachedMetadata(data, length); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void SubresourceLoader::didFinishLoading(double finishTime) | 277 void SubresourceLoader::didFinishLoading(double finishTime) |
| 278 { | 278 { |
| 279 if (m_state != Initialized) | 279 if (m_state != Initialized) |
| 280 return; | 280 return; |
| 281 ASSERT(!reachedTerminalState()); | 281 ASSERT(!reachedTerminalState()); |
| 282 ASSERT(!m_resource->resourceToRevalidate()); | 282 ASSERT(!m_resource->resourceToRevalidate()); |
| 283 ASSERT(!m_resource->errorOccurred()); | 283 ASSERT(!m_resource->errorOccurred()); |
| 284 LOG(ResourceLoading, "Received '%s'.", m_resource->url().string().latin1().d
ata()); | 284 LOG_INFO(ResourceLoading, "Received '%s'.", m_resource->url().string().latin
1().data()); |
| 285 | 285 |
| 286 RefPtr<SubresourceLoader> protect(this); | 286 RefPtr<SubresourceLoader> protect(this); |
| 287 CachedResourceHandle<CachedResource> protectResource(m_resource); | 287 CachedResourceHandle<CachedResource> protectResource(m_resource); |
| 288 m_state = Finishing; | 288 m_state = Finishing; |
| 289 m_resource->setLoadFinishTime(finishTime); | 289 m_resource->setLoadFinishTime(finishTime); |
| 290 m_resource->data(resourceData(), true); | 290 m_resource->data(resourceData(), true); |
| 291 m_resource->finish(); | 291 m_resource->finish(); |
| 292 ResourceLoader::didFinishLoading(finishTime); | 292 ResourceLoader::didFinishLoading(finishTime); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void SubresourceLoader::didFail(const ResourceError& error) | 295 void SubresourceLoader::didFail(const ResourceError& error) |
| 296 { | 296 { |
| 297 if (m_state != Initialized) | 297 if (m_state != Initialized) |
| 298 return; | 298 return; |
| 299 ASSERT(!reachedTerminalState()); | 299 ASSERT(!reachedTerminalState()); |
| 300 LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string().la
tin1().data()); | 300 LOG_INFO(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string
().latin1().data()); |
| 301 | 301 |
| 302 RefPtr<SubresourceLoader> protect(this); | 302 RefPtr<SubresourceLoader> protect(this); |
| 303 CachedResourceHandle<CachedResource> protectResource(m_resource); | 303 CachedResourceHandle<CachedResource> protectResource(m_resource); |
| 304 m_state = Finishing; | 304 m_state = Finishing; |
| 305 if (m_resource->resourceToRevalidate()) | 305 if (m_resource->resourceToRevalidate()) |
| 306 memoryCache()->revalidationFailed(m_resource); | 306 memoryCache()->revalidationFailed(m_resource); |
| 307 m_resource->setResourceError(error); | 307 m_resource->setResourceError(error); |
| 308 m_resource->error(CachedResource::LoadError); | 308 m_resource->error(CachedResource::LoadError); |
| 309 if (!m_resource->isPreloaded()) | 309 if (!m_resource->isPreloaded()) |
| 310 memoryCache()->remove(m_resource); | 310 memoryCache()->remove(m_resource); |
| 311 ResourceLoader::didFail(error); | 311 ResourceLoader::didFail(error); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void SubresourceLoader::willCancel(const ResourceError& error) | 314 void SubresourceLoader::willCancel(const ResourceError& error) |
| 315 { | 315 { |
| 316 if (m_state != Initialized) | 316 if (m_state != Initialized) |
| 317 return; | 317 return; |
| 318 ASSERT(!reachedTerminalState()); | 318 ASSERT(!reachedTerminalState()); |
| 319 LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().string()
.latin1().data()); | 319 LOG_INFO(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().str
ing().latin1().data()); |
| 320 | 320 |
| 321 RefPtr<SubresourceLoader> protect(this); | 321 RefPtr<SubresourceLoader> protect(this); |
| 322 m_state = Finishing; | 322 m_state = Finishing; |
| 323 if (m_resource->resourceToRevalidate()) | 323 if (m_resource->resourceToRevalidate()) |
| 324 memoryCache()->revalidationFailed(m_resource); | 324 memoryCache()->revalidationFailed(m_resource); |
| 325 m_resource->setResourceError(error); | 325 m_resource->setResourceError(error); |
| 326 memoryCache()->remove(m_resource); | 326 memoryCache()->remove(m_resource); |
| 327 } | 327 } |
| 328 | 328 |
| 329 void SubresourceLoader::releaseResources() | 329 void SubresourceLoader::releaseResources() |
| 330 { | 330 { |
| 331 ASSERT(!reachedTerminalState()); | 331 ASSERT(!reachedTerminalState()); |
| 332 if (m_state != Uninitialized) { | 332 if (m_state != Uninitialized) { |
| 333 m_requestCountTracker.clear(); | 333 m_requestCountTracker.clear(); |
| 334 m_documentLoader->cachedResourceLoader()->loadDone(m_resource); | 334 m_documentLoader->cachedResourceLoader()->loadDone(m_resource); |
| 335 if (reachedTerminalState()) | 335 if (reachedTerminalState()) |
| 336 return; | 336 return; |
| 337 m_resource->stopLoading(); | 337 m_resource->stopLoading(); |
| 338 m_documentLoader->removeSubresourceLoader(this); | 338 m_documentLoader->removeSubresourceLoader(this); |
| 339 } | 339 } |
| 340 ResourceLoader::releaseResources(); | 340 ResourceLoader::releaseResources(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 } | 343 } |
| OLD | NEW |