| 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5     Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 
| 6     rights reserved. | 6     rights reserved. | 
| 7     Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 7     Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 
| 8 | 8 | 
| 9     This library is free software; you can redistribute it and/or | 9     This library is free software; you can redistribute it and/or | 
| 10     modify it under the terms of the GNU Library General Public | 10     modify it under the terms of the GNU Library General Public | 
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 305         request.resourceRequest().requestContext()); | 305         request.resourceRequest().requestContext()); | 
| 306   } | 306   } | 
| 307 | 307 | 
| 308   if (isStaticData) | 308   if (isStaticData) | 
| 309     return; | 309     return; | 
| 310 | 310 | 
| 311   if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && | 311   if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && | 
| 312       !m_validatedURLs.contains(request.resourceRequest().url())) { | 312       !m_validatedURLs.contains(request.resourceRequest().url())) { | 
| 313     // Resources loaded from memory cache should be reported the first time | 313     // Resources loaded from memory cache should be reported the first time | 
| 314     // they're used. | 314     // they're used. | 
| 315     std::unique_ptr<ResourceTimingInfo> info = ResourceTimingInfo::create( | 315     RefPtr<ResourceTimingInfo> info = ResourceTimingInfo::create( | 
| 316         request.options().initiatorInfo.name, monotonicallyIncreasingTime(), | 316         request.options().initiatorInfo.name, monotonicallyIncreasingTime(), | 
| 317         resource->getType() == Resource::MainResource); | 317         resource->getType() == Resource::MainResource); | 
| 318     populateTimingInfo(info.get(), resource); | 318     populateTimingInfo(info.get(), resource); | 
| 319     info->clearLoadTimings(); | 319     info->clearLoadTimings(); | 
| 320     info->setLoadFinishTime(info->initialTime()); | 320     info->setLoadFinishTime(info->initialTime()); | 
| 321     m_scheduledResourceTimingReports.push_back(std::move(info)); | 321     m_scheduledResourceTimingReports.push_back(info.release()); | 
| 322     if (!m_resourceTimingReportTimer.isActive()) | 322     if (!m_resourceTimingReportTimer.isActive()) | 
| 323       m_resourceTimingReportTimer.startOneShot(0, BLINK_FROM_HERE); | 323       m_resourceTimingReportTimer.startOneShot(0, BLINK_FROM_HERE); | 
| 324   } | 324   } | 
| 325 | 325 | 
| 326   if (m_validatedURLs.size() >= kMaxValidatedURLsSize) { | 326   if (m_validatedURLs.size() >= kMaxValidatedURLsSize) { | 
| 327     m_validatedURLs.clear(); | 327     m_validatedURLs.clear(); | 
| 328   } | 328   } | 
| 329   m_validatedURLs.insert(request.resourceRequest().url()); | 329   m_validatedURLs.insert(request.resourceRequest().url()); | 
| 330 } | 330 } | 
| 331 | 331 | 
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 626     return nullptr; | 626     return nullptr; | 
| 627   scopedResourceLoadTracker.resourceLoadContinuesBeyondScope(); | 627   scopedResourceLoadTracker.resourceLoadContinuesBeyondScope(); | 
| 628 | 628 | 
| 629   DCHECK(!resource->errorOccurred() || | 629   DCHECK(!resource->errorOccurred() || | 
| 630          request.options().synchronousPolicy == RequestSynchronously); | 630          request.options().synchronousPolicy == RequestSynchronously); | 
| 631   return resource; | 631   return resource; | 
| 632 } | 632 } | 
| 633 | 633 | 
| 634 void ResourceFetcher::resourceTimingReportTimerFired(TimerBase* timer) { | 634 void ResourceFetcher::resourceTimingReportTimerFired(TimerBase* timer) { | 
| 635   DCHECK_EQ(timer, &m_resourceTimingReportTimer); | 635   DCHECK_EQ(timer, &m_resourceTimingReportTimer); | 
| 636   Vector<std::unique_ptr<ResourceTimingInfo>> timingReports; | 636   Vector<RefPtr<ResourceTimingInfo>> timingReports; | 
| 637   timingReports.swap(m_scheduledResourceTimingReports); | 637   timingReports.swap(m_scheduledResourceTimingReports); | 
| 638   for (const auto& timingInfo : timingReports) | 638   for (const auto& timingInfo : timingReports) | 
| 639     context().addResourceTiming(*timingInfo); | 639     context().addResourceTiming(*timingInfo); | 
| 640 } | 640 } | 
| 641 | 641 | 
| 642 void ResourceFetcher::determineRequestContext(ResourceRequest& request, | 642 void ResourceFetcher::determineRequestContext(ResourceRequest& request, | 
| 643                                               Resource::Type type, | 643                                               Resource::Type type, | 
| 644                                               bool isMainFrame) { | 644                                               bool isMainFrame) { | 
| 645   WebURLRequest::RequestContext requestContext = | 645   WebURLRequest::RequestContext requestContext = | 
| 646       requestContextFromType(isMainFrame, type); | 646       requestContextFromType(isMainFrame, type); | 
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 756                          : monotonicallyIncreasingTime(); | 756                          : monotonicallyIncreasingTime(); | 
| 757 | 757 | 
| 758   // This buffer is created and populated for providing transferSize | 758   // This buffer is created and populated for providing transferSize | 
| 759   // and redirect timing opt-in information. | 759   // and redirect timing opt-in information. | 
| 760   if (isMainResource) { | 760   if (isMainResource) { | 
| 761     DCHECK(!m_navigationTimingInfo); | 761     DCHECK(!m_navigationTimingInfo); | 
| 762     m_navigationTimingInfo = | 762     m_navigationTimingInfo = | 
| 763         ResourceTimingInfo::create(fetchInitiator, startTime, isMainResource); | 763         ResourceTimingInfo::create(fetchInitiator, startTime, isMainResource); | 
| 764   } | 764   } | 
| 765 | 765 | 
| 766   std::unique_ptr<ResourceTimingInfo> info = | 766   RefPtr<ResourceTimingInfo> info = | 
| 767       ResourceTimingInfo::create(fetchInitiator, startTime, isMainResource); | 767       ResourceTimingInfo::create(fetchInitiator, startTime, isMainResource); | 
| 768 | 768 | 
| 769   if (resource->isCacheValidator()) { | 769   if (resource->isCacheValidator()) { | 
| 770     const AtomicString& timingAllowOrigin = | 770     const AtomicString& timingAllowOrigin = | 
| 771         resource->response().httpHeaderField(HTTPNames::Timing_Allow_Origin); | 771         resource->response().httpHeaderField(HTTPNames::Timing_Allow_Origin); | 
| 772     if (!timingAllowOrigin.isEmpty()) | 772     if (!timingAllowOrigin.isEmpty()) | 
| 773       info->setOriginalTimingAllowOrigin(timingAllowOrigin); | 773       info->setOriginalTimingAllowOrigin(timingAllowOrigin); | 
| 774   } | 774   } | 
| 775 | 775 | 
| 776   if (!isMainResource || | 776   if (!isMainResource || | 
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1172   if (resource->getType() == Resource::MainResource) { | 1172   if (resource->getType() == Resource::MainResource) { | 
| 1173     DCHECK(m_navigationTimingInfo); | 1173     DCHECK(m_navigationTimingInfo); | 
| 1174     // Store redirect responses that were packed inside the final response. | 1174     // Store redirect responses that were packed inside the final response. | 
| 1175     addRedirectsToTimingInfo(resource, m_navigationTimingInfo.get()); | 1175     addRedirectsToTimingInfo(resource, m_navigationTimingInfo.get()); | 
| 1176     if (resource->response().isHTTP()) { | 1176     if (resource->response().isHTTP()) { | 
| 1177       populateTimingInfo(m_navigationTimingInfo.get(), resource); | 1177       populateTimingInfo(m_navigationTimingInfo.get(), resource); | 
| 1178       m_navigationTimingInfo->addFinalTransferSize( | 1178       m_navigationTimingInfo->addFinalTransferSize( | 
| 1179           encodedDataLength == -1 ? 0 : encodedDataLength); | 1179           encodedDataLength == -1 ? 0 : encodedDataLength); | 
| 1180     } | 1180     } | 
| 1181   } | 1181   } | 
| 1182   if (std::unique_ptr<ResourceTimingInfo> info = | 1182   if (RefPtr<ResourceTimingInfo> info = | 
| 1183           m_resourceTimingInfoMap.take(resource)) { | 1183           m_resourceTimingInfoMap.take(resource)) { | 
| 1184     // Store redirect responses that were packed inside the final response. | 1184     // Store redirect responses that were packed inside the final response. | 
| 1185     addRedirectsToTimingInfo(resource, info.get()); | 1185     addRedirectsToTimingInfo(resource, info.get()); | 
| 1186 | 1186 | 
| 1187     if (resource->response().isHTTP() && | 1187     if (resource->response().isHTTP() && | 
| 1188         resource->response().httpStatusCode() < 400) { | 1188         resource->response().httpStatusCode() < 400) { | 
| 1189       populateTimingInfo(info.get(), resource); | 1189       populateTimingInfo(info.get(), resource); | 
| 1190       info->setLoadFinishTime(finishTime); | 1190       info->setLoadFinishTime(finishTime); | 
| 1191       // encodedDataLength == -1 means "not available". | 1191       // encodedDataLength == -1 means "not available". | 
| 1192       // TODO(ricea): Find cases where it is not available but the | 1192       // TODO(ricea): Find cases where it is not available but the | 
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1554   visitor->trace(m_context); | 1554   visitor->trace(m_context); | 
| 1555   visitor->trace(m_archive); | 1555   visitor->trace(m_archive); | 
| 1556   visitor->trace(m_loaders); | 1556   visitor->trace(m_loaders); | 
| 1557   visitor->trace(m_nonBlockingLoaders); | 1557   visitor->trace(m_nonBlockingLoaders); | 
| 1558   visitor->trace(m_documentResources); | 1558   visitor->trace(m_documentResources); | 
| 1559   visitor->trace(m_preloads); | 1559   visitor->trace(m_preloads); | 
| 1560   visitor->trace(m_resourceTimingInfoMap); | 1560   visitor->trace(m_resourceTimingInfoMap); | 
| 1561 } | 1561 } | 
| 1562 | 1562 | 
| 1563 }  // namespace blink | 1563 }  // namespace blink | 
| OLD | NEW | 
|---|