Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(580)

Unified Diff: Source/core/fetch/Resource.cpp

Issue 137983010: (Re)organize handling of CORS access control during resource loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: HTMLImportLoader no longer needs a ResourceFetcher Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/Resource.h ('k') | Source/core/fetch/ResourceFetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/Resource.cpp
diff --git a/Source/core/fetch/Resource.cpp b/Source/core/fetch/Resource.cpp
index c969058fcb8a5124be5c3d30b229ca4bcaaacb31..ae71c68721e467705bf50ccd42ed85d38d0e31b2 100644
--- a/Source/core/fetch/Resource.cpp
+++ b/Source/core/fetch/Resource.cpp
@@ -24,6 +24,7 @@
#include "config.h"
#include "core/fetch/Resource.h"
+#include "FetchInitiatorTypeNames.h"
#include "core/fetch/CachedMetadata.h"
#include "core/fetch/CrossOriginAccessControl.h"
#include "core/fetch/MemoryCache.h"
@@ -890,6 +891,64 @@ void Resource::ResourceCallback::timerFired(Timer<ResourceCallback>*)
resources[i]->finishPendingClients();
}
+static const char* initatorTypeNameToString(const AtomicString& initiatorTypeName)
+{
+ if (initiatorTypeName == FetchInitiatorTypeNames::css)
+ return "CSS resource";
+ if (initiatorTypeName == FetchInitiatorTypeNames::document)
+ return "Document";
+ if (initiatorTypeName == FetchInitiatorTypeNames::icon)
+ return "Icon";
+ if (initiatorTypeName == FetchInitiatorTypeNames::internal)
+ return "Internal resource";
+ if (initiatorTypeName == FetchInitiatorTypeNames::link)
+ return "Link element resource";
+ if (initiatorTypeName == FetchInitiatorTypeNames::processinginstruction)
+ return "Processing instruction";
+ if (initiatorTypeName == FetchInitiatorTypeNames::texttrack)
+ return "Text track";
+ if (initiatorTypeName == FetchInitiatorTypeNames::xml)
+ return "XML resource";
+ if (initiatorTypeName == FetchInitiatorTypeNames::xmlhttprequest)
+ return "XMLHttpRequest";
+
+ return "Resource";
+}
+
+const char* Resource::resourceTypeToString(Type type, const FetchInitiatorInfo& initiatorInfo)
+{
+ switch (type) {
+ case Resource::MainResource:
+ return "Main resource";
+ case Resource::Image:
+ return "Image";
+ case Resource::CSSStyleSheet:
+ return "CSS stylesheet";
+ case Resource::Script:
+ return "Script";
+ case Resource::Font:
+ return "Font";
+ case Resource::Raw:
+ return initatorTypeNameToString(initiatorInfo.name);
+ case Resource::SVGDocument:
+ return "SVG document";
+ case Resource::XSLStyleSheet:
+ return "XSL stylesheet";
+ case Resource::LinkPrefetch:
+ return "Link prefetch resource";
+ case Resource::LinkSubresource:
+ return "Link subresource";
+ case Resource::TextTrack:
+ return "Text track";
+ case Resource::Shader:
+ return "Shader";
+ case Resource::ImportResource:
+ return "Imported resource";
+ }
+ ASSERT_NOT_REACHED();
+ return initatorTypeNameToString(initiatorInfo.name);
+}
+
#if !LOG_DISABLED
const char* ResourceTypeName(Resource::Type type)
{
« no previous file with comments | « Source/core/fetch/Resource.h ('k') | Source/core/fetch/ResourceFetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698