| 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(PreloadReferencePolicy policy) |
| 679 { | 679 { |
| 680 ASSERT(!isPurgeable()); | 680 ASSERT(!isPurgeable()); |
| 681 if (m_preloadResult == PreloadNotReferenced) { | 681 if (policy == MarkAsReferenced && 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 (m_preloadDiscoveryTime) { | 689 if (m_preloadDiscoveryTime) { |
| 690 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncre
asingTime() - m_preloadDiscoveryTime)); | 690 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncre
asingTime() - m_preloadDiscoveryTime)); |
| 691 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryHistogram,
("PreloadScanner.ReferenceTime", 0, 10000, 50)); | 691 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryHistogram,
("PreloadScanner.ReferenceTime", 0, 10000, 50)); |
| 692 preloadDiscoveryHistogram.count(timeSinceDiscovery); | 692 preloadDiscoveryHistogram.count(timeSinceDiscovery); |
| 693 } | 693 } |
| 694 } | 694 } |
| 695 if (!hasClientsOrObservers()) | 695 if (!hasClientsOrObservers()) |
| 696 memoryCache()->makeLive(this); | 696 memoryCache()->makeLive(this); |
| 697 } | 697 } |
| 698 | 698 |
| 699 void Resource::addClient(ResourceClient* client) | 699 void Resource::addClient(ResourceClient* client, PreloadReferencePolicy policy) |
| 700 { | 700 { |
| 701 willAddClientOrObserver(); | 701 willAddClientOrObserver(policy); |
| 702 | 702 |
| 703 if (m_isRevalidating) { | 703 if (m_isRevalidating) { |
| 704 m_clients.add(client); | 704 m_clients.add(client); |
| 705 return; | 705 return; |
| 706 } | 706 } |
| 707 | 707 |
| 708 // If we have existing data to send to the new client and the resource type
supprts it, send it asynchronously. | 708 // If we have existing data to send to the new client and the resource type
supprts it, send it asynchronously. |
| 709 if (!m_response.isNull() && !shouldSendCachedDataSynchronouslyForType(getTyp
e()) && !m_needsSynchronousCacheHit) { | 709 if (!m_response.isNull() && !shouldSendCachedDataSynchronouslyForType(getTyp
e()) && !m_needsSynchronousCacheHit) { |
| 710 m_clientsAwaitingCallback.add(client); | 710 m_clientsAwaitingCallback.add(client); |
| 711 ResourceCallback::callbackHandler().schedule(this); | 711 ResourceCallback::callbackHandler().schedule(this); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 case Resource::TextTrack: | 1112 case Resource::TextTrack: |
| 1113 case Resource::Media: | 1113 case Resource::Media: |
| 1114 case Resource::Manifest: | 1114 case Resource::Manifest: |
| 1115 return false; | 1115 return false; |
| 1116 } | 1116 } |
| 1117 ASSERT_NOT_REACHED(); | 1117 ASSERT_NOT_REACHED(); |
| 1118 return false; | 1118 return false; |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 } // namespace blink | 1121 } // namespace blink |
| OLD | NEW |