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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 return true; | 654 return true; |
655 if (type == Resource::CSSStyleSheet) | 655 if (type == Resource::CSSStyleSheet) |
656 return true; | 656 return true; |
657 if (type == Resource::Script) | 657 if (type == Resource::Script) |
658 return true; | 658 return true; |
659 if (type == Resource::Font) | 659 if (type == Resource::Font) |
660 return true; | 660 return true; |
661 return false; | 661 return false; |
662 } | 662 } |
663 | 663 |
664 void Resource::willAddClientOrObserver() | 664 void Resource::willAddClientOrObserver(PreloadReferencePolicy policy) |
665 { | 665 { |
666 if (m_preloadResult == PreloadNotReferenced) { | 666 if (policy == MarkAsReferenced && m_preloadResult == PreloadNotReferenced) { |
667 if (isLoaded()) | 667 if (isLoaded()) |
668 m_preloadResult = PreloadReferencedWhileComplete; | 668 m_preloadResult = PreloadReferencedWhileComplete; |
669 else if (isLoading()) | 669 else if (isLoading()) |
670 m_preloadResult = PreloadReferencedWhileLoading; | 670 m_preloadResult = PreloadReferencedWhileLoading; |
671 else | 671 else |
672 m_preloadResult = PreloadReferenced; | 672 m_preloadResult = PreloadReferenced; |
673 | 673 |
674 if (m_preloadDiscoveryTime) { | 674 if (m_preloadDiscoveryTime) { |
675 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncre
asingTime() - m_preloadDiscoveryTime)); | 675 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncre
asingTime() - m_preloadDiscoveryTime)); |
676 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryHistogram,
("PreloadScanner.ReferenceTime", 0, 10000, 50)); | 676 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryHistogram,
("PreloadScanner.ReferenceTime", 0, 10000, 50)); |
677 preloadDiscoveryHistogram.count(timeSinceDiscovery); | 677 preloadDiscoveryHistogram.count(timeSinceDiscovery); |
678 } | 678 } |
679 } | 679 } |
680 if (!hasClientsOrObservers()) | 680 if (!hasClientsOrObservers()) |
681 memoryCache()->makeLive(this); | 681 memoryCache()->makeLive(this); |
682 } | 682 } |
683 | 683 |
684 void Resource::addClient(ResourceClient* client) | 684 void Resource::addClient(ResourceClient* client, PreloadReferencePolicy policy) |
685 { | 685 { |
686 willAddClientOrObserver(); | 686 willAddClientOrObserver(policy); |
687 | 687 |
688 if (m_isRevalidating) { | 688 if (m_isRevalidating) { |
689 m_clients.add(client); | 689 m_clients.add(client); |
690 return; | 690 return; |
691 } | 691 } |
692 | 692 |
693 // If we have existing data to send to the new client and the resource type
supprts it, send it asynchronously. | 693 // If we have existing data to send to the new client and the resource type
supprts it, send it asynchronously. |
694 if (!m_response.isNull() && !shouldSendCachedDataSynchronouslyForType(getTyp
e()) && !m_needsSynchronousCacheHit) { | 694 if (!m_response.isNull() && !shouldSendCachedDataSynchronouslyForType(getTyp
e()) && !m_needsSynchronousCacheHit) { |
695 m_clientsAwaitingCallback.add(client); | 695 m_clientsAwaitingCallback.add(client); |
696 ResourceCallback::callbackHandler().schedule(this); | 696 ResourceCallback::callbackHandler().schedule(this); |
(...skipping 368 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 ASSERT_NOT_REACHED(); | 1070 ASSERT_NOT_REACHED(); |
1071 return false; | 1071 return false; |
1072 } | 1072 } |
1073 | 1073 |
1074 } // namespace blink | 1074 } // namespace blink |
OLD | NEW |