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/timing/ResourceTimingInfo.h" | |
39 #include "platform/Logging.h" | 38 #include "platform/Logging.h" |
40 #include "platform/RuntimeEnabledFeatures.h" | 39 #include "platform/RuntimeEnabledFeatures.h" |
41 #include "platform/TraceEvent.h" | 40 #include "platform/TraceEvent.h" |
42 #include "platform/TracedValue.h" | 41 #include "platform/TracedValue.h" |
43 #include "platform/mhtml/ArchiveResource.h" | 42 #include "platform/mhtml/ArchiveResource.h" |
44 #include "platform/mhtml/ArchiveResourceCollection.h" | 43 #include "platform/mhtml/ArchiveResourceCollection.h" |
| 44 #include "platform/network/ResourceTimingInfo.h" |
45 #include "platform/weborigin/KnownPorts.h" | 45 #include "platform/weborigin/KnownPorts.h" |
46 #include "platform/weborigin/SecurityOrigin.h" | 46 #include "platform/weborigin/SecurityOrigin.h" |
47 #include "platform/weborigin/SecurityPolicy.h" | 47 #include "platform/weborigin/SecurityPolicy.h" |
48 #include "public/platform/Platform.h" | 48 #include "public/platform/Platform.h" |
49 #include "public/platform/WebURL.h" | 49 #include "public/platform/WebURL.h" |
50 #include "public/platform/WebURLRequest.h" | 50 #include "public/platform/WebURLRequest.h" |
51 #include "wtf/text/CString.h" | 51 #include "wtf/text/CString.h" |
52 #include "wtf/text/WTFString.h" | 52 #include "wtf/text/WTFString.h" |
53 | 53 |
54 #define PRELOAD_DEBUG 0 | 54 #define PRELOAD_DEBUG 0 |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 addAdditionalRequestHeaders(request.mutableResourceRequest(), factory.type()
); | 461 addAdditionalRequestHeaders(request.mutableResourceRequest(), factory.type()
); |
462 ResourcePtr<Resource> resource = factory.create(request.resourceRequest(), c
harset); | 462 ResourcePtr<Resource> resource = factory.create(request.resourceRequest(), c
harset); |
463 resource->setCacheIdentifier(cacheIdentifier); | 463 resource->setCacheIdentifier(cacheIdentifier); |
464 | 464 |
465 memoryCache()->add(resource.get()); | 465 memoryCache()->add(resource.get()); |
466 return resource; | 466 return resource; |
467 } | 467 } |
468 | 468 |
469 void ResourceFetcher::storeResourceTimingInitiatorInformation(Resource* resource
) | 469 void ResourceFetcher::storeResourceTimingInitiatorInformation(Resource* resource
) |
470 { | 470 { |
471 if (resource->options().requestInitiatorContext != DocumentContext) | |
472 return; | |
473 if (resource->options().initiatorInfo.name == FetchInitiatorTypeNames::inter
nal) | 471 if (resource->options().initiatorInfo.name == FetchInitiatorTypeNames::inter
nal) |
474 return; | 472 return; |
475 | 473 |
476 OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(resource->optio
ns().initiatorInfo.name, monotonicallyIncreasingTime(), resource->type() == Reso
urce::MainResource); | 474 OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(resource->optio
ns().initiatorInfo.name, monotonicallyIncreasingTime(), resource->type() == Reso
urce::MainResource); |
477 | 475 |
478 if (resource->isCacheValidator()) { | 476 if (resource->isCacheValidator()) { |
479 const AtomicString& timingAllowOrigin = resource->resourceToRevalidate()
->response().httpHeaderField("Timing-Allow-Origin"); | 477 const AtomicString& timingAllowOrigin = resource->resourceToRevalidate()
->response().httpHeaderField("Timing-Allow-Origin"); |
480 if (!timingAllowOrigin.isEmpty()) | 478 if (!timingAllowOrigin.isEmpty()) |
481 info->setOriginalTimingAllowOrigin(timingAllowOrigin); | 479 info->setOriginalTimingAllowOrigin(timingAllowOrigin); |
482 } | 480 } |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); | 803 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); |
806 RefPtrWillBeRawPtr<ResourceFetcher> protect(this); | 804 RefPtrWillBeRawPtr<ResourceFetcher> protect(this); |
807 willTerminateResourceLoader(resource->loader()); | 805 willTerminateResourceLoader(resource->loader()); |
808 | 806 |
809 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400) { | 807 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400) { |
810 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); | 808 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); |
811 if (it != m_resourceTimingInfoMap.end()) { | 809 if (it != m_resourceTimingInfoMap.end()) { |
812 OwnPtr<ResourceTimingInfo> info = it->value.release(); | 810 OwnPtr<ResourceTimingInfo> info = it->value.release(); |
813 m_resourceTimingInfoMap.remove(it); | 811 m_resourceTimingInfoMap.remove(it); |
814 populateResourceTiming(info.get(), resource, false); | 812 populateResourceTiming(info.get(), resource, false); |
815 context().addResourceTiming(*info); | 813 if (resource->options().requestInitiatorContext == DocumentContext) |
| 814 context().addResourceTiming(*info); |
| 815 resource->reportResourceTimingToClients(*info); |
816 } | 816 } |
817 } | 817 } |
818 context().dispatchDidFinishLoading(resource->identifier(), finishTime, encod
edDataLength); | 818 context().dispatchDidFinishLoading(resource->identifier(), finishTime, encod
edDataLength); |
819 } | 819 } |
820 | 820 |
821 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc
eLoadPriority loadPriority, int intraPriorityValue) | 821 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc
eLoadPriority loadPriority, int intraPriorityValue) |
822 { | 822 { |
823 TRACE_EVENT_ASYNC_STEP_INTO1("blink.net", "Resource", resource, "ChangePrior
ity", "priority", loadPriority); | 823 TRACE_EVENT_ASYNC_STEP_INTO1("blink.net", "Resource", resource, "ChangePrior
ity", "priority", loadPriority); |
824 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio
rity, intraPriorityValue); | 824 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio
rity, intraPriorityValue); |
825 } | 825 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 | 1059 |
1060 DEFINE_TRACE(ResourceFetcher) | 1060 DEFINE_TRACE(ResourceFetcher) |
1061 { | 1061 { |
1062 visitor->trace(m_context); | 1062 visitor->trace(m_context); |
1063 visitor->trace(m_archiveResourceCollection); | 1063 visitor->trace(m_archiveResourceCollection); |
1064 visitor->trace(m_loaders); | 1064 visitor->trace(m_loaders); |
1065 visitor->trace(m_nonBlockingLoaders); | 1065 visitor->trace(m_nonBlockingLoaders); |
1066 } | 1066 } |
1067 | 1067 |
1068 } | 1068 } |
OLD | NEW |