| 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 return true; | 666 return true; |
| 667 if (type == Resource::CSSStyleSheet) | 667 if (type == Resource::CSSStyleSheet) |
| 668 return true; | 668 return true; |
| 669 if (type == Resource::Script) | 669 if (type == Resource::Script) |
| 670 return true; | 670 return true; |
| 671 if (type == Resource::Font) | 671 if (type == Resource::Font) |
| 672 return true; | 672 return true; |
| 673 return false; | 673 return false; |
| 674 } | 674 } |
| 675 | 675 |
| 676 void Resource::willAddClientOrObserver() | 676 void Resource::willAddClientOrObserver(PreloadReferencePolicy policy) |
| 677 { | 677 { |
| 678 ASSERT(!isPurgeable()); | 678 ASSERT(!isPurgeable()); |
| 679 if (m_preloadResult == PreloadNotReferenced) { | 679 if (policy == MarkAsReferenced && m_preloadResult == PreloadNotReferenced) { |
| 680 if (isLoaded()) | 680 if (isLoaded()) |
| 681 m_preloadResult = PreloadReferencedWhileComplete; | 681 m_preloadResult = PreloadReferencedWhileComplete; |
| 682 else if (isLoading()) | 682 else if (isLoading()) |
| 683 m_preloadResult = PreloadReferencedWhileLoading; | 683 m_preloadResult = PreloadReferencedWhileLoading; |
| 684 else | 684 else |
| 685 m_preloadResult = PreloadReferenced; | 685 m_preloadResult = PreloadReferenced; |
| 686 | 686 |
| 687 if (m_preloadDiscoveryTime) { | 687 if (m_preloadDiscoveryTime) { |
| 688 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncre
asingTime() - m_preloadDiscoveryTime)); | 688 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncre
asingTime() - m_preloadDiscoveryTime)); |
| 689 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryHistogram,
("PreloadScanner.ReferenceTime", 0, 10000, 50)); | 689 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryHistogram,
("PreloadScanner.ReferenceTime", 0, 10000, 50)); |
| 690 preloadDiscoveryHistogram.count(timeSinceDiscovery); | 690 preloadDiscoveryHistogram.count(timeSinceDiscovery); |
| 691 } | 691 } |
| 692 } | 692 } |
| 693 if (!hasClientsOrObservers()) | 693 if (!hasClientsOrObservers()) |
| 694 memoryCache()->makeLive(this); | 694 memoryCache()->makeLive(this); |
| 695 } | 695 } |
| 696 | 696 |
| 697 void Resource::addClient(ResourceClient* client) | 697 void Resource::addClient(ResourceClient* client, PreloadReferencePolicy policy) |
| 698 { | 698 { |
| 699 willAddClientOrObserver(); | 699 willAddClientOrObserver(policy); |
| 700 | 700 |
| 701 if (m_isRevalidating) { | 701 if (m_isRevalidating) { |
| 702 m_clients.add(client); | 702 m_clients.add(client); |
| 703 return; | 703 return; |
| 704 } | 704 } |
| 705 | 705 |
| 706 // If we have existing data to send to the new client and the resource type
supprts it, send it asynchronously. | 706 // If we have existing data to send to the new client and the resource type
supprts it, send it asynchronously. |
| 707 if (!m_response.isNull() && !shouldSendCachedDataSynchronouslyForType(getTyp
e()) && !m_needsSynchronousCacheHit) { | 707 if (!m_response.isNull() && !shouldSendCachedDataSynchronouslyForType(getTyp
e()) && !m_needsSynchronousCacheHit) { |
| 708 m_clientsAwaitingCallback.add(client); | 708 m_clientsAwaitingCallback.add(client); |
| 709 ResourceCallback::callbackHandler().schedule(this); | 709 ResourceCallback::callbackHandler().schedule(this); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 case Resource::TextTrack: | 1100 case Resource::TextTrack: |
| 1101 case Resource::Media: | 1101 case Resource::Media: |
| 1102 case Resource::Manifest: | 1102 case Resource::Manifest: |
| 1103 return false; | 1103 return false; |
| 1104 } | 1104 } |
| 1105 ASSERT_NOT_REACHED(); | 1105 ASSERT_NOT_REACHED(); |
| 1106 return false; | 1106 return false; |
| 1107 } | 1107 } |
| 1108 | 1108 |
| 1109 } // namespace blink | 1109 } // namespace blink |
| OLD | NEW |