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

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

Issue 2572373003: Loading: pass minimum information to Resource::resourceTypeToString() (Closed)
Patch Set: Created 4 years 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
Index: third_party/WebKit/Source/core/fetch/Resource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp
index 44b796f177b03c83f4d636175169ae649d575155..51cf394787d79888d0851e9327d9967536005c3d 100644
--- a/third_party/WebKit/Source/core/fetch/Resource.cpp
+++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -54,6 +54,7 @@
#include <algorithm>
#include <memory>
#include <stdint.h>
+#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
namespace blink {
@@ -924,7 +925,8 @@ void Resource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail,
String Resource::getMemoryDumpName() const {
return String::format(
"web_cache/%s_resources/%ld",
- resourceTypeToString(getType(), options().initiatorInfo), m_identifier);
+ resourceTypeToString(getType(), options().initiatorInfo.name),
+ m_identifier);
}
void Resource::setCachePolicyBypassingCache() {
@@ -1047,12 +1049,16 @@ static const char* initatorTypeNameToString(
if (initiatorTypeName == FetchInitiatorTypeNames::xmlhttprequest)
return "XMLHttpRequest";
+ static_assert(
+ FetchInitiatorTypeNames::FetchInitiatorTypeNamesCount == 12,
+ "New FetchInitiatorTypeNames should be handled correctly here.");
+
return "Resource";
}
const char* Resource::resourceTypeToString(
Type type,
- const FetchInitiatorInfo& initiatorInfo) {
+ const AtomicString& fetchInitiatorName) {
switch (type) {
case Resource::MainResource:
return "Main resource";
@@ -1065,7 +1071,7 @@ const char* Resource::resourceTypeToString(
case Resource::Font:
return "Font";
case Resource::Raw:
- return initatorTypeNameToString(initiatorInfo.name);
+ return initatorTypeNameToString(fetchInitiatorName);
case Resource::SVGDocument:
return "SVG document";
case Resource::XSLStyleSheet:
@@ -1084,7 +1090,7 @@ const char* Resource::resourceTypeToString(
return "Mock";
}
NOTREACHED();
- return initatorTypeNameToString(initiatorInfo.name);
+ return initatorTypeNameToString(fetchInitiatorName);
}
bool Resource::shouldBlockLoadEvent() const {
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698