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

Unified Diff: gin/converter.h

Issue 93813002: Implement gin::ObjectTemplateBuilder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asdf 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') | no next file with comments »
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 4ff7043059706944fc4b6b46115bb541032b877f..d10f315d1a303b2616e99353f5821537935753ed 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);
@@ -164,12 +172,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698