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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 #include "public/platform/WebSecurityOrigin.h" | 47 #include "public/platform/WebSecurityOrigin.h" |
48 #include "wtf/CurrentTime.h" | 48 #include "wtf/CurrentTime.h" |
49 #include "wtf/MathExtras.h" | 49 #include "wtf/MathExtras.h" |
50 #include "wtf/StdLibExtras.h" | 50 #include "wtf/StdLibExtras.h" |
51 #include "wtf/Vector.h" | 51 #include "wtf/Vector.h" |
52 #include "wtf/text/CString.h" | 52 #include "wtf/text/CString.h" |
53 #include "wtf/text/StringBuilder.h" | 53 #include "wtf/text/StringBuilder.h" |
54 #include <algorithm> | 54 #include <algorithm> |
55 #include <memory> | 55 #include <memory> |
56 #include <stdint.h> | 56 #include <stdint.h> |
57 #include <type_traits> | |
Yoav Weiss
2016/12/15 14:53:54
Why is this header needed?
Takashi Toyoshima
2016/12/19 05:47:48
Oh, I mistakenly use this but the right header for
| |
57 | 58 |
58 namespace blink { | 59 namespace blink { |
59 | 60 |
60 // These response headers are not copied from a revalidated response to the | 61 // These response headers are not copied from a revalidated response to the |
61 // cached response headers. For compatibility, this list is based on Chromium's | 62 // cached response headers. For compatibility, this list is based on Chromium's |
62 // net/http/http_response_headers.cc. | 63 // net/http/http_response_headers.cc. |
63 const char* const headersToIgnoreAfterRevalidation[] = { | 64 const char* const headersToIgnoreAfterRevalidation[] = { |
64 "allow", | 65 "allow", |
65 "connection", | 66 "connection", |
66 "etag", | 67 "etag", |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
917 WebMemoryAllocatorDump* overheadDump = | 918 WebMemoryAllocatorDump* overheadDump = |
918 memoryDump->createMemoryAllocatorDump(overheadName); | 919 memoryDump->createMemoryAllocatorDump(overheadName); |
919 overheadDump->addScalar("size", "bytes", overheadSize()); | 920 overheadDump->addScalar("size", "bytes", overheadSize()); |
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.name), |
929 m_identifier); | |
928 } | 930 } |
929 | 931 |
930 void Resource::setCachePolicyBypassingCache() { | 932 void Resource::setCachePolicyBypassingCache() { |
931 m_resourceRequest.setCachePolicy(WebCachePolicy::BypassingCache); | 933 m_resourceRequest.setCachePolicy(WebCachePolicy::BypassingCache); |
932 } | 934 } |
933 | 935 |
934 void Resource::setLoFiStateOff() { | 936 void Resource::setLoFiStateOff() { |
935 m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff); | 937 m_resourceRequest.setLoFiState(WebURLRequest::LoFiOff); |
936 } | 938 } |
937 | 939 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1019 m_resourceRequest.url().getString().length() * 2; | 1021 m_resourceRequest.url().getString().length() * 2; |
1020 } | 1022 } |
1021 | 1023 |
1022 void Resource::didChangePriority(ResourceLoadPriority loadPriority, | 1024 void Resource::didChangePriority(ResourceLoadPriority loadPriority, |
1023 int intraPriorityValue) { | 1025 int intraPriorityValue) { |
1024 m_resourceRequest.setPriority(loadPriority, intraPriorityValue); | 1026 m_resourceRequest.setPriority(loadPriority, intraPriorityValue); |
1025 if (m_loader) | 1027 if (m_loader) |
1026 m_loader->didChangePriority(loadPriority, intraPriorityValue); | 1028 m_loader->didChangePriority(loadPriority, intraPriorityValue); |
1027 } | 1029 } |
1028 | 1030 |
1029 static const char* initatorTypeNameToString( | 1031 static const char* initatorTypeNameToString( |
yhirano
2016/12/19 06:23:08
Not related to this change but this name should be
Takashi Toyoshima
2016/12/19 06:59:01
Done.
| |
1030 const AtomicString& initiatorTypeName) { | 1032 const AtomicString& initiatorTypeName) { |
1031 if (initiatorTypeName == FetchInitiatorTypeNames::css) | 1033 if (initiatorTypeName == FetchInitiatorTypeNames::css) |
1032 return "CSS resource"; | 1034 return "CSS resource"; |
1033 if (initiatorTypeName == FetchInitiatorTypeNames::document) | 1035 if (initiatorTypeName == FetchInitiatorTypeNames::document) |
1034 return "Document"; | 1036 return "Document"; |
1035 if (initiatorTypeName == FetchInitiatorTypeNames::icon) | 1037 if (initiatorTypeName == FetchInitiatorTypeNames::icon) |
1036 return "Icon"; | 1038 return "Icon"; |
1037 if (initiatorTypeName == FetchInitiatorTypeNames::internal) | 1039 if (initiatorTypeName == FetchInitiatorTypeNames::internal) |
1038 return "Internal resource"; | 1040 return "Internal resource"; |
1039 if (initiatorTypeName == FetchInitiatorTypeNames::link) | 1041 if (initiatorTypeName == FetchInitiatorTypeNames::link) |
1040 return "Link element resource"; | 1042 return "Link element resource"; |
1041 if (initiatorTypeName == FetchInitiatorTypeNames::processinginstruction) | 1043 if (initiatorTypeName == FetchInitiatorTypeNames::processinginstruction) |
1042 return "Processing instruction"; | 1044 return "Processing instruction"; |
1043 if (initiatorTypeName == FetchInitiatorTypeNames::texttrack) | 1045 if (initiatorTypeName == FetchInitiatorTypeNames::texttrack) |
1044 return "Text track"; | 1046 return "Text track"; |
1045 if (initiatorTypeName == FetchInitiatorTypeNames::xml) | 1047 if (initiatorTypeName == FetchInitiatorTypeNames::xml) |
1046 return "XML resource"; | 1048 return "XML resource"; |
1047 if (initiatorTypeName == FetchInitiatorTypeNames::xmlhttprequest) | 1049 if (initiatorTypeName == FetchInitiatorTypeNames::xmlhttprequest) |
1048 return "XMLHttpRequest"; | 1050 return "XMLHttpRequest"; |
1049 | 1051 |
1052 static_assert( | |
1053 FetchInitiatorTypeNames::FetchInitiatorTypeNamesCount == 12, | |
1054 "New FetchInitiatorTypeNames should be handled correctly here."); | |
1055 | |
1050 return "Resource"; | 1056 return "Resource"; |
1051 } | 1057 } |
1052 | 1058 |
1053 const char* Resource::resourceTypeToString( | 1059 const char* Resource::resourceTypeToString( |
1054 Type type, | 1060 Type type, |
1055 const FetchInitiatorInfo& initiatorInfo) { | 1061 const AtomicString& fetchInitiatorName) { |
1056 switch (type) { | 1062 switch (type) { |
1057 case Resource::MainResource: | 1063 case Resource::MainResource: |
1058 return "Main resource"; | 1064 return "Main resource"; |
1059 case Resource::Image: | 1065 case Resource::Image: |
1060 return "Image"; | 1066 return "Image"; |
1061 case Resource::CSSStyleSheet: | 1067 case Resource::CSSStyleSheet: |
1062 return "CSS stylesheet"; | 1068 return "CSS stylesheet"; |
1063 case Resource::Script: | 1069 case Resource::Script: |
1064 return "Script"; | 1070 return "Script"; |
1065 case Resource::Font: | 1071 case Resource::Font: |
1066 return "Font"; | 1072 return "Font"; |
1067 case Resource::Raw: | 1073 case Resource::Raw: |
1068 return initatorTypeNameToString(initiatorInfo.name); | 1074 return initatorTypeNameToString(fetchInitiatorName); |
1069 case Resource::SVGDocument: | 1075 case Resource::SVGDocument: |
1070 return "SVG document"; | 1076 return "SVG document"; |
1071 case Resource::XSLStyleSheet: | 1077 case Resource::XSLStyleSheet: |
1072 return "XSL stylesheet"; | 1078 return "XSL stylesheet"; |
1073 case Resource::LinkPrefetch: | 1079 case Resource::LinkPrefetch: |
1074 return "Link prefetch resource"; | 1080 return "Link prefetch resource"; |
1075 case Resource::TextTrack: | 1081 case Resource::TextTrack: |
1076 return "Text track"; | 1082 return "Text track"; |
1077 case Resource::ImportResource: | 1083 case Resource::ImportResource: |
1078 return "Imported resource"; | 1084 return "Imported resource"; |
1079 case Resource::Media: | 1085 case Resource::Media: |
1080 return "Media"; | 1086 return "Media"; |
1081 case Resource::Manifest: | 1087 case Resource::Manifest: |
1082 return "Manifest"; | 1088 return "Manifest"; |
1083 case Resource::Mock: | 1089 case Resource::Mock: |
1084 return "Mock"; | 1090 return "Mock"; |
1085 } | 1091 } |
1086 NOTREACHED(); | 1092 NOTREACHED(); |
1087 return initatorTypeNameToString(initiatorInfo.name); | 1093 return initatorTypeNameToString(fetchInitiatorName); |
1088 } | 1094 } |
1089 | 1095 |
1090 bool Resource::shouldBlockLoadEvent() const { | 1096 bool Resource::shouldBlockLoadEvent() const { |
1091 return !m_linkPreload && isLoadEventBlockingResourceType(); | 1097 return !m_linkPreload && isLoadEventBlockingResourceType(); |
1092 } | 1098 } |
1093 | 1099 |
1094 bool Resource::isLoadEventBlockingResourceType() const { | 1100 bool Resource::isLoadEventBlockingResourceType() const { |
1095 switch (m_type) { | 1101 switch (m_type) { |
1096 case Resource::MainResource: | 1102 case Resource::MainResource: |
1097 case Resource::Image: | 1103 case Resource::Image: |
(...skipping 10 matching lines...) Expand all Loading... | |
1108 case Resource::Media: | 1114 case Resource::Media: |
1109 case Resource::Manifest: | 1115 case Resource::Manifest: |
1110 case Resource::Mock: | 1116 case Resource::Mock: |
1111 return false; | 1117 return false; |
1112 } | 1118 } |
1113 NOTREACHED(); | 1119 NOTREACHED(); |
1114 return false; | 1120 return false; |
1115 } | 1121 } |
1116 | 1122 |
1117 } // namespace blink | 1123 } // namespace blink |
OLD | NEW |