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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 { | 631 { |
632 if (isLoaded()) { | 632 if (isLoaded()) { |
633 c->notifyFinished(this); | 633 c->notifyFinished(this); |
634 if (m_clients.contains(c)) { | 634 if (m_clients.contains(c)) { |
635 m_finishedClients.add(c); | 635 m_finishedClients.add(c); |
636 m_clients.remove(c); | 636 m_clients.remove(c); |
637 } | 637 } |
638 } | 638 } |
639 } | 639 } |
640 | 640 |
641 static bool shouldSendCachedDataSynchronouslyForType(Resource::Type type) | 641 static bool typeNeedsSynchronousCacheHit(Resource::Type type) |
642 { | 642 { |
643 // Some resources types default to return data synchronously. | 643 // Some resources types default to return data synchronously. |
644 // For most of these, it's because there are layout tests that | 644 // For most of these, it's because there are layout tests that |
645 // expect data to return synchronously in case of cache hit. In | 645 // expect data to return synchronously in case of cache hit. In |
646 // the case of fonts, there was a performance regression. | 646 // the case of fonts, there was a performance regression. |
647 // FIXME: Get to the point where we don't need to special-case sync/async | 647 // FIXME: Get to the point where we don't need to special-case sync/async |
648 // behavior for different resource types. | 648 // behavior for different resource types. |
649 if (type == Resource::Image) | 649 if (type == Resource::Image) |
650 return true; | 650 return true; |
651 if (type == Resource::CSSStyleSheet) | 651 if (type == Resource::CSSStyleSheet) |
(...skipping 29 matching lines...) Expand all Loading... |
681 | 681 |
682 void Resource::addClient(ResourceClient* client, PreloadReferencePolicy policy) | 682 void Resource::addClient(ResourceClient* client, PreloadReferencePolicy policy) |
683 { | 683 { |
684 willAddClientOrObserver(policy); | 684 willAddClientOrObserver(policy); |
685 | 685 |
686 if (m_isRevalidating) { | 686 if (m_isRevalidating) { |
687 m_clients.add(client); | 687 m_clients.add(client); |
688 return; | 688 return; |
689 } | 689 } |
690 | 690 |
691 // If we have existing data to send to the new client and the resource type
supprts it, send it asynchronously. | 691 // If an error has occurred or we have existing data to send to the new clie
nt and the resource type supprts it, send it asynchronously. |
692 if (!m_response.isNull() && !shouldSendCachedDataSynchronouslyForType(getTyp
e()) && !m_needsSynchronousCacheHit) { | 692 if ((errorOccurred() || !m_response.isNull()) && !typeNeedsSynchronousCacheH
it(getType()) && !m_needsSynchronousCacheHit) { |
693 m_clientsAwaitingCallback.add(client); | 693 m_clientsAwaitingCallback.add(client); |
694 ResourceCallback::callbackHandler().schedule(this); | 694 ResourceCallback::callbackHandler().schedule(this); |
695 return; | 695 return; |
696 } | 696 } |
697 | 697 |
698 m_clients.add(client); | 698 m_clients.add(client); |
699 didAddClient(client); | 699 didAddClient(client); |
700 return; | 700 return; |
701 } | 701 } |
702 | 702 |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 case Resource::TextTrack: | 1065 case Resource::TextTrack: |
1066 case Resource::Media: | 1066 case Resource::Media: |
1067 case Resource::Manifest: | 1067 case Resource::Manifest: |
1068 return false; | 1068 return false; |
1069 } | 1069 } |
1070 NOTREACHED(); | 1070 NOTREACHED(); |
1071 return false; | 1071 return false; |
1072 } | 1072 } |
1073 | 1073 |
1074 } // namespace blink | 1074 } // namespace blink |
OLD | NEW |