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/mhtml/ArchiveResource.h" | 41 #include "platform/mhtml/ArchiveResource.h" |
43 #include "platform/mhtml/ArchiveResourceCollection.h" | 42 #include "platform/mhtml/ArchiveResourceCollection.h" |
| 43 #include "platform/network/ResourceTimingInfo.h" |
44 #include "platform/weborigin/KnownPorts.h" | 44 #include "platform/weborigin/KnownPorts.h" |
45 #include "platform/weborigin/SecurityOrigin.h" | 45 #include "platform/weborigin/SecurityOrigin.h" |
46 #include "platform/weborigin/SecurityPolicy.h" | 46 #include "platform/weborigin/SecurityPolicy.h" |
47 #include "public/platform/Platform.h" | 47 #include "public/platform/Platform.h" |
48 #include "public/platform/WebURL.h" | 48 #include "public/platform/WebURL.h" |
49 #include "public/platform/WebURLRequest.h" | 49 #include "public/platform/WebURLRequest.h" |
50 #include "wtf/text/CString.h" | 50 #include "wtf/text/CString.h" |
51 #include "wtf/text/WTFString.h" | 51 #include "wtf/text/WTFString.h" |
52 | 52 |
53 #define PRELOAD_DEBUG 0 | 53 #define PRELOAD_DEBUG 0 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 addAdditionalRequestHeaders(request.mutableResourceRequest(), factory.type()
); | 454 addAdditionalRequestHeaders(request.mutableResourceRequest(), factory.type()
); |
455 ResourcePtr<Resource> resource = factory.create(request.resourceRequest(), c
harset); | 455 ResourcePtr<Resource> resource = factory.create(request.resourceRequest(), c
harset); |
456 resource->setCacheIdentifier(cacheIdentifier); | 456 resource->setCacheIdentifier(cacheIdentifier); |
457 | 457 |
458 memoryCache()->add(resource.get()); | 458 memoryCache()->add(resource.get()); |
459 return resource; | 459 return resource; |
460 } | 460 } |
461 | 461 |
462 void ResourceFetcher::storeResourceTimingInitiatorInformation(Resource* resource
) | 462 void ResourceFetcher::storeResourceTimingInitiatorInformation(Resource* resource
) |
463 { | 463 { |
464 if (resource->options().requestInitiatorContext != DocumentContext) | |
465 return; | |
466 if (resource->options().initiatorInfo.name == FetchInitiatorTypeNames::inter
nal) | 464 if (resource->options().initiatorInfo.name == FetchInitiatorTypeNames::inter
nal) |
467 return; | 465 return; |
468 | 466 |
469 OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(resource->optio
ns().initiatorInfo.name, monotonicallyIncreasingTime(), resource->type() == Reso
urce::MainResource); | 467 OwnPtr<ResourceTimingInfo> info = ResourceTimingInfo::create(resource->optio
ns().initiatorInfo.name, monotonicallyIncreasingTime(), resource->type() == Reso
urce::MainResource); |
470 | 468 |
471 if (resource->isCacheValidator()) { | 469 if (resource->isCacheValidator()) { |
472 const AtomicString& timingAllowOrigin = resource->resourceToRevalidate()
->response().httpHeaderField("Timing-Allow-Origin"); | 470 const AtomicString& timingAllowOrigin = resource->resourceToRevalidate()
->response().httpHeaderField("Timing-Allow-Origin"); |
473 if (!timingAllowOrigin.isEmpty()) | 471 if (!timingAllowOrigin.isEmpty()) |
474 info->setOriginalTimingAllowOrigin(timingAllowOrigin); | 472 info->setOriginalTimingAllowOrigin(timingAllowOrigin); |
475 } | 473 } |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); | 796 TRACE_EVENT_ASYNC_END0("blink.net", "Resource", resource); |
799 RefPtrWillBeRawPtr<ResourceFetcher> protect(this); | 797 RefPtrWillBeRawPtr<ResourceFetcher> protect(this); |
800 willTerminateResourceLoader(resource->loader()); | 798 willTerminateResourceLoader(resource->loader()); |
801 | 799 |
802 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400) { | 800 if (resource && resource->response().isHTTP() && resource->response().httpSt
atusCode() < 400) { |
803 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); | 801 ResourceTimingInfoMap::iterator it = m_resourceTimingInfoMap.find(resour
ce); |
804 if (it != m_resourceTimingInfoMap.end()) { | 802 if (it != m_resourceTimingInfoMap.end()) { |
805 OwnPtr<ResourceTimingInfo> info = it->value.release(); | 803 OwnPtr<ResourceTimingInfo> info = it->value.release(); |
806 m_resourceTimingInfoMap.remove(it); | 804 m_resourceTimingInfoMap.remove(it); |
807 populateResourceTiming(info.get(), resource, false); | 805 populateResourceTiming(info.get(), resource, false); |
808 context().addResourceTiming(*info); | 806 if (resource->options().requestInitiatorContext == DocumentContext) |
| 807 context().addResourceTiming(*info); |
| 808 else |
| 809 resource->reportResourceTiming(*info); |
809 } | 810 } |
810 } | 811 } |
811 context().dispatchDidFinishLoading(resource->identifier(), finishTime, encod
edDataLength); | 812 context().dispatchDidFinishLoading(resource->identifier(), finishTime, encod
edDataLength); |
812 } | 813 } |
813 | 814 |
814 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc
eLoadPriority loadPriority, int intraPriorityValue) | 815 void ResourceFetcher::didChangeLoadingPriority(const Resource* resource, Resourc
eLoadPriority loadPriority, int intraPriorityValue) |
815 { | 816 { |
816 TRACE_EVENT_ASYNC_STEP_INTO1("blink.net", "Resource", resource, "ChangePrior
ity", "priority", loadPriority); | 817 TRACE_EVENT_ASYNC_STEP_INTO1("blink.net", "Resource", resource, "ChangePrior
ity", "priority", loadPriority); |
817 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio
rity, intraPriorityValue); | 818 context().dispatchDidChangeResourcePriority(resource->identifier(), loadPrio
rity, intraPriorityValue); |
818 } | 819 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 | 1053 |
1053 DEFINE_TRACE(ResourceFetcher) | 1054 DEFINE_TRACE(ResourceFetcher) |
1054 { | 1055 { |
1055 visitor->trace(m_context); | 1056 visitor->trace(m_context); |
1056 visitor->trace(m_archiveResourceCollection); | 1057 visitor->trace(m_archiveResourceCollection); |
1057 visitor->trace(m_loaders); | 1058 visitor->trace(m_loaders); |
1058 visitor->trace(m_nonBlockingLoaders); | 1059 visitor->trace(m_nonBlockingLoaders); |
1059 } | 1060 } |
1060 | 1061 |
1061 } | 1062 } |
OLD | NEW |