diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-22 22:15:58 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-22 22:15:58 +0000 |
commit | 28cfaed056451113a72ce00603848f4a6dd616bb (patch) | |
tree | c5de865eb7de9ea487b9af79dac9c9d363ba2876 /ppapi/shared_impl | |
parent | bacf470d2cd46c0d3b145675e471ab9c6976cee8 (diff) | |
download | chromium_src-28cfaed056451113a72ce00603848f4a6dd616bb.zip chromium_src-28cfaed056451113a72ce00603848f4a6dd616bb.tar.gz chromium_src-28cfaed056451113a72ce00603848f4a6dd616bb.tar.bz2 |
Don't use a scoped_refptr for StringVar::FromPPVar
This was leftover from a previous design where I thought it would be
necessary. It turns out it just made the code ugly and did unnecessary
refcounting.
Review URL: http://codereview.chromium.org/7621054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97751 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r-- | ppapi/shared_impl/url_util_impl.cc | 10 | ||||
-rw-r--r-- | ppapi/shared_impl/var.cc | 10 | ||||
-rw-r--r-- | ppapi/shared_impl/var.h | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/ppapi/shared_impl/url_util_impl.cc b/ppapi/shared_impl/url_util_impl.cc index 66a6185..ddad401 100644 --- a/ppapi/shared_impl/url_util_impl.cc +++ b/ppapi/shared_impl/url_util_impl.cc @@ -44,7 +44,7 @@ void ConvertComponents(const url_parse::Parsed& input, PP_Var URLUtilImpl::Canonicalize(PP_Module pp_module, PP_Var url, PP_URLComponents_Dev* components) { - scoped_refptr<StringVar> url_string(StringVar::FromPPVar(url)); + StringVar* url_string = StringVar::FromPPVar(url); if (!url_string) return PP_MakeNull(); return GenerateURLReturn(pp_module, GURL(url_string->value()), components); @@ -55,8 +55,8 @@ PP_Var URLUtilImpl::ResolveRelativeToURL(PP_Module pp_module, PP_Var base_url, PP_Var relative, PP_URLComponents_Dev* components) { - scoped_refptr<StringVar> base_url_string(StringVar::FromPPVar(base_url)); - scoped_refptr<StringVar> relative_string(StringVar::FromPPVar(relative)); + StringVar* base_url_string = StringVar::FromPPVar(base_url); + StringVar* relative_string = StringVar::FromPPVar(relative); if (!base_url_string || !relative_string) return PP_MakeNull(); @@ -70,8 +70,8 @@ PP_Var URLUtilImpl::ResolveRelativeToURL(PP_Module pp_module, // static PP_Bool URLUtilImpl::IsSameSecurityOrigin(PP_Var url_a, PP_Var url_b) { - scoped_refptr<StringVar> url_a_string(StringVar::FromPPVar(url_a)); - scoped_refptr<StringVar> url_b_string(StringVar::FromPPVar(url_b)); + StringVar* url_a_string = StringVar::FromPPVar(url_a); + StringVar* url_b_string = StringVar::FromPPVar(url_b); if (!url_a_string || !url_b_string) return PP_FALSE; diff --git a/ppapi/shared_impl/var.cc b/ppapi/shared_impl/var.cc index af63b0b..0542e50 100644 --- a/ppapi/shared_impl/var.cc +++ b/ppapi/shared_impl/var.cc @@ -37,7 +37,7 @@ std::string Var::PPVarToLogString(PP_Var var) { case PP_VARTYPE_DOUBLE: return base::DoubleToString(var.value.as_double); case PP_VARTYPE_STRING: { - scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); + StringVar* string(StringVar::FromPPVar(var)); if (!string) return "[Invalid string]"; @@ -139,14 +139,14 @@ PP_Var StringVar::StringToPPVar(PP_Module module, } // static -scoped_refptr<StringVar> StringVar::FromPPVar(PP_Var var) { +StringVar* StringVar::FromPPVar(PP_Var var) { if (var.type != PP_VARTYPE_STRING) - return scoped_refptr<StringVar>(); + return NULL; scoped_refptr<Var> var_object( TrackerBase::Get()->GetVarTracker()->GetVar(var)); if (!var_object) - return scoped_refptr<StringVar>(); - return scoped_refptr<StringVar>(var_object->AsStringVar()); + return NULL; + return var_object->AsStringVar(); } } // namespace ppapi diff --git a/ppapi/shared_impl/var.h b/ppapi/shared_impl/var.h index 1ff42dd..02553bb 100644 --- a/ppapi/shared_impl/var.h +++ b/ppapi/shared_impl/var.h @@ -84,7 +84,7 @@ class Var : public base::RefCounted<Var> { // return StringVar::StringToPPVar(module, my_string); // // Converting a PP_Var to a string: -// scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); +// StringVar* string = StringVar::FromPPVar(var); // if (!string) // return false; // Not a string or an invalid var. // DoSomethingWithTheString(string->value()); @@ -112,7 +112,7 @@ class StringVar : public Var { // 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 scoped_refptr<StringVar> FromPPVar(PP_Var var); + static StringVar* FromPPVar(PP_Var var); private: std::string value_; |