| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "core/fetch/CachedMetadata.h" | 26 #include "core/fetch/CachedMetadata.h" |
| 27 #include "core/fetch/CrossOriginAccessControl.h" | 27 #include "core/fetch/CrossOriginAccessControl.h" |
| 28 #include "core/fetch/FetchInitiatorTypeNames.h" | 28 #include "core/fetch/FetchInitiatorTypeNames.h" |
| 29 #include "core/fetch/MemoryCache.h" | 29 #include "core/fetch/MemoryCache.h" |
| 30 #include "core/fetch/ResourceClient.h" | 30 #include "core/fetch/ResourceClient.h" |
| 31 #include "core/fetch/ResourceClientOrObserverWalker.h" | 31 #include "core/fetch/ResourceClientOrObserverWalker.h" |
| 32 #include "core/fetch/ResourceFetcher.h" | 32 #include "core/fetch/ResourceFetcher.h" |
| 33 #include "core/fetch/ResourceLoader.h" | 33 #include "core/fetch/ResourceLoader.h" |
| 34 #include "core/inspector/InstanceCounters.h" | 34 #include "core/inspector/InstanceCounters.h" |
| 35 #include "platform/Histogram.h" |
| 35 #include "platform/Logging.h" | 36 #include "platform/Logging.h" |
| 36 #include "platform/SharedBuffer.h" | 37 #include "platform/SharedBuffer.h" |
| 37 #include "platform/TraceEvent.h" | 38 #include "platform/TraceEvent.h" |
| 38 #include "platform/network/HTTPParsers.h" | 39 #include "platform/network/HTTPParsers.h" |
| 39 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
| 40 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| 41 #include "public/platform/WebScheduler.h" | 42 #include "public/platform/WebScheduler.h" |
| 42 #include "public/platform/WebSecurityOrigin.h" | 43 #include "public/platform/WebSecurityOrigin.h" |
| 43 #include "wtf/CurrentTime.h" | 44 #include "wtf/CurrentTime.h" |
| 44 #include "wtf/MathExtras.h" | 45 #include "wtf/MathExtras.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 : m_resourceRequest(request) | 296 : m_resourceRequest(request) |
| 296 , m_options(options) | 297 , m_options(options) |
| 297 , m_responseTimestamp(currentTime()) | 298 , m_responseTimestamp(currentTime()) |
| 298 , m_cancelTimer(this, &Resource::cancelTimerFired) | 299 , m_cancelTimer(this, &Resource::cancelTimerFired) |
| 299 , m_loadFinishTime(0) | 300 , m_loadFinishTime(0) |
| 300 , m_identifier(0) | 301 , m_identifier(0) |
| 301 , m_encodedSize(0) | 302 , m_encodedSize(0) |
| 302 , m_decodedSize(0) | 303 , m_decodedSize(0) |
| 303 , m_overheadSize(calculateOverheadSize()) | 304 , m_overheadSize(calculateOverheadSize()) |
| 304 , m_preloadCount(0) | 305 , m_preloadCount(0) |
| 306 , m_preloadDiscoveryTime(0.0) |
| 305 , m_cacheIdentifier(MemoryCache::defaultCacheIdentifier()) | 307 , m_cacheIdentifier(MemoryCache::defaultCacheIdentifier()) |
| 306 , m_preloadResult(PreloadNotReferenced) | 308 , m_preloadResult(PreloadNotReferenced) |
| 307 , m_type(type) | 309 , m_type(type) |
| 308 , m_status(NotStarted) | 310 , m_status(NotStarted) |
| 309 , m_needsSynchronousCacheHit(false) | 311 , m_needsSynchronousCacheHit(false) |
| 310 , m_linkPreload(false) | 312 , m_linkPreload(false) |
| 311 { | 313 { |
| 312 ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests car
eless updates of the enum. | 314 ASSERT(m_type == unsigned(type)); // m_type is a bitfield, so this tests car
eless updates of the enum. |
| 313 InstanceCounters::incrementCounter(InstanceCounters::ResourceCounter); | 315 InstanceCounters::incrementCounter(InstanceCounters::ResourceCounter); |
| 314 | 316 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 void Resource::willAddClientOrObserver() | 679 void Resource::willAddClientOrObserver() |
| 678 { | 680 { |
| 679 ASSERT(!isPurgeable()); | 681 ASSERT(!isPurgeable()); |
| 680 if (m_preloadResult == PreloadNotReferenced) { | 682 if (m_preloadResult == PreloadNotReferenced) { |
| 681 if (isLoaded()) | 683 if (isLoaded()) |
| 682 m_preloadResult = PreloadReferencedWhileComplete; | 684 m_preloadResult = PreloadReferencedWhileComplete; |
| 683 else if (isLoading()) | 685 else if (isLoading()) |
| 684 m_preloadResult = PreloadReferencedWhileLoading; | 686 m_preloadResult = PreloadReferencedWhileLoading; |
| 685 else | 687 else |
| 686 m_preloadResult = PreloadReferenced; | 688 m_preloadResult = PreloadReferenced; |
| 689 |
| 690 if (m_preloadDiscoveryTime) { |
| 691 int timeSinceDiscovery = static_cast<int>(1000 * (monotonicallyIncre
asingTime() - m_preloadDiscoveryTime)); |
| 692 DEFINE_STATIC_LOCAL(CustomCountHistogram, preloadDiscoveryHistogram,
("PreloadScanner.ReferenceTime", 0, 10000, 50)); |
| 693 preloadDiscoveryHistogram.count(timeSinceDiscovery); |
| 694 } |
| 687 } | 695 } |
| 688 if (!hasClientsOrObservers()) | 696 if (!hasClientsOrObservers()) |
| 689 memoryCache()->makeLive(this); | 697 memoryCache()->makeLive(this); |
| 690 } | 698 } |
| 691 | 699 |
| 692 void Resource::addClient(ResourceClient* client) | 700 void Resource::addClient(ResourceClient* client) |
| 693 { | 701 { |
| 694 willAddClientOrObserver(); | 702 willAddClientOrObserver(); |
| 695 | 703 |
| 696 if (!m_revalidatingRequest.isNull()) { | 704 if (!m_revalidatingRequest.isNull()) { |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 case Resource::Media: | 1129 case Resource::Media: |
| 1122 return "Media"; | 1130 return "Media"; |
| 1123 case Resource::Manifest: | 1131 case Resource::Manifest: |
| 1124 return "Manifest"; | 1132 return "Manifest"; |
| 1125 } | 1133 } |
| 1126 ASSERT_NOT_REACHED(); | 1134 ASSERT_NOT_REACHED(); |
| 1127 return "Unknown"; | 1135 return "Unknown"; |
| 1128 } | 1136 } |
| 1129 | 1137 |
| 1130 } // namespace blink | 1138 } // namespace blink |
| OLD | NEW |