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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && | 304 if (type == ResourceLoadingFromCache && !resource->stillNeedsLoad() && |
305 !m_validatedURLs.contains(request.resourceRequest().url())) { | 305 !m_validatedURLs.contains(request.resourceRequest().url())) { |
306 // Resources loaded from memory cache should be reported the first time | 306 // Resources loaded from memory cache should be reported the first time |
307 // they're used. | 307 // they're used. |
308 std::unique_ptr<ResourceTimingInfo> info = ResourceTimingInfo::create( | 308 std::unique_ptr<ResourceTimingInfo> info = ResourceTimingInfo::create( |
309 request.options().initiatorInfo.name, monotonicallyIncreasingTime(), | 309 request.options().initiatorInfo.name, monotonicallyIncreasingTime(), |
310 resource->getType() == Resource::MainResource); | 310 resource->getType() == Resource::MainResource); |
311 populateResourceTiming(info.get(), resource); | 311 populateResourceTiming(info.get(), resource); |
312 info->clearLoadTimings(); | 312 info->clearLoadTimings(); |
313 info->setLoadFinishTime(info->initialTime()); | 313 info->setLoadFinishTime(info->initialTime()); |
314 m_scheduledResourceTimingReports.append(std::move(info)); | 314 m_scheduledResourceTimingReports.push_back(std::move(info)); |
315 if (!m_resourceTimingReportTimer.isActive()) | 315 if (!m_resourceTimingReportTimer.isActive()) |
316 m_resourceTimingReportTimer.startOneShot(0, BLINK_FROM_HERE); | 316 m_resourceTimingReportTimer.startOneShot(0, BLINK_FROM_HERE); |
317 } | 317 } |
318 | 318 |
319 if (m_validatedURLs.size() >= kMaxValidatedURLsSize) { | 319 if (m_validatedURLs.size() >= kMaxValidatedURLsSize) { |
320 m_validatedURLs.clear(); | 320 m_validatedURLs.clear(); |
321 } | 321 } |
322 m_validatedURLs.add(request.resourceRequest().url()); | 322 m_validatedURLs.add(request.resourceRequest().url()); |
323 } | 323 } |
324 | 324 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 if (request.options().initiatorInfo.name == | 500 if (request.options().initiatorInfo.name == |
501 FetchInitiatorTypeNames::xmlhttprequest) { | 501 FetchInitiatorTypeNames::xmlhttprequest) { |
502 activityLogger = V8DOMActivityLogger::currentActivityLogger(); | 502 activityLogger = V8DOMActivityLogger::currentActivityLogger(); |
503 } else { | 503 } else { |
504 activityLogger = | 504 activityLogger = |
505 V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld(); | 505 V8DOMActivityLogger::currentActivityLoggerIfIsolatedWorld(); |
506 } | 506 } |
507 | 507 |
508 if (activityLogger) { | 508 if (activityLogger) { |
509 Vector<String> argv; | 509 Vector<String> argv; |
510 argv.append(Resource::resourceTypeToString( | 510 argv.push_back(Resource::resourceTypeToString( |
511 factory.type(), request.options().initiatorInfo.name)); | 511 factory.type(), request.options().initiatorInfo.name)); |
512 argv.append(request.url()); | 512 argv.push_back(request.url()); |
513 activityLogger->logEvent("blinkRequestResource", argv.size(), | 513 activityLogger->logEvent("blinkRequestResource", argv.size(), |
514 argv.data()); | 514 argv.data()); |
515 } | 515 } |
516 } | 516 } |
517 | 517 |
518 bool isDataUrl = request.resourceRequest().url().protocolIsData(); | 518 bool isDataUrl = request.resourceRequest().url().protocolIsData(); |
519 bool isStaticData = isDataUrl || substituteData.isValid() || m_archive; | 519 bool isStaticData = isDataUrl || substituteData.isValid() || m_archive; |
520 Resource* resource(nullptr); | 520 Resource* resource(nullptr); |
521 if (isStaticData) { | 521 if (isStaticData) { |
522 resource = resourceForStaticData(request, factory, substituteData); | 522 resource = resourceForStaticData(request, factory, substituteData); |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 m_loaders.remove(loader); | 1253 m_loaders.remove(loader); |
1254 else if (m_nonBlockingLoaders.contains(loader)) | 1254 else if (m_nonBlockingLoaders.contains(loader)) |
1255 m_nonBlockingLoaders.remove(loader); | 1255 m_nonBlockingLoaders.remove(loader); |
1256 else | 1256 else |
1257 NOTREACHED(); | 1257 NOTREACHED(); |
1258 } | 1258 } |
1259 | 1259 |
1260 void ResourceFetcher::stopFetching() { | 1260 void ResourceFetcher::stopFetching() { |
1261 HeapVector<Member<ResourceLoader>> loadersToCancel; | 1261 HeapVector<Member<ResourceLoader>> loadersToCancel; |
1262 for (const auto& loader : m_nonBlockingLoaders) | 1262 for (const auto& loader : m_nonBlockingLoaders) |
1263 loadersToCancel.append(loader); | 1263 loadersToCancel.push_back(loader); |
1264 for (const auto& loader : m_loaders) | 1264 for (const auto& loader : m_loaders) |
1265 loadersToCancel.append(loader); | 1265 loadersToCancel.push_back(loader); |
1266 | 1266 |
1267 for (const auto& loader : loadersToCancel) { | 1267 for (const auto& loader : loadersToCancel) { |
1268 if (m_loaders.contains(loader) || m_nonBlockingLoaders.contains(loader)) | 1268 if (m_loaders.contains(loader) || m_nonBlockingLoaders.contains(loader)) |
1269 loader->cancel(); | 1269 loader->cancel(); |
1270 } | 1270 } |
1271 } | 1271 } |
1272 | 1272 |
1273 bool ResourceFetcher::isFetching() const { | 1273 bool ResourceFetcher::isFetching() const { |
1274 return !m_loaders.isEmpty(); | 1274 return !m_loaders.isEmpty(); |
1275 } | 1275 } |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 visitor->trace(m_context); | 1522 visitor->trace(m_context); |
1523 visitor->trace(m_archive); | 1523 visitor->trace(m_archive); |
1524 visitor->trace(m_loaders); | 1524 visitor->trace(m_loaders); |
1525 visitor->trace(m_nonBlockingLoaders); | 1525 visitor->trace(m_nonBlockingLoaders); |
1526 visitor->trace(m_documentResources); | 1526 visitor->trace(m_documentResources); |
1527 visitor->trace(m_preloads); | 1527 visitor->trace(m_preloads); |
1528 visitor->trace(m_resourceTimingInfoMap); | 1528 visitor->trace(m_resourceTimingInfoMap); |
1529 } | 1529 } |
1530 | 1530 |
1531 } // namespace blink | 1531 } // namespace blink |
OLD | NEW |