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

Unified Diff: third_party/WebKit/Source/core/loader/LinkLoader.cpp

Issue 2035263002: Extract SourceLocation for ConsoleMessages on call sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2037593004
Patch Set: Created 4 years, 6 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
Index: third_party/WebKit/Source/core/loader/LinkLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/LinkLoader.cpp b/third_party/WebKit/Source/core/loader/LinkLoader.cpp
index fb6549e54502baa420190857417aa49970623f6a..1cd7380a3305e00d9d441460bfffd93e257f4f3c 100644
--- a/third_party/WebKit/Source/core/loader/LinkLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/LinkLoader.cpp
@@ -31,6 +31,7 @@
#include "core/loader/LinkLoader.h"
+#include "bindings/core/v8/SourceLocation.h"
#include "core/css/MediaList.h"
#include "core/css/MediaQueryEvaluator.h"
#include "core/dom/Document.h"
@@ -147,7 +148,7 @@ static void dnsPrefetchIfNeeded(const LinkRelAttribute& relAttribute, const KURL
// to complete that as URL <https://bugs.webkit.org/show_bug.cgi?id=48857>.
if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && !href.isEmpty()) {
if (settings->logDnsPrefetchAndPreconnect())
- document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("DNS prefetch triggered for " + href.host())));
+ document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("DNS prefetch triggered for " + href.host()), SourceLocation::capture(&document)));
networkHintsInterface.dnsPrefetchHost(href.host());
}
}
@@ -162,10 +163,11 @@ static void preconnectIfNeeded(const LinkRelAttribute& relAttribute, const KURL&
ASSERT(RuntimeEnabledFeatures::linkPreconnectEnabled());
Settings* settings = document.settings();
if (settings && settings->logDnsPrefetchAndPreconnect()) {
- document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("Preconnect triggered for ") + href.getString()));
+ document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("Preconnect triggered for ") + href.getString(), SourceLocation::capture(&document)));
if (crossOrigin != CrossOriginAttributeNotSet) {
document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel,
- String("Preconnect CORS setting is ") + String((crossOrigin == CrossOriginAttributeAnonymous) ? "anonymous" : "use-credentials")));
+ String("Preconnect CORS setting is ") + String((crossOrigin == CrossOriginAttributeAnonymous) ? "anonymous" : "use-credentials"),
+ SourceLocation::capture(&document)));
}
}
networkHintsInterface.preconnectHost(href, crossOrigin);
@@ -258,7 +260,7 @@ static Resource* preloadIfNeeded(const LinkRelAttribute& relAttribute, const KUR
UseCounter::count(document, UseCounter::LinkRelPreload);
ASSERT(RuntimeEnabledFeatures::linkPreloadEnabled());
if (!href.isValid() || href.isEmpty()) {
- document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, WarningMessageLevel, String("<link rel=preload> has an invalid `href` value")));
+ document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, WarningMessageLevel, String("<link rel=preload> has an invalid `href` value"), SourceLocation::capture(&document)));
return nullptr;
}
@@ -277,13 +279,13 @@ static Resource* preloadIfNeeded(const LinkRelAttribute& relAttribute, const KUR
UseCounter::count(document, UseCounter::LinkHeaderPreload);
Resource::Type resourceType;
if (!LinkLoader::getResourceTypeFromAsAttribute(as, resourceType)) {
- document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, WarningMessageLevel, String("<link rel=preload> must have a valid `as` value")));
+ document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, WarningMessageLevel, String("<link rel=preload> must have a valid `as` value"), SourceLocation::capture(&document)));
errorOccurred = true;
return nullptr;
}
if (!isSupportedType(resourceType, mimeType)) {
- document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, WarningMessageLevel, String("<link rel=preload> has an unsupported `type` value")));
+ document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, WarningMessageLevel, String("<link rel=preload> has an unsupported `type` value"), SourceLocation::capture(&document)));
return nullptr;
}
ResourceRequest resourceRequest(document.completeURL(href));
@@ -294,7 +296,7 @@ static Resource* preloadIfNeeded(const LinkRelAttribute& relAttribute, const KUR
linkRequest.setCrossOriginAccessControl(document.getSecurityOrigin(), crossOrigin);
Settings* settings = document.settings();
if (settings && settings->logPreload())
- document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("Preload triggered for " + href.host() + href.path())));
+ document.addConsoleMessage(ConsoleMessage::create(OtherMessageSource, DebugMessageLevel, String("Preload triggered for " + href.host() + href.path()), SourceLocation::capture(&document)));
linkRequest.setForPreload(true, monotonicallyIncreasingTime());
linkRequest.setLinkPreload(true);
linkRequest.setPriority(document.fetcher()->loadPriority(resourceType, linkRequest));
« no previous file with comments | « third_party/WebKit/Source/core/loader/HttpEquiv.cpp ('k') | third_party/WebKit/Source/core/loader/MixedContentChecker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698