| OLD | NEW | 
|   1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |   1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 
|   2 // Use of this source code is governed by a BSD-style license that can be |   2 // Use of this source code is governed by a BSD-style license that can be | 
|   3 // found in the LICENSE file. |   3 // found in the LICENSE file. | 
|   4  |   4  | 
 |   5 #include <ostream> | 
 |   6  | 
|   5 #include "tools/gn/escape.h" |   7 #include "tools/gn/escape.h" | 
|   6  |   8  | 
|   7 #include "base/containers/stack_container.h" |   9 #include "base/containers/stack_container.h" | 
|   8  |  10  | 
|   9 namespace { |  11 namespace { | 
|  10  |  12  | 
|  11 template<typename DestString> |  13 template<typename DestString> | 
|  12 void EscapeStringToString(const base::StringPiece& str, |  14 void EscapeStringToString(const base::StringPiece& str, | 
|  13                           const EscapeOptions& options, |  15                           const EscapeOptions& options, | 
|  14                           DestString* dest, |  16                           DestString* dest, | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  81 void EscapeStringToStream(std::ostream& out, |  83 void EscapeStringToStream(std::ostream& out, | 
|  82                           const base::StringPiece& str, |  84                           const base::StringPiece& str, | 
|  83                           const EscapeOptions& options) { |  85                           const EscapeOptions& options) { | 
|  84   // Escape to a stack buffer and then write out to the stream. |  86   // Escape to a stack buffer and then write out to the stream. | 
|  85   base::StackVector<char, 256> result; |  87   base::StackVector<char, 256> result; | 
|  86   result->reserve(str.size() + 4);  // Guess we'll add a couple of extra chars. |  88   result->reserve(str.size() + 4);  // Guess we'll add a couple of extra chars. | 
|  87   EscapeStringToString(str, options, &result.container(), NULL); |  89   EscapeStringToString(str, options, &result.container(), NULL); | 
|  88   if (!result->empty()) |  90   if (!result->empty()) | 
|  89     out.write(result->data(), result->size()); |  91     out.write(result->data(), result->size()); | 
|  90 } |  92 } | 
| OLD | NEW |