tools/gn: make use of base's StartsWith() function

Since Brett introduced this funtion to base, we can make use of it and
remove our copy from gn. We are also making use of it in other five
files already.

BUG=None
TEST=gn gen + gn_unittests
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1481403006

Cr-Original-Commit-Position: refs/heads/master@{#362446}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 934d88d64c50f9f4d684194320cf15cd9b29059e
diff --git a/tools/gn/c_include_iterator.cc b/tools/gn/c_include_iterator.cc
index 120295e..bb43803 100644
--- a/tools/gn/c_include_iterator.cc
+++ b/tools/gn/c_include_iterator.cc
@@ -17,12 +17,6 @@
   INCLUDE_USER     // #include "..."
 };
 
-// Returns true if str starts with the prefix.
-bool StartsWith(const base::StringPiece& str, const base::StringPiece& prefix) {
-  base::StringPiece extracted = str.substr(0, prefix.size());
-  return extracted == prefix;
-}
-
 // Returns a new string piece referencing the same buffer as the argument, but
 // with leading space trimmed. This only checks for space and tab characters
 // since we're dealing with lines in C source files.
@@ -46,11 +40,12 @@
 // We assume the line has leading whitespace trimmed. We also assume that empty
 // lines have already been filtered out.
 bool ShouldCountTowardNonIncludeLines(const base::StringPiece& line) {
-  if (StartsWith(line, "//"))
+  if (base::StartsWith(line, "//", base::CompareCase::SENSITIVE))
     return false;  // Don't count comments.
-  if (StartsWith(line, "/*") || StartsWith(line, " *"))
+  if (base::StartsWith(line, "/*", base::CompareCase::SENSITIVE) ||
+      base::StartsWith(line, " *", base::CompareCase::SENSITIVE))
     return false;  // C-style comment blocks with stars along the left side.
-  if (StartsWith(line, "#"))
+  if (base::StartsWith(line, "#", base::CompareCase::SENSITIVE))
     return false;  // Don't count preprocessor.
   if (base::ContainsOnlyChars(line, base::kWhitespaceASCII))
     return false;  // Don't count whitespace lines.
@@ -76,9 +71,11 @@
     return INCLUDE_NONE;
 
   base::StringPiece contents;
-  if (StartsWith(trimmed, base::StringPiece(kInclude, kIncludeLen)))
+  if (base::StartsWith(trimmed, base::StringPiece(kInclude, kIncludeLen),
+                       base::CompareCase::SENSITIVE))
     contents = TrimLeadingWhitespace(trimmed.substr(kIncludeLen));
-  else if (StartsWith(trimmed, base::StringPiece(kImport, kImportLen)))
+  else if (base::StartsWith(trimmed, base::StringPiece(kImport, kImportLen),
+                            base::CompareCase::SENSITIVE))
     contents = TrimLeadingWhitespace(trimmed.substr(kImportLen));
 
   if (contents.empty())