Chromium Code Reviews| 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 m_error = error; | 418 m_error = error; |
| 419 if (!m_revalidatingRequest.isNull()) | 419 if (!m_revalidatingRequest.isNull()) |
| 420 m_revalidatingRequest = ResourceRequest(); | 420 m_revalidatingRequest = ResourceRequest(); |
| 421 | 421 |
| 422 if (m_error.isCancellation() || !isPreloaded()) | 422 if (m_error.isCancellation() || !isPreloaded()) |
| 423 memoryCache()->remove(this); | 423 memoryCache()->remove(this); |
| 424 | 424 |
| 425 setStatus(LoadError); | 425 setStatus(LoadError); |
| 426 ASSERT(errorOccurred()); | 426 ASSERT(errorOccurred()); |
| 427 m_data.clear(); | 427 m_data.clear(); |
| 428 m_loader = nullptr; | |
| 428 checkNotify(); | 429 checkNotify(); |
| 429 markClientsAndObserversFinished(); | 430 markClientsAndObserversFinished(); |
| 430 } | 431 } |
| 431 | 432 |
| 432 void Resource::finish(double loadFinishTime) | 433 void Resource::finish(double loadFinishTime) |
| 433 { | 434 { |
| 434 ASSERT(m_revalidatingRequest.isNull()); | 435 ASSERT(m_revalidatingRequest.isNull()); |
| 435 m_loadFinishTime = loadFinishTime; | 436 m_loadFinishTime = loadFinishTime; |
| 436 if (!errorOccurred()) | 437 if (!errorOccurred()) |
| 437 m_status = Cached; | 438 m_status = Cached; |
| 439 m_loader = nullptr; | |
| 438 checkNotify(); | 440 checkNotify(); |
| 439 markClientsAndObserversFinished(); | 441 markClientsAndObserversFinished(); |
| 440 } | 442 } |
| 441 | 443 |
| 442 AtomicString Resource::httpContentType() const | 444 AtomicString Resource::httpContentType() const |
| 443 { | 445 { |
| 444 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Co ntent_Type).lower()); | 446 return extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPNames::Co ntent_Type).lower()); |
| 445 } | 447 } |
| 446 | 448 |
| 447 bool Resource::passesAccessControlCheck(SecurityOrigin* securityOrigin) const | 449 bool Resource::passesAccessControlCheck(SecurityOrigin* securityOrigin) const |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 644 builder.append(")"); | 646 builder.append(")"); |
| 645 } | 647 } |
| 646 if (memoryCache()->contains(this)) { | 648 if (memoryCache()->contains(this)) { |
| 647 if (!builder.isEmpty()) | 649 if (!builder.isEmpty()) |
| 648 builder.append(' '); | 650 builder.append(' '); |
| 649 builder.append("in_memory_cache"); | 651 builder.append("in_memory_cache"); |
| 650 } | 652 } |
| 651 return builder.toString(); | 653 return builder.toString(); |
| 652 } | 654 } |
| 653 | 655 |
| 654 void Resource::clearLoader() | |
| 655 { | |
| 656 m_loader = nullptr; | |
| 657 } | |
| 658 | |
| 659 void Resource::didAddClient(ResourceClient* c) | 656 void Resource::didAddClient(ResourceClient* c) |
| 660 { | 657 { |
| 661 if (isLoaded()) { | 658 if (isLoaded()) { |
| 662 c->notifyFinished(this); | 659 c->notifyFinished(this); |
| 663 if (m_clients.contains(c)) { | 660 if (m_clients.contains(c)) { |
| 664 m_finishedClients.add(c); | 661 m_finishedClients.add(c); |
| 665 m_clients.remove(c); | 662 m_clients.remove(c); |
| 666 } | 663 } |
| 667 } | 664 } |
| 668 } | 665 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 767 cancelTimerFired(&m_cancelTimer); | 764 cancelTimerFired(&m_cancelTimer); |
| 768 else if (!m_cancelTimer.isActive()) | 765 else if (!m_cancelTimer.isActive()) |
| 769 m_cancelTimer.startOneShot(0, BLINK_FROM_HERE); | 766 m_cancelTimer.startOneShot(0, BLINK_FROM_HERE); |
| 770 | 767 |
| 771 unlock(); | 768 unlock(); |
| 772 } | 769 } |
| 773 | 770 |
| 774 void Resource::cancelTimerFired(Timer<Resource>* timer) | 771 void Resource::cancelTimerFired(Timer<Resource>* timer) |
| 775 { | 772 { |
| 776 ASSERT_UNUSED(timer, timer == &m_cancelTimer); | 773 ASSERT_UNUSED(timer, timer == &m_cancelTimer); |
| 777 if (hasClientsOrObservers() || !m_loader) | 774 if (!hasClientsOrObservers() && m_loader) |
| 778 return; | 775 m_loader->cancel(); |
| 779 m_loader->cancelIfNotFinishing(); | |
| 780 memoryCache()->remove(this); | |
|
hiroshige
2016/05/11 09:28:38
Could you mention in the CL description that this
Nate Chapin
2016/05/11 18:49:53
Done.
| |
| 781 } | 776 } |
| 782 | 777 |
| 783 void Resource::setDecodedSize(size_t decodedSize) | 778 void Resource::setDecodedSize(size_t decodedSize) |
| 784 { | 779 { |
| 785 if (decodedSize == m_decodedSize) | 780 if (decodedSize == m_decodedSize) |
| 786 return; | 781 return; |
| 787 size_t oldSize = size(); | 782 size_t oldSize = size(); |
| 788 m_decodedSize = decodedSize; | 783 m_decodedSize = decodedSize; |
| 789 memoryCache()->update(this, oldSize, size()); | 784 memoryCache()->update(this, oldSize, size()); |
| 790 memoryCache()->updateDecodedResource(this, UpdateForPropertyChange); | 785 memoryCache()->updateDecodedResource(this, UpdateForPropertyChange); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1135 case Resource::Media: | 1130 case Resource::Media: |
| 1136 return "Media"; | 1131 return "Media"; |
| 1137 case Resource::Manifest: | 1132 case Resource::Manifest: |
| 1138 return "Manifest"; | 1133 return "Manifest"; |
| 1139 } | 1134 } |
| 1140 ASSERT_NOT_REACHED(); | 1135 ASSERT_NOT_REACHED(); |
| 1141 return "Unknown"; | 1136 return "Unknown"; |
| 1142 } | 1137 } |
| 1143 | 1138 |
| 1144 } // namespace blink | 1139 } // namespace blink |
| OLD | NEW |