| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
| 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
| 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 void CachedResource::checkNotify() | 342 void CachedResource::checkNotify() |
| 343 { | 343 { |
| 344 if (isLoading()) | 344 if (isLoading()) |
| 345 return; | 345 return; |
| 346 | 346 |
| 347 CachedResourceClientWalker<CachedResourceClient> w(m_clients); | 347 CachedResourceClientWalker<CachedResourceClient> w(m_clients); |
| 348 while (CachedResourceClient* c = w.next()) | 348 while (CachedResourceClient* c = w.next()) |
| 349 c->notifyFinished(this); | 349 c->notifyFinished(this); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void CachedResource::data(PassRefPtr<ResourceBuffer>, bool allDataReceived) | 352 void CachedResource::data(PassRefPtr<ResourceBuffer> data) |
| 353 { | 353 { |
| 354 if (!allDataReceived) | 354 m_data = data; |
| 355 return; | 355 setEncodedSize(m_data ? m_data->size() : 0); |
| 356 | |
| 357 setLoading(false); | |
| 358 checkNotify(); | |
| 359 } | 356 } |
| 360 | 357 |
| 361 void CachedResource::error(CachedResource::Status status) | 358 void CachedResource::error(CachedResource::Status status) |
| 362 { | 359 { |
| 363 setStatus(status); | 360 setStatus(status); |
| 364 ASSERT(errorOccurred()); | 361 ASSERT(errorOccurred()); |
| 365 m_data.clear(); | 362 m_data.clear(); |
| 366 | 363 |
| 367 setLoading(false); | 364 setLoading(false); |
| 368 checkNotify(); | 365 checkNotify(); |
| 369 } | 366 } |
| 370 | 367 |
| 368 void CachedResource::finishOnePart() |
| 369 { |
| 370 setLoading(false); |
| 371 checkNotify(); |
| 372 } |
| 373 |
| 371 void CachedResource::finish() | 374 void CachedResource::finish() |
| 372 { | 375 { |
| 376 finishOnePart(); |
| 373 if (!errorOccurred()) | 377 if (!errorOccurred()) |
| 374 m_status = Cached; | 378 m_status = Cached; |
| 375 } | 379 } |
| 376 | 380 |
| 377 bool CachedResource::passesAccessControlCheck(SecurityOrigin* securityOrigin) | 381 bool CachedResource::passesAccessControlCheck(SecurityOrigin* securityOrigin) |
| 378 { | 382 { |
| 379 String errorDescription; | 383 String errorDescription; |
| 380 return WebCore::passesAccessControlCheck(m_response, resourceRequest().allow
Cookies() ? AllowStoredCredentials : DoNotAllowStoredCredentials, securityOrigin
, errorDescription); | 384 return WebCore::passesAccessControlCheck(m_response, resourceRequest().allow
Cookies() ? AllowStoredCredentials : DoNotAllowStoredCredentials, securityOrigin
, errorDescription); |
| 381 } | 385 } |
| 382 | 386 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 return m_cachedMetadata.get(); | 463 return m_cachedMetadata.get(); |
| 460 } | 464 } |
| 461 | 465 |
| 462 void CachedResource::stopLoading() | 466 void CachedResource::stopLoading() |
| 463 { | 467 { |
| 464 ASSERT(m_loader); | 468 ASSERT(m_loader); |
| 465 m_loader = 0; | 469 m_loader = 0; |
| 466 | 470 |
| 467 CachedResourceHandle<CachedResource> protect(this); | 471 CachedResourceHandle<CachedResource> protect(this); |
| 468 | 472 |
| 469 // All loads finish with data(allDataReceived = true) or error(), except for | 473 // All loads finish with finish() or error(), except for |
| 470 // canceled loads, which silently set our request to 0. Be sure to notify ou
r | 474 // canceled loads, which silently set our request to 0. Be sure to notify ou
r |
| 471 // client in that case, so we don't seem to continue loading forever. | 475 // client in that case, so we don't seem to continue loading forever. |
| 472 if (isLoading()) { | 476 if (isLoading()) { |
| 473 setLoading(false); | 477 setLoading(false); |
| 474 setStatus(LoadError); | 478 setStatus(LoadError); |
| 475 checkNotify(); | 479 checkNotify(); |
| 476 } | 480 } |
| 477 } | 481 } |
| 478 | 482 |
| 479 void CachedResource::addClient(CachedResourceClient* client) | 483 void CachedResource::addClient(CachedResourceClient* client) |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 info.addMember(m_proxyResource, "proxyResource"); | 936 info.addMember(m_proxyResource, "proxyResource"); |
| 933 info.addMember(m_handlesToRevalidate, "handlesToRevalidate"); | 937 info.addMember(m_handlesToRevalidate, "handlesToRevalidate"); |
| 934 info.addMember(m_options, "options"); | 938 info.addMember(m_options, "options"); |
| 935 info.addMember(m_decodedDataDeletionTimer, "decodedDataDeletionTimer"); | 939 info.addMember(m_decodedDataDeletionTimer, "decodedDataDeletionTimer"); |
| 936 info.ignoreMember(m_clientsAwaitingCallback); | 940 info.ignoreMember(m_clientsAwaitingCallback); |
| 937 | 941 |
| 938 if (m_purgeableData && !m_purgeableData->wasPurged()) | 942 if (m_purgeableData && !m_purgeableData->wasPurged()) |
| 939 info.addRawBuffer(m_purgeableData.get(), m_purgeableData->size(), "Purge
ableData", "purgeableData"); | 943 info.addRawBuffer(m_purgeableData.get(), m_purgeableData->size(), "Purge
ableData", "purgeableData"); |
| 940 } | 944 } |
| 941 } | 945 } |
| OLD | NEW |