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

Unified Diff: third_party/WebKit/Source/platform/exported/WebURL.cpp

Issue 2537323002: Optimize WebURL::protocolIs (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/exported/WebURL.cpp
diff --git a/third_party/WebKit/Source/platform/exported/WebURL.cpp b/third_party/WebKit/Source/platform/exported/WebURL.cpp
index e3a5804264785fe36755f1bb6250d7561069e1c4..5e0c99e10053e4b89ece8f21bb4c6b125976b022 100644
--- a/third_party/WebKit/Source/platform/exported/WebURL.cpp
+++ b/third_party/WebKit/Source/platform/exported/WebURL.cpp
@@ -31,11 +31,15 @@
#include "public/platform/WebURL.h"
#include "platform/weborigin/KURL.h"
+#include "wtf/text/StringView.h"
namespace blink {
bool WebURL::protocolIs(const char* protocol) const {
- return ::blink::protocolIs(m_string, protocol);
+ const url::Component& scheme = m_parsed.scheme;
+ StringView urlView = m_string;
+ // For subtlety why this works in all cases, see KURL::componentString.
+ return m_isValid && StringView(urlView, scheme.begin, scheme.len) == protocol;
}
WebURL::WebURL(const KURL& url)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698