Chromium Code Reviews| 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 rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
| 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 17 matching lines...) Expand all Loading... | |
| 28 #include "core/fetch/ResourceFetcher.h" | 28 #include "core/fetch/ResourceFetcher.h" |
| 29 | 29 |
| 30 #include "bindings/core/v8/V8DOMActivityLogger.h" | 30 #include "bindings/core/v8/V8DOMActivityLogger.h" |
| 31 #include "core/fetch/CrossOriginAccessControl.h" | 31 #include "core/fetch/CrossOriginAccessControl.h" |
| 32 #include "core/fetch/FetchContext.h" | 32 #include "core/fetch/FetchContext.h" |
| 33 #include "core/fetch/FetchInitiatorTypeNames.h" | 33 #include "core/fetch/FetchInitiatorTypeNames.h" |
| 34 #include "core/fetch/MemoryCache.h" | 34 #include "core/fetch/MemoryCache.h" |
| 35 #include "core/fetch/ResourceLoader.h" | 35 #include "core/fetch/ResourceLoader.h" |
| 36 #include "core/fetch/ResourceLoaderSet.h" | 36 #include "core/fetch/ResourceLoaderSet.h" |
| 37 #include "core/fetch/UniqueIdentifier.h" | 37 #include "core/fetch/UniqueIdentifier.h" |
| 38 #include "core/inspector/InspectorTraceEvents.h" | |
|
pfeldman
2015/11/11 04:52:10
I assume you don't want this dependency here as pe
| |
| 38 #include "platform/Logging.h" | 39 #include "platform/Logging.h" |
| 39 #include "platform/RuntimeEnabledFeatures.h" | 40 #include "platform/RuntimeEnabledFeatures.h" |
| 40 #include "platform/TraceEvent.h" | 41 #include "platform/TraceEvent.h" |
| 41 #include "platform/TracedValue.h" | 42 #include "platform/TracedValue.h" |
| 42 #include "platform/mhtml/ArchiveResource.h" | 43 #include "platform/mhtml/ArchiveResource.h" |
| 43 #include "platform/mhtml/ArchiveResourceCollection.h" | 44 #include "platform/mhtml/ArchiveResourceCollection.h" |
| 44 #include "platform/network/ResourceTimingInfo.h" | 45 #include "platform/network/ResourceTimingInfo.h" |
| 45 #include "platform/weborigin/KnownPorts.h" | 46 #include "platform/weborigin/KnownPorts.h" |
| 46 #include "platform/weborigin/SecurityOrigin.h" | 47 #include "platform/weborigin/SecurityOrigin.h" |
| 47 #include "platform/weborigin/SecurityPolicy.h" | 48 #include "platform/weborigin/SecurityPolicy.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 331 m_nonBlockingLoaders->remove(resource->loader()); | 332 m_nonBlockingLoaders->remove(resource->loader()); |
| 332 if (!m_loaders) | 333 if (!m_loaders) |
| 333 m_loaders = ResourceLoaderSet::create(); | 334 m_loaders = ResourceLoaderSet::create(); |
| 334 m_loaders->add(resource->loader()); | 335 m_loaders->add(resource->loader()); |
| 335 } | 336 } |
| 336 } | 337 } |
| 337 | 338 |
| 338 ResourcePtr<Resource> ResourceFetcher::requestResource(FetchRequest& request, co nst ResourceFactory& factory, const SubstituteData& substituteData) | 339 ResourcePtr<Resource> ResourceFetcher::requestResource(FetchRequest& request, co nst ResourceFactory& factory, const SubstituteData& substituteData) |
| 339 { | 340 { |
| 340 ASSERT(request.options().synchronousPolicy == RequestAsynchronously || facto ry.type() == Resource::Raw || factory.type() == Resource::XSLStyleSheet); | 341 ASSERT(request.options().synchronousPolicy == RequestAsynchronously || facto ry.type() == Resource::Raw || factory.type() == Resource::XSLStyleSheet); |
| 342 unsigned long identifier = createUniqueIdentifier(); | |
| 343 TRACE_EVENT1("devtools.timeline", "ResourceSendRequest", | |
| 344 "data", InspectorSendRequestEvent::data(identifier, request.resourceRequ est())); | |
| 341 | 345 |
| 342 context().upgradeInsecureRequest(request); | 346 context().upgradeInsecureRequest(request); |
| 343 context().addClientHintsIfNecessary(request); | 347 context().addClientHintsIfNecessary(request); |
| 344 context().addCSPHeaderIfNecessary(factory.type(), request); | 348 context().addCSPHeaderIfNecessary(factory.type(), request); |
| 345 | 349 |
| 346 bool isStaticData = request.resourceRequest().url().protocolIsData() || subs tituteData.isValid(); | 350 bool isStaticData = request.resourceRequest().url().protocolIsData() || subs tituteData.isValid(); |
| 347 if (isStaticData) | 351 if (isStaticData) |
| 348 preCacheData(request, factory, substituteData); | 352 preCacheData(request, factory, substituteData); |
| 349 | 353 |
| 350 KURL url = request.resourceRequest().url(); | 354 KURL url = request.resourceRequest().url(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 return nullptr; | 404 return nullptr; |
| 401 if (resource->type() != factory.type()) { | 405 if (resource->type() != factory.type()) { |
| 402 ASSERT(request.forPreload()); | 406 ASSERT(request.forPreload()); |
| 403 return nullptr; | 407 return nullptr; |
| 404 } | 408 } |
| 405 | 409 |
| 406 if (!resource->hasClients()) | 410 if (!resource->hasClients()) |
| 407 m_deadStatsRecorder.update(policy); | 411 m_deadStatsRecorder.update(policy); |
| 408 | 412 |
| 409 if (policy != Use) | 413 if (policy != Use) |
| 410 resource->setIdentifier(createUniqueIdentifier()); | 414 resource->setIdentifier(identifier); |
| 411 | 415 |
| 412 if (!request.forPreload() || policy != Use) { | 416 if (!request.forPreload() || policy != Use) { |
| 413 ResourceLoadPriority priority = loadPriority(factory.type(), request, Re sourcePriority::NotVisible); | 417 ResourceLoadPriority priority = loadPriority(factory.type(), request, Re sourcePriority::NotVisible); |
| 414 // When issuing another request for a resource that is already in-flight make | 418 // When issuing another request for a resource that is already in-flight make |
| 415 // sure to not demote the priority of the in-flight request. If the new request | 419 // sure to not demote the priority of the in-flight request. If the new request |
| 416 // isn't at the same priority as the in-flight request, only allow promo tions. | 420 // isn't at the same priority as the in-flight request, only allow promo tions. |
| 417 // This can happen when a visible image's priority is increased and then another | 421 // This can happen when a visible image's priority is increased and then another |
| 418 // reference to the image is parsed (which would be at a lower priority) . | 422 // reference to the image is parsed (which would be at a lower priority) . |
| 419 if (priority > resource->resourceRequest().priority()) | 423 if (priority > resource->resourceRequest().priority()) |
| 420 resource->didChangePriority(priority, 0); | 424 resource->didChangePriority(priority, 0); |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1175 visitor->trace(m_archiveResourceCollection); | 1179 visitor->trace(m_archiveResourceCollection); |
| 1176 visitor->trace(m_loaders); | 1180 visitor->trace(m_loaders); |
| 1177 visitor->trace(m_nonBlockingLoaders); | 1181 visitor->trace(m_nonBlockingLoaders); |
| 1178 #if ENABLE(OILPAN) | 1182 #if ENABLE(OILPAN) |
| 1179 visitor->trace(m_preloads); | 1183 visitor->trace(m_preloads); |
| 1180 visitor->trace(m_resourceTimingInfoMap); | 1184 visitor->trace(m_resourceTimingInfoMap); |
| 1181 #endif | 1185 #endif |
| 1182 } | 1186 } |
| 1183 | 1187 |
| 1184 } | 1188 } |
| OLD | NEW |