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

Unified Diff: ppapi/shared_impl/var.h

Issue 9316123: Remove special handling for strings in var serialization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months 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
Index: ppapi/shared_impl/var.h
diff --git a/ppapi/shared_impl/var.h b/ppapi/shared_impl/var.h
index ed7f4f135bbfcd04322e036840dbedcf2bbfa19d..d8084d795331a83242d328cd050a120aef463eda 100644
--- a/ppapi/shared_impl/var.h
+++ b/ppapi/shared_impl/var.h
@@ -94,7 +94,6 @@ class PPAPI_SHARED_EXPORT StringVar : public Var {
public:
StringVar(const std::string& str);
StringVar(const char* str, uint32 len);
- StringVar(scoped_ptr<std::string> str);
virtual ~StringVar();
const std::string& value() const { return value_; }
@@ -117,13 +116,19 @@ class PPAPI_SHARED_EXPORT StringVar : public Var {
// create a StringVar and return the reference to it in the var.
static PP_Var StringToPPVar(const std::string& str);
static PP_Var StringToPPVar(const char* str, uint32 len);
- static PP_Var StringToPPVar(scoped_ptr<std::string> str);
+
+ // Same as StringToPPVar but avoids a copy by destructively swapping the
+ // given string into the newly created StringVar. The string must already be
+ // valid UTF-8. After the call, *src will be empty.
+ static PP_Var SwapValidatedUTF8StringIntoPPVar(std::string* src);
// Helper function that converts a PP_Var to a string. This will return NULL
// if the PP_Var is not of string type or the string is invalid.
static StringVar* FromPPVar(PP_Var var);
private:
+ StringVar(); // Makes an empty string.
+
std::string value_;
DISALLOW_COPY_AND_ASSIGN(StringVar);

Powered by Google App Engine
This is Rietveld 408576698