Index: gin/converter.h |
diff --git a/gin/converter.h b/gin/converter.h |
index e36977f6bc0542ea9608b9a83791b5d3493a73f5..e6f25ed9d0fded9489dbef9c5e631152c4f7e959 100644 |
--- a/gin/converter.h |
+++ b/gin/converter.h |
@@ -8,6 +8,7 @@ |
#include <string> |
#include <vector> |
+#include "base/strings/string_piece.h" |
#include "v8/include/v8.h" |
namespace gin { |
@@ -72,6 +73,13 @@ struct Converter<double> { |
}; |
template<> |
+struct Converter<base::StringPiece> { |
+ static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, |
+ const base::StringPiece& val); |
+ // No conversion out is possible because StringPiece does not contain storage. |
+}; |
+ |
+template<> |
struct Converter<std::string> { |
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, |
const std::string& val); |
@@ -163,12 +171,12 @@ v8::Handle<v8::Value> ConvertToV8(v8::Isolate* isolate, |
} |
inline v8::Handle<v8::String> StringToV8(v8::Isolate* isolate, |
- std::string input) { |
+ const base::StringPiece& input) { |
return ConvertToV8(isolate, input).As<v8::String>(); |
} |
v8::Handle<v8::String> StringToSymbol(v8::Isolate* isolate, |
- const std::string& val); |
+ const base::StringPiece& val); |
template<typename T> |
bool ConvertFromV8(v8::Isolate* isolate, v8::Handle<v8::Value> input, |