Remove base::StackString.

This was only used in one place and it turns out that StackString was
broken on Windows anyway due to the way that STL reserves buffers.

BUG=709273

Review-Url: https://codereview.chromium.org/2817223002
Cr-Original-Commit-Position: refs/heads/master@{#464764}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: eacc100de55e5b286aa8548b22c99c815cd69486
diff --git a/tools/gn/escape.cc b/tools/gn/escape.cc
index 5f27523..84928ef 100644
--- a/tools/gn/escape.cc
+++ b/tools/gn/escape.cc
@@ -6,7 +6,6 @@
 
 #include <stddef.h>
 
-#include "base/containers/stack_container.h"
 #include "base/logging.h"
 #include "build/build_config.h"
 
@@ -35,25 +34,22 @@
 // Ninja's escaping rules are very simple. We always escape colons even
 // though they're OK in many places, in case the resulting string is used on
 // the left-hand-side of a rule.
-template<typename DestString>
-inline void NinjaEscapeChar(char ch, DestString* dest) {
+inline void NinjaEscapeChar(char ch, std::string* dest) {
   if (ch == '$' || ch == ' ' || ch == ':')
     dest->push_back('$');
   dest->push_back(ch);
 }
 
-template<typename DestString>
 void EscapeStringToString_Ninja(const base::StringPiece& str,
                                 const EscapeOptions& options,
-                                DestString* dest,
+                                std::string* dest,
                                 bool* needed_quoting) {
   for (const auto& elem : str)
     NinjaEscapeChar(elem, dest);
 }
 
-template<typename DestString>
 void EscapeStringToString_NinjaPreformatted(const base::StringPiece& str,
-                                            DestString* dest) {
+                                            std::string* dest) {
   // Only Ninja-escape $.
   for (const auto& elem : str) {
     if (elem == '$')
@@ -70,10 +66,9 @@
 // See:
 //   http://blogs.msdn.com/b/twistylittlepassagesallalike/archive/2011/04/23/everyone-quotes-arguments-the-wrong-way.aspx
 //   http://blogs.msdn.com/b/oldnewthing/archive/2010/09/17/10063629.aspx
-template<typename DestString>
 void EscapeStringToString_WindowsNinjaFork(const base::StringPiece& str,
                                            const EscapeOptions& options,
-                                           DestString* dest,
+                                           std::string* dest,
                                            bool* needed_quoting) {
   // We assume we don't have any whitespace chars that aren't spaces.
   DCHECK(str.find_first_of("\r\n\v\t") == std::string::npos);
@@ -116,10 +111,9 @@
   }
 }
 
-template<typename DestString>
 void EscapeStringToString_PosixNinjaFork(const base::StringPiece& str,
                                          const EscapeOptions& options,
-                                         DestString* dest,
+                                         std::string* dest,
                                          bool* needed_quoting) {
   for (const auto& elem : str) {
     if (elem == '$' || elem == ' ') {
@@ -145,10 +139,9 @@
   }
 }
 
-template<typename DestString>
 void EscapeStringToString(const base::StringPiece& str,
                           const EscapeOptions& options,
-                          DestString* dest,
+                          std::string* dest,
                           bool* needed_quoting) {
   switch (options.mode) {
     case ESCAPE_NONE:
@@ -202,8 +195,8 @@
 void EscapeStringToStream(std::ostream& out,
                           const base::StringPiece& str,
                           const EscapeOptions& options) {
-  base::StackString<256> escaped;
-  EscapeStringToString(str, options, &escaped.container(), nullptr);
-  if (!escaped->empty())
-    out.write(escaped->data(), escaped->size());
+  std::string escaped;
+  EscapeStringToString(str, options, &escaped, nullptr);
+  if (!escaped.empty())
+    out.write(escaped.data(), escaped.size());
 }