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) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
7 rights reserved. | 7 rights reserved. |
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 24 matching lines...) Expand all Loading... |
35 #include "core/fetch/ResourceLoader.h" | 35 #include "core/fetch/ResourceLoader.h" |
36 #include "platform/Histogram.h" | 36 #include "platform/Histogram.h" |
37 #include "platform/InstanceCounters.h" | 37 #include "platform/InstanceCounters.h" |
38 #include "platform/RuntimeEnabledFeatures.h" | 38 #include "platform/RuntimeEnabledFeatures.h" |
39 #include "platform/SharedBuffer.h" | 39 #include "platform/SharedBuffer.h" |
40 #include "platform/WebTaskRunner.h" | 40 #include "platform/WebTaskRunner.h" |
41 #include "platform/network/HTTPParsers.h" | 41 #include "platform/network/HTTPParsers.h" |
42 #include "platform/tracing/TraceEvent.h" | 42 #include "platform/tracing/TraceEvent.h" |
43 #include "platform/weborigin/KURL.h" | 43 #include "platform/weborigin/KURL.h" |
44 #include "public/platform/Platform.h" | 44 #include "public/platform/Platform.h" |
45 #include "public/platform/WebCachePolicy.h" | |
46 #include "public/platform/WebScheduler.h" | 45 #include "public/platform/WebScheduler.h" |
47 #include "public/platform/WebSecurityOrigin.h" | 46 #include "public/platform/WebSecurityOrigin.h" |
48 #include "wtf/CurrentTime.h" | 47 #include "wtf/CurrentTime.h" |
49 #include "wtf/MathExtras.h" | 48 #include "wtf/MathExtras.h" |
50 #include "wtf/StdLibExtras.h" | 49 #include "wtf/StdLibExtras.h" |
51 #include "wtf/Vector.h" | 50 #include "wtf/Vector.h" |
52 #include "wtf/text/CString.h" | 51 #include "wtf/text/CString.h" |
53 #include "wtf/text/StringBuilder.h" | 52 #include "wtf/text/StringBuilder.h" |
54 #include <algorithm> | 53 #include <algorithm> |
55 #include <memory> | 54 #include <memory> |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 m_data.clear(); | 402 m_data.clear(); |
404 m_encodedSizeMemoryUsage = 0; | 403 m_encodedSizeMemoryUsage = 0; |
405 } | 404 } |
406 | 405 |
407 void Resource::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy) { | 406 void Resource::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy) { |
408 m_options.dataBufferingPolicy = dataBufferingPolicy; | 407 m_options.dataBufferingPolicy = dataBufferingPolicy; |
409 clearData(); | 408 clearData(); |
410 setEncodedSize(0); | 409 setEncodedSize(0); |
411 } | 410 } |
412 | 411 |
413 void Resource::error(const ResourceError& error) { | 412 void Resource::error(const ResourceError& error, |
| 413 ResourceFetcher* fetcherForReload) { |
414 DCHECK(!error.isNull()); | 414 DCHECK(!error.isNull()); |
415 m_error = error; | 415 m_error = error; |
416 m_isRevalidating = false; | 416 m_isRevalidating = false; |
417 | 417 |
418 if (m_error.isCancellation() || !isPreloaded()) | 418 if (m_error.isCancellation() || !isPreloaded()) |
419 memoryCache()->remove(this); | 419 memoryCache()->remove(this); |
420 | 420 |
421 if (!errorOccurred()) | 421 if (!errorOccurred()) |
422 setStatus(LoadError); | 422 setStatus(LoadError); |
423 DCHECK(errorOccurred()); | 423 DCHECK(errorOccurred()); |
424 clearData(); | 424 clearData(); |
425 m_loader = nullptr; | 425 m_loader = nullptr; |
426 checkNotify(); | 426 checkNotify(); |
427 } | 427 } |
428 | 428 |
429 void Resource::finish(double loadFinishTime) { | 429 void Resource::finish(double loadFinishTime, |
| 430 ResourceFetcher* fetcherForReload) { |
430 DCHECK(!m_isRevalidating); | 431 DCHECK(!m_isRevalidating); |
431 m_loadFinishTime = loadFinishTime; | 432 m_loadFinishTime = loadFinishTime; |
432 if (!errorOccurred()) | 433 if (!errorOccurred()) |
433 m_status = Cached; | 434 m_status = Cached; |
434 m_loader = nullptr; | 435 m_loader = nullptr; |
435 checkNotify(); | 436 checkNotify(); |
436 } | 437 } |
437 | 438 |
438 AtomicString Resource::httpContentType() const { | 439 AtomicString Resource::httpContentType() const { |
439 return extractMIMETypeFromMediaType( | 440 return extractMIMETypeFromMediaType( |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 memoryDump->addSuballocation( | 921 memoryDump->addSuballocation( |
921 overheadDump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); | 922 overheadDump->guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); |
922 } | 923 } |
923 | 924 |
924 String Resource::getMemoryDumpName() const { | 925 String Resource::getMemoryDumpName() const { |
925 return String::format( | 926 return String::format( |
926 "web_cache/%s_resources/%ld", | 927 "web_cache/%s_resources/%ld", |
927 resourceTypeToString(getType(), options().initiatorInfo), m_identifier); | 928 resourceTypeToString(getType(), options().initiatorInfo), m_identifier); |
928 } | 929 } |
929 | 930 |
930 void Resource::setCachePolicyBypassingCache() { | |
931 m_resourceRequest.setCachePolicy(WebCachePolicy::BypassingCache); | |
932 } | |
933 | |
934 void Resource::setLoFiStateOff() { | |
935 m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff); | |
936 } | |
937 | |
938 void Resource::clearRangeRequestHeader() { | |
939 m_resourceRequest.clearHTTPHeaderField("range"); | |
940 } | |
941 | |
942 void Resource::revalidationSucceeded( | 931 void Resource::revalidationSucceeded( |
943 const ResourceResponse& validatingResponse) { | 932 const ResourceResponse& validatingResponse) { |
944 SECURITY_CHECK(m_redirectChain.isEmpty()); | 933 SECURITY_CHECK(m_redirectChain.isEmpty()); |
945 SECURITY_CHECK(equalIgnoringFragmentIdentifier(validatingResponse.url(), | 934 SECURITY_CHECK(equalIgnoringFragmentIdentifier(validatingResponse.url(), |
946 m_response.url())); | 935 m_response.url())); |
947 m_response.setResourceLoadTiming(validatingResponse.resourceLoadTiming()); | 936 m_response.setResourceLoadTiming(validatingResponse.resourceLoadTiming()); |
948 | 937 |
949 // RFC2616 10.3.5 | 938 // RFC2616 10.3.5 |
950 // Update cached headers from the 304 response | 939 // Update cached headers from the 304 response |
951 const HTTPHeaderMap& newHeaders = validatingResponse.httpHeaderFields(); | 940 const HTTPHeaderMap& newHeaders = validatingResponse.httpHeaderFields(); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 case Resource::TextTrack: | 1094 case Resource::TextTrack: |
1106 case Resource::Media: | 1095 case Resource::Media: |
1107 case Resource::Manifest: | 1096 case Resource::Manifest: |
1108 return false; | 1097 return false; |
1109 } | 1098 } |
1110 NOTREACHED(); | 1099 NOTREACHED(); |
1111 return false; | 1100 return false; |
1112 } | 1101 } |
1113 | 1102 |
1114 } // namespace blink | 1103 } // namespace blink |
OLD | NEW |