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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 return true; | 668 return true; |
669 if (type == Resource::CSSStyleSheet) | 669 if (type == Resource::CSSStyleSheet) |
670 return true; | 670 return true; |
671 if (type == Resource::Script) | 671 if (type == Resource::Script) |
672 return true; | 672 return true; |
673 if (type == Resource::Font) | 673 if (type == Resource::Font) |
674 return true; | 674 return true; |
675 return false; | 675 return false; |
676 } | 676 } |
677 | 677 |
678 void Resource::willAddClientOrObserver() | 678 void Resource::willAddClientOrObserver(bool passive) |
679 { | 679 { |
680 ASSERT(!isPurgeable()); | 680 ASSERT(!isPurgeable()); |
681 if (m_preloadResult == PreloadNotReferenced) { | 681 if (!passive && m_preloadResult == PreloadNotReferenced) { |
682 if (isLoaded()) | 682 if (isLoaded()) |
683 m_preloadResult = PreloadReferencedWhileComplete; | 683 m_preloadResult = PreloadReferencedWhileComplete; |
684 else if (isLoading()) | 684 else if (isLoading()) |
685 m_preloadResult = PreloadReferencedWhileLoading; | 685 m_preloadResult = PreloadReferencedWhileLoading; |
686 else | 686 else |
687 m_preloadResult = PreloadReferenced; | 687 m_preloadResult = PreloadReferenced; |
688 } | 688 } |
689 if (!hasClientsOrObservers()) | 689 if (!hasClientsOrObservers()) |
690 memoryCache()->makeLive(this); | 690 memoryCache()->makeLive(this); |
691 } | 691 } |
692 | 692 |
693 void Resource::addClient(ResourceClient* client) | 693 void Resource::addClient(ResourceClient* client, bool passive) |
694 { | 694 { |
695 willAddClientOrObserver(); | 695 willAddClientOrObserver(passive); |
696 | 696 |
697 if (!m_revalidatingRequest.isNull()) { | 697 if (!m_revalidatingRequest.isNull()) { |
698 m_clients.add(client); | 698 m_clients.add(client); |
699 return; | 699 return; |
700 } | 700 } |
701 | 701 |
702 // If we have existing data to send to the new client and the resource type
supprts it, send it asynchronously. | 702 // If we have existing data to send to the new client and the resource type
supprts it, send it asynchronously. |
703 if (!m_response.isNull() && !shouldSendCachedDataSynchronouslyForType(getTyp
e()) && !m_needsSynchronousCacheHit) { | 703 if (!m_response.isNull() && !shouldSendCachedDataSynchronouslyForType(getTyp
e()) && !m_needsSynchronousCacheHit) { |
704 m_clientsAwaitingCallback.add(client); | 704 m_clientsAwaitingCallback.add(client); |
705 ResourceCallback::callbackHandler().schedule(this); | 705 ResourceCallback::callbackHandler().schedule(this); |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 case Resource::Media: | 1122 case Resource::Media: |
1123 return "Media"; | 1123 return "Media"; |
1124 case Resource::Manifest: | 1124 case Resource::Manifest: |
1125 return "Manifest"; | 1125 return "Manifest"; |
1126 } | 1126 } |
1127 ASSERT_NOT_REACHED(); | 1127 ASSERT_NOT_REACHED(); |
1128 return "Unknown"; | 1128 return "Unknown"; |
1129 } | 1129 } |
1130 | 1130 |
1131 } // namespace blink | 1131 } // namespace blink |
OLD | NEW |