| 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 | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 7 rights reserved. | 7 rights reserved. |
| 8 | 8 |
| 9 This library is free software; you can redistribute it and/or | 9 This library is free software; you can redistribute it and/or |
| 10 modify it under the terms of the GNU Library General Public | 10 modify it under the terms of the GNU Library General Public |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 void Resource::didAddClient(ResourceClient* c) { | 638 void Resource::didAddClient(ResourceClient* c) { |
| 639 if (isLoaded()) { | 639 if (isLoaded()) { |
| 640 c->notifyFinished(this); | 640 c->notifyFinished(this); |
| 641 if (m_clients.contains(c)) { | 641 if (m_clients.contains(c)) { |
| 642 m_finishedClients.add(c); | 642 m_finishedClients.add(c); |
| 643 m_clients.remove(c); | 643 m_clients.remove(c); |
| 644 } | 644 } |
| 645 } | 645 } |
| 646 } | 646 } |
| 647 | 647 |
| 648 static bool typeNeedsSynchronousCacheHit(Resource::Type type) { | 648 static bool shouldSendCachedDataSynchronouslyForType(Resource::Type type) { |
| 649 // Some resources types default to return data synchronously. For most of | 649 // Some resources types default to return data synchronously. For most of |
| 650 // these, it's because there are layout tests that expect data to return | 650 // these, it's because there are layout tests that expect data to return |
| 651 // synchronously in case of cache hit. In the case of fonts, there was a | 651 // synchronously in case of cache hit. In the case of fonts, there was a |
| 652 // performance regression. | 652 // performance regression. |
| 653 // FIXME: Get to the point where we don't need to special-case sync/async | 653 // FIXME: Get to the point where we don't need to special-case sync/async |
| 654 // behavior for different resource types. | 654 // behavior for different resource types. |
| 655 if (type == Resource::Image) | 655 if (type == Resource::Image) |
| 656 return true; | 656 return true; |
| 657 if (type == Resource::CSSStyleSheet) | 657 if (type == Resource::CSSStyleSheet) |
| 658 return true; | 658 return true; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 688 | 688 |
| 689 void Resource::addClient(ResourceClient* client, | 689 void Resource::addClient(ResourceClient* client, |
| 690 PreloadReferencePolicy policy) { | 690 PreloadReferencePolicy policy) { |
| 691 willAddClientOrObserver(policy); | 691 willAddClientOrObserver(policy); |
| 692 | 692 |
| 693 if (m_isRevalidating) { | 693 if (m_isRevalidating) { |
| 694 m_clients.add(client); | 694 m_clients.add(client); |
| 695 return; | 695 return; |
| 696 } | 696 } |
| 697 | 697 |
| 698 // If an error has occurred or we have existing data to send to the new client | 698 // If we have existing data to send to the new client and the resource type |
| 699 // and the resource type supprts it, send it asynchronously. | 699 // supprts it, send it asynchronously. |
| 700 if ((errorOccurred() || !m_response.isNull()) && | 700 if (!m_response.isNull() && |
| 701 !typeNeedsSynchronousCacheHit(getType()) && !m_needsSynchronousCacheHit) { | 701 !shouldSendCachedDataSynchronouslyForType(getType()) && |
| 702 !m_needsSynchronousCacheHit) { |
| 702 m_clientsAwaitingCallback.add(client); | 703 m_clientsAwaitingCallback.add(client); |
| 703 ResourceCallback::callbackHandler().schedule(this); | 704 ResourceCallback::callbackHandler().schedule(this); |
| 704 return; | 705 return; |
| 705 } | 706 } |
| 706 | 707 |
| 707 m_clients.add(client); | 708 m_clients.add(client); |
| 708 didAddClient(client); | 709 didAddClient(client); |
| 709 return; | 710 return; |
| 710 } | 711 } |
| 711 | 712 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 case Resource::TextTrack: | 1075 case Resource::TextTrack: |
| 1075 case Resource::Media: | 1076 case Resource::Media: |
| 1076 case Resource::Manifest: | 1077 case Resource::Manifest: |
| 1077 return false; | 1078 return false; |
| 1078 } | 1079 } |
| 1079 NOTREACHED(); | 1080 NOTREACHED(); |
| 1080 return false; | 1081 return false; |
| 1081 } | 1082 } |
| 1082 | 1083 |
| 1083 } // namespace blink | 1084 } // namespace blink |
| OLD | NEW |