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

Unified Diff: net/base/sdch_dictionary.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan 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 | « net/base/sdch_dictionary.h ('k') | net/base/sdch_dictionary_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/sdch_dictionary.cc
diff --git a/net/base/sdch_dictionary.cc b/net/base/sdch_dictionary.cc
index b8faf552390601da1e31dfe13d229ab60cded96e..4cef2bdabe9b20a8795be48f0512460de62a8b2e 100644
--- a/net/base/sdch_dictionary.cc
+++ b/net/base/sdch_dictionary.cc
@@ -4,6 +4,7 @@
#include "net/base/sdch_dictionary.h"
+#include "base/strings/string_util.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/values.h"
@@ -140,8 +141,8 @@ SdchProblemCode SdchDictionary::CanUse(const GURL& target_url) const {
}
// static
-bool SdchDictionary::PathMatch(const std::string& path,
- const std::string& restriction) {
+bool SdchDictionary::PathMatch(const base::StringPiece& path,
+ const base::StringPiece& restriction) {
/* Must be either:
* 1. P2 is equal to P1
* 2. P2 is a prefix of P1 and either the final character in P2 is "/"
@@ -152,7 +153,7 @@ bool SdchDictionary::PathMatch(const std::string& path,
size_t prefix_length = restriction.size();
if (prefix_length > path.size())
return false; // Can't be a prefix.
- if (0 != path.compare(0, prefix_length, restriction))
+ if (!base::StartsWith(path, restriction, base::CompareCase::SENSITIVE))
return false;
return restriction[prefix_length - 1] == '/' || path[prefix_length] == '/';
}
« no previous file with comments | « net/base/sdch_dictionary.h ('k') | net/base/sdch_dictionary_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698