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

Unified Diff: gin/converter.h

Issue 93813002: Implement gin::ObjectTemplateBuilder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « no previous file | gin/converter.cc » ('j') | gin/function_template.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « no previous file | gin/converter.cc » ('j') | gin/function_template.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698