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
rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
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 |
11 version 2 of the License, or (at your option) any later version. | 11 version 2 of the License, or (at your option) any later version. |
12 | 12 |
13 This library is distributed in the hope that it will be useful, | 13 This library is distributed in the hope that it will be useful, |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 Library General Public License for more details. | 16 Library General Public License for more details. |
17 | 17 |
18 You should have received a copy of the GNU Library General Public License | 18 You should have received a copy of the GNU Library General Public License |
19 along with this library; see the file COPYING.LIB. If not, write to | 19 along with this library; see the file COPYING.LIB. If not, write to |
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 Boston, MA 02110-1301, USA. | 21 Boston, MA 02110-1301, USA. |
22 */ | 22 */ |
23 | 23 |
24 #include "config.h" | 24 #include "config.h" |
25 #include "core/fetch/Resource.h" | 25 #include "core/fetch/Resource.h" |
26 | 26 |
| 27 #include "FetchInitiatorTypeNames.h" |
27 #include "core/fetch/CachedMetadata.h" | 28 #include "core/fetch/CachedMetadata.h" |
28 #include "core/fetch/CrossOriginAccessControl.h" | 29 #include "core/fetch/CrossOriginAccessControl.h" |
29 #include "core/fetch/MemoryCache.h" | 30 #include "core/fetch/MemoryCache.h" |
30 #include "core/fetch/ResourceClient.h" | 31 #include "core/fetch/ResourceClient.h" |
31 #include "core/fetch/ResourceClientWalker.h" | 32 #include "core/fetch/ResourceClientWalker.h" |
32 #include "core/fetch/ResourceFetcher.h" | 33 #include "core/fetch/ResourceFetcher.h" |
33 #include "core/fetch/ResourceLoader.h" | 34 #include "core/fetch/ResourceLoader.h" |
34 #include "core/fetch/ResourcePtr.h" | 35 #include "core/fetch/ResourcePtr.h" |
35 #include "core/inspector/InspectorInstrumentation.h" | 36 #include "core/inspector/InspectorInstrumentation.h" |
36 #include "platform/Logging.h" | 37 #include "platform/Logging.h" |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 { | 884 { |
884 HashSet<Resource*>::iterator end = m_resourcesWithPendingClients.end(); | 885 HashSet<Resource*>::iterator end = m_resourcesWithPendingClients.end(); |
885 Vector<ResourcePtr<Resource> > resources; | 886 Vector<ResourcePtr<Resource> > resources; |
886 for (HashSet<Resource*>::iterator it = m_resourcesWithPendingClients.begin()
; it != end; ++it) | 887 for (HashSet<Resource*>::iterator it = m_resourcesWithPendingClients.begin()
; it != end; ++it) |
887 resources.append(*it); | 888 resources.append(*it); |
888 m_resourcesWithPendingClients.clear(); | 889 m_resourcesWithPendingClients.clear(); |
889 for (size_t i = 0; i < resources.size(); i++) | 890 for (size_t i = 0; i < resources.size(); i++) |
890 resources[i]->finishPendingClients(); | 891 resources[i]->finishPendingClients(); |
891 } | 892 } |
892 | 893 |
| 894 static const char* initatorTypeNameToString(const AtomicString& initiatorTypeNam
e) |
| 895 { |
| 896 if (initiatorTypeName == FetchInitiatorTypeNames::css) |
| 897 return "CSS resource"; |
| 898 if (initiatorTypeName == FetchInitiatorTypeNames::document) |
| 899 return "Document"; |
| 900 if (initiatorTypeName == FetchInitiatorTypeNames::icon) |
| 901 return "Icon"; |
| 902 if (initiatorTypeName == FetchInitiatorTypeNames::internal) |
| 903 return "Internal resource"; |
| 904 if (initiatorTypeName == FetchInitiatorTypeNames::link) |
| 905 return "Link element resource"; |
| 906 if (initiatorTypeName == FetchInitiatorTypeNames::processinginstruction) |
| 907 return "Processing instruction"; |
| 908 if (initiatorTypeName == FetchInitiatorTypeNames::texttrack) |
| 909 return "Text track"; |
| 910 if (initiatorTypeName == FetchInitiatorTypeNames::xml) |
| 911 return "XML resource"; |
| 912 if (initiatorTypeName == FetchInitiatorTypeNames::xmlhttprequest) |
| 913 return "XMLHttpRequest"; |
| 914 |
| 915 return "Resource"; |
| 916 } |
| 917 |
| 918 const char* Resource::resourceTypeToString(Type type, const FetchInitiatorInfo&
initiatorInfo) |
| 919 { |
| 920 switch (type) { |
| 921 case Resource::MainResource: |
| 922 return "Main resource"; |
| 923 case Resource::Image: |
| 924 return "Image"; |
| 925 case Resource::CSSStyleSheet: |
| 926 return "CSS stylesheet"; |
| 927 case Resource::Script: |
| 928 return "Script"; |
| 929 case Resource::Font: |
| 930 return "Font"; |
| 931 case Resource::Raw: |
| 932 return initatorTypeNameToString(initiatorInfo.name); |
| 933 case Resource::SVGDocument: |
| 934 return "SVG document"; |
| 935 case Resource::XSLStyleSheet: |
| 936 return "XSL stylesheet"; |
| 937 case Resource::LinkPrefetch: |
| 938 return "Link prefetch resource"; |
| 939 case Resource::LinkSubresource: |
| 940 return "Link subresource"; |
| 941 case Resource::TextTrack: |
| 942 return "Text track"; |
| 943 case Resource::Shader: |
| 944 return "Shader"; |
| 945 case Resource::ImportResource: |
| 946 return "Imported resource"; |
| 947 } |
| 948 ASSERT_NOT_REACHED(); |
| 949 return initatorTypeNameToString(initiatorInfo.name); |
| 950 } |
| 951 |
893 #if !LOG_DISABLED | 952 #if !LOG_DISABLED |
894 const char* ResourceTypeName(Resource::Type type) | 953 const char* ResourceTypeName(Resource::Type type) |
895 { | 954 { |
896 switch (type) { | 955 switch (type) { |
897 case Resource::MainResource: | 956 case Resource::MainResource: |
898 return "MainResource"; | 957 return "MainResource"; |
899 case Resource::Image: | 958 case Resource::Image: |
900 return "Image"; | 959 return "Image"; |
901 case Resource::CSSStyleSheet: | 960 case Resource::CSSStyleSheet: |
902 return "CSSStyleSheet"; | 961 return "CSSStyleSheet"; |
(...skipping 17 matching lines...) Expand all Loading... |
920 return "Shader"; | 979 return "Shader"; |
921 case Resource::ImportResource: | 980 case Resource::ImportResource: |
922 return "ImportResource"; | 981 return "ImportResource"; |
923 } | 982 } |
924 ASSERT_NOT_REACHED(); | 983 ASSERT_NOT_REACHED(); |
925 return "Unknown"; | 984 return "Unknown"; |
926 } | 985 } |
927 #endif // !LOG_DISABLED | 986 #endif // !LOG_DISABLED |
928 | 987 |
929 } | 988 } |
OLD | NEW |