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

Unified Diff: third_party/WebKit/Source/core/frame/History.cpp

Issue 2304023002: Use StringView in History.cpp (Closed)
Patch Set: Created 4 years, 3 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 | « 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/core/frame/History.cpp
diff --git a/third_party/WebKit/Source/core/frame/History.cpp b/third_party/WebKit/Source/core/frame/History.cpp
index 2f53a1724e1926700f2c4a94998bb268ffbf913d..5ba75592c16764d0288d589daf26002355868b5b 100644
--- a/third_party/WebKit/Source/core/frame/History.cpp
+++ b/third_party/WebKit/Source/core/frame/History.cpp
@@ -37,6 +37,7 @@
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/weborigin/KURL.h"
#include "platform/weborigin/SecurityOrigin.h"
+#include "wtf/text/StringView.h"
namespace blink {
@@ -44,36 +45,12 @@ namespace {
bool equalIgnoringPathQueryAndFragment(const KURL& a, const KURL& b)
{
- int aLength = a.pathStart();
- int bLength = b.pathStart();
-
- if (aLength != bLength)
- return false;
-
- const String& aString = a.getString();
- const String& bString = b.getString();
- for (int i = 0; i < aLength; ++i) {
- if (aString[i] != bString[i])
- return false;
- }
- return true;
+ return StringView(a.getString(), 0, a.pathStart()) == StringView(b.getString(), 0, b.pathStart());
}
bool equalIgnoringQueryAndFragment(const KURL& a, const KURL& b)
{
- int aLength = a.pathEnd();
- int bLength = b.pathEnd();
-
- if (aLength != bLength)
- return false;
-
- const String& aString = a.getString();
- const String& bString = b.getString();
- for (int i = 0; i < aLength; ++i) {
- if (aString[i] != bString[i])
- return false;
- }
- return true;
+ return StringView(a.getString(), 0, a.pathEnd()) == StringView(b.getString(), 0, b.pathEnd());
}
} // namespace
« 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