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 /webkit | |
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 'webkit')
-rw-r--r-- | webkit/plugins/ppapi/message_channel.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/ppapi/npapi_glue.cc | 9 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_flash_impl_linux.cc | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_font_impl.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_transport_impl.cc | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_uma_private_impl.cc | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_url_request_info_impl.cc | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_url_util_impl.cc | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_var_impl.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/ppapi/resource_creation_impl.cc | 4 |
12 files changed, 25 insertions, 26 deletions
diff --git a/webkit/plugins/ppapi/message_channel.cc b/webkit/plugins/ppapi/message_channel.cc index 71368a6..33eacfa 100644 --- a/webkit/plugins/ppapi/message_channel.cc +++ b/webkit/plugins/ppapi/message_channel.cc @@ -69,7 +69,7 @@ bool PPVarToNPVariantNoCopy(PP_Var var, NPVariant* result) { DOUBLE_TO_NPVARIANT(var.value.as_double, *result); break; case PP_VARTYPE_STRING: { - scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); + StringVar* string = StringVar::FromPPVar(var); if (!string) { VOID_TO_NPVARIANT(*result); return false; @@ -102,7 +102,7 @@ PP_Var CopyPPVar(const PP_Var& var) { NOTIMPLEMENTED(); return PP_MakeUndefined(); } else if (var.type == PP_VARTYPE_STRING) { - scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); + StringVar* string = StringVar::FromPPVar(var); if (!string) return PP_MakeUndefined(); return StringVar::StringToPPVar(string->pp_module(), string->value()); diff --git a/webkit/plugins/ppapi/npapi_glue.cc b/webkit/plugins/ppapi/npapi_glue.cc index 7e90a1e..cdb49d5 100644 --- a/webkit/plugins/ppapi/npapi_glue.cc +++ b/webkit/plugins/ppapi/npapi_glue.cc @@ -50,7 +50,7 @@ bool PPVarToNPVariant(PP_Var var, NPVariant* result) { DOUBLE_TO_NPVARIANT(var.value.as_double, *result); break; case PP_VARTYPE_STRING: { - scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); + StringVar* string = StringVar::FromPPVar(var); if (!string) { VOID_TO_NPVARIANT(*result); return false; @@ -106,7 +106,7 @@ PP_Var NPVariantToPPVar(PluginInstance* instance, const NPVariant* variant) { NPIdentifier PPVarToNPIdentifier(PP_Var var) { switch (var.type) { case PP_VARTYPE_STRING: { - scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); + StringVar* string = StringVar::FromPPVar(var); if (!string) return NULL; return WebBindings::getStringIdentifier(string->value().c_str()); @@ -216,10 +216,9 @@ void PPResultAndExceptionToNPResult::IgnoreException() { // Throws the current exception to JS. The exception must be set. void PPResultAndExceptionToNPResult::ThrowException() { - scoped_refptr<StringVar> string(StringVar::FromPPVar(exception_)); - if (string) { + StringVar* string = StringVar::FromPPVar(exception_); + if (string) WebBindings::setException(object_var_, string->value().c_str()); - } } // PPVarArrayFromNPVariantArray ------------------------------------------------ diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index 3270297..52b1eac 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -604,7 +604,7 @@ string16 PluginInstance::GetSelectedText(bool html) { PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), PP_FromBool(html)); - scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); + StringVar* string = StringVar::FromPPVar(rv); // Release the ref the plugin transfered to us. ResourceTracker::Get()->GetVarTracker()->ReleaseVar(rv); if (!string) @@ -622,7 +622,7 @@ string16 PluginInstance::GetLinkAtPosition(const gfx::Point& point) { p.x = point.x(); p.y = point.y(); PP_Var rv = plugin_pdf_interface_->GetLinkAtPosition(pp_instance(), p); - scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); + StringVar* string = StringVar::FromPPVar(rv); // Release the ref the plugin transfered to us. ResourceTracker::Get()->GetVarTracker()->ReleaseVar(rv); if (!string) @@ -1438,7 +1438,7 @@ PP_Var PluginInstance::ExecuteScript(PP_Instance instance, return PP_MakeUndefined(); // Convert the script into an inconvenient NPString object. - scoped_refptr<StringVar> script_string(StringVar::FromPPVar(script)); + StringVar* script_string = StringVar::FromPPVar(script); if (!script_string) { try_catch.SetException("Script param to ExecuteScript must be a string."); return PP_MakeUndefined(); diff --git a/webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc b/webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc index b35391a..4d4647c 100644 --- a/webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc +++ b/webkit/plugins/ppapi/ppb_flash_clipboard_impl.cc @@ -99,7 +99,7 @@ PP_Var ReadPlainText(PP_Instance instance_id, int32_t WritePlainText(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, PP_Var text) { - scoped_refptr<StringVar> text_string(StringVar::FromPPVar(text)); + StringVar* text_string = StringVar::FromPPVar(text); if (!text_string) return PP_ERROR_BADARGUMENT; diff --git a/webkit/plugins/ppapi/ppb_flash_impl_linux.cc b/webkit/plugins/ppapi/ppb_flash_impl_linux.cc index 36739a4..a4f4d4a 100644 --- a/webkit/plugins/ppapi/ppb_flash_impl_linux.cc +++ b/webkit/plugins/ppapi/ppb_flash_impl_linux.cc @@ -46,7 +46,7 @@ PP_Bool PPB_Flash_Impl::DrawGlyphs(PP_Instance, return PP_FALSE; // Set up the typeface. - scoped_refptr<StringVar> face_name(StringVar::FromPPVar(font_desc->face)); + StringVar* face_name = StringVar::FromPPVar(font_desc->face); if (!face_name) return PP_FALSE; int style = SkTypeface::kNormal; diff --git a/webkit/plugins/ppapi/ppb_font_impl.cc b/webkit/plugins/ppapi/ppb_font_impl.cc index fbbddea..8db4ed6 100644 --- a/webkit/plugins/ppapi/ppb_font_impl.cc +++ b/webkit/plugins/ppapi/ppb_font_impl.cc @@ -30,7 +30,7 @@ namespace { // False means the input was invalid. bool PPTextRunToTextRun(const PP_TextRun_Dev* run, WebKitForwarding::Font::TextRun* output) { - scoped_refptr<StringVar> text_string(StringVar::FromPPVar(run->text)); + StringVar* text_string = StringVar::FromPPVar(run->text); if (!text_string) return false; @@ -45,7 +45,7 @@ bool PPTextRunToTextRun(const PP_TextRun_Dev* run, PPB_Font_Impl::PPB_Font_Impl(PluginInstance* instance, const PP_FontDescription_Dev& desc) : Resource(instance) { - scoped_refptr<StringVar> face_name(StringVar::FromPPVar(desc.face)); + StringVar* face_name = StringVar::FromPPVar(desc.face); WebKitForwarding::Font* result = NULL; instance->module()->GetWebKitForwarding()->CreateFontForwarding( diff --git a/webkit/plugins/ppapi/ppb_transport_impl.cc b/webkit/plugins/ppapi/ppb_transport_impl.cc index 55a46e8..3048c60 100644 --- a/webkit/plugins/ppapi/ppb_transport_impl.cc +++ b/webkit/plugins/ppapi/ppb_transport_impl.cc @@ -142,7 +142,7 @@ int32_t PPB_Transport_Impl::ReceiveRemoteAddress(PP_Var address) { if (!p2p_transport_.get()) return PP_ERROR_FAILED; - scoped_refptr<StringVar> address_str = StringVar::FromPPVar(address); + StringVar* address_str = StringVar::FromPPVar(address); if (!address_str) return PP_ERROR_BADARGUMENT; diff --git a/webkit/plugins/ppapi/ppb_uma_private_impl.cc b/webkit/plugins/ppapi/ppb_uma_private_impl.cc index 10807cb..ec85c16 100644 --- a/webkit/plugins/ppapi/ppb_uma_private_impl.cc +++ b/webkit/plugins/ppapi/ppb_uma_private_impl.cc @@ -33,7 +33,7 @@ void HistogramCustomTimes(PP_Var name, uint32_t bucket_count) { RETURN_IF_BAD_ARGS(name, sample, min, max, bucket_count); - scoped_refptr<StringVar> name_string(StringVar::FromPPVar(name)); + StringVar* name_string = StringVar::FromPPVar(name); if (name_string == NULL) return; base::Histogram* counter = @@ -52,7 +52,7 @@ void HistogramCustomCounts(PP_Var name, uint32_t bucket_count) { RETURN_IF_BAD_ARGS(name, sample, min, max, bucket_count); - scoped_refptr<StringVar> name_string(StringVar::FromPPVar(name)); + StringVar* name_string = StringVar::FromPPVar(name); if (name_string == NULL) return; base::Histogram* counter = @@ -70,7 +70,7 @@ void HistogramEnumeration(PP_Var name, int32_t boundary_value) { RETURN_IF_BAD_ARGS(name, sample, 1, boundary_value, boundary_value + 1); - scoped_refptr<StringVar> name_string(StringVar::FromPPVar(name)); + StringVar* name_string = StringVar::FromPPVar(name); if (name_string == NULL) return; base::Histogram* counter = diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc index 8820a41..1b72319 100644 --- a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc @@ -220,7 +220,7 @@ PP_Bool PPB_URLRequestInfo_Impl::SetProperty(PP_URLRequestProperty property, SetIntegerProperty(property, var.value.as_int)); break; case PP_VARTYPE_STRING: { - scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); + StringVar* string = StringVar::FromPPVar(var); if (string) result = PP_FromBool(SetStringProperty(property, string->value())); break; diff --git a/webkit/plugins/ppapi/ppb_url_util_impl.cc b/webkit/plugins/ppapi/ppb_url_util_impl.cc index 1900731..429cbe6 100644 --- a/webkit/plugins/ppapi/ppb_url_util_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_util_impl.cc @@ -33,7 +33,7 @@ namespace { // Returns the PP_Module associated with the given string, or 0 on failure. PP_Module GetModuleFromVar(PP_Var string_var) { - scoped_refptr<StringVar> str(StringVar::FromPPVar(string_var)); + StringVar* str = StringVar::FromPPVar(string_var); if (!str) return 0; return str->pp_module(); @@ -72,7 +72,7 @@ PP_Var ResolveRelativeToDocument(PP_Instance instance_id, if (!instance) return PP_MakeNull(); - scoped_refptr<StringVar> relative_string(StringVar::FromPPVar(relative)); + StringVar* relative_string = StringVar::FromPPVar(relative); if (!relative_string) return PP_MakeNull(); @@ -89,7 +89,7 @@ PP_Bool IsSameSecurityOrigin(PP_Var url_a, PP_Var url_b) { } PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) { - scoped_refptr<StringVar> url_string(StringVar::FromPPVar(url)); + StringVar* url_string = StringVar::FromPPVar(url); if (!url_string) return PP_FALSE; diff --git a/webkit/plugins/ppapi/ppb_var_impl.cc b/webkit/plugins/ppapi/ppb_var_impl.cc index 160b972..384d449 100644 --- a/webkit/plugins/ppapi/ppb_var_impl.cc +++ b/webkit/plugins/ppapi/ppb_var_impl.cc @@ -68,7 +68,7 @@ bool PPVarToNPVariantNoCopy(PP_Var var, NPVariant* result) { DOUBLE_TO_NPVARIANT(var.value.as_double, *result); break; case PP_VARTYPE_STRING: { - scoped_refptr<StringVar> string(StringVar::FromPPVar(var)); + StringVar* string = StringVar::FromPPVar(var); if (!string) { VOID_TO_NPVARIANT(*result); return false; @@ -182,7 +182,7 @@ PP_Var VarFromUtf8(PP_Module module, const char* data, uint32_t len) { } const char* VarToUtf8(PP_Var var, uint32_t* len) { - scoped_refptr<StringVar> str(StringVar::FromPPVar(var)); + StringVar* str = StringVar::FromPPVar(var); if (!str) { *len = 0; return NULL; diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc index 0aafe50..6ecde57 100644 --- a/webkit/plugins/ppapi/resource_creation_impl.cc +++ b/webkit/plugins/ppapi/resource_creation_impl.cc @@ -197,8 +197,8 @@ PP_Resource ResourceCreationImpl::CreateKeyboardInputEvent( data.event_modifiers = modifiers; data.key_code = key_code; if (character_text.type == PP_VARTYPE_STRING) { - scoped_refptr<StringVar> string_var(StringVar::FromPPVar(character_text)); - if (!string_var.get()) + StringVar* string_var = StringVar::FromPPVar(character_text); + if (!string_var) return 0; data.character_text = string_var->value(); } |