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/proxy | |
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/proxy')
-rw-r--r-- | ppapi/proxy/plugin_var_serialization_rules.cc | 8 | ||||
-rw-r--r-- | ppapi/proxy/ppb_font_proxy.cc | 6 | ||||
-rw-r--r-- | ppapi/proxy/ppb_url_util_proxy.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/ppb_var_deprecated_proxy.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/ppb_var_proxy.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/ppp_messaging_proxy_test.cc | 6 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.cc | 2 |
7 files changed, 14 insertions, 14 deletions
diff --git a/ppapi/proxy/plugin_var_serialization_rules.cc b/ppapi/proxy/plugin_var_serialization_rules.cc index f514773..49e1fc3 100644 --- a/ppapi/proxy/plugin_var_serialization_rules.cc +++ b/ppapi/proxy/plugin_var_serialization_rules.cc @@ -28,8 +28,8 @@ PP_Var PluginVarSerializationRules::SendCallerOwned(const PP_Var& var, // Retrieve the string to use for IPC. if (var.type == PP_VARTYPE_STRING) { - scoped_refptr<StringVar> string_var(StringVar::FromPPVar(var)); - if (string_var.get()) + StringVar* string_var = StringVar::FromPPVar(var); + if (string_var) *str_val = string_var->value(); else NOTREACHED() << "Trying to send unknown string over IPC."; @@ -116,8 +116,8 @@ PP_Var PluginVarSerializationRules::BeginSendPassRef(const PP_Var& var, return var_tracker_->GetHostObject(var); if (var.type == PP_VARTYPE_STRING) { - scoped_refptr<StringVar> string_var(StringVar::FromPPVar(var)); - if (string_var.get()) + StringVar* string_var = StringVar::FromPPVar(var); + if (string_var) *str_val = string_var->value(); else NOTREACHED() << "Trying to send unknown string over IPC."; diff --git a/ppapi/proxy/ppb_font_proxy.cc b/ppapi/proxy/ppb_font_proxy.cc index 987c918..3c42ecd 100644 --- a/ppapi/proxy/ppb_font_proxy.cc +++ b/ppapi/proxy/ppb_font_proxy.cc @@ -30,7 +30,7 @@ namespace { bool PPTextRunToTextRun(const PP_TextRun_Dev* run, WebKitForwarding::Font::TextRun* output) { - scoped_refptr<StringVar> str(StringVar::FromPPVar(run->text)); + StringVar* str = StringVar::FromPPVar(run->text); if (!str) return false; @@ -97,7 +97,7 @@ Font::Font(const HostResource& resource, : Resource(resource), webkit_event_(false, false) { TRACE_EVENT0("ppapi proxy", "Font::Font"); - scoped_refptr<StringVar> face(StringVar::FromPPVar(desc.face)); + StringVar* face = StringVar::FromPPVar(desc.face); PluginDispatcher* dispatcher = PluginDispatcher::GetForResource(this); WebKitForwarding* forwarding = dispatcher->GetWebKitForwarding(); @@ -106,7 +106,7 @@ Font::Font(const HostResource& resource, base::Bind(&WebKitForwarding::CreateFontForwarding, base::Unretained(forwarding), &webkit_event_, desc, - face.get() ? face->value() : std::string(), + face ? face->value() : std::string(), dispatcher->preferences(), &font_forwarding_)); } diff --git a/ppapi/proxy/ppb_url_util_proxy.cc b/ppapi/proxy/ppb_url_util_proxy.cc index 7490a10..a202038 100644 --- a/ppapi/proxy/ppb_url_util_proxy.cc +++ b/ppapi/proxy/ppb_url_util_proxy.cc @@ -36,7 +36,7 @@ PP_Var ConvertComponentsAndReturnURL(PP_Var url, if (!components) return url; // Common case - plugin doesn't care about parsing. - scoped_refptr<StringVar> url_string(StringVar::FromPPVar(url)); + StringVar* url_string = StringVar::FromPPVar(url); if (!url_string) return url; diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc index ff32df1..396e50e 100644 --- a/ppapi/proxy/ppb_var_deprecated_proxy.cc +++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc @@ -70,7 +70,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 = static_cast<uint32_t>(str->value().size()); return str->value().c_str(); diff --git a/ppapi/proxy/ppb_var_proxy.cc b/ppapi/proxy/ppb_var_proxy.cc index 645e554..765deef 100644 --- a/ppapi/proxy/ppb_var_proxy.cc +++ b/ppapi/proxy/ppb_var_proxy.cc @@ -30,7 +30,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 = static_cast<uint32_t>(str->value().size()); return str->value().c_str(); diff --git a/ppapi/proxy/ppp_messaging_proxy_test.cc b/ppapi/proxy/ppp_messaging_proxy_test.cc index 839a7ef..25c7e55 100644 --- a/ppapi/proxy/ppp_messaging_proxy_test.cc +++ b/ppapi/proxy/ppp_messaging_proxy_test.cc @@ -128,13 +128,13 @@ TEST_F(PPP_Messaging_ProxyTest, SendMessages) { EXPECT_EQ(expected_instance, received_instance); EXPECT_EQ(expected_var.type, received_var.type); - scoped_refptr<StringVar> received_string(StringVar::FromPPVar(received_var)); - ASSERT_TRUE(received_string.get()); + StringVar* received_string = StringVar::FromPPVar(received_var); + ASSERT_TRUE(received_string); EXPECT_EQ(kTestString, received_string->value()); // Now release the var, and the string should go away (because the ref // count should be one). plugin().var_tracker().ReleaseVar(received_var); - EXPECT_FALSE(StringVar::FromPPVar(received_var).get()); + EXPECT_FALSE(StringVar::FromPPVar(received_var)); } } // namespace proxy diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc index bc9d0e8..c6d02a7e 100644 --- a/ppapi/proxy/resource_creation_proxy.cc +++ b/ppapi/proxy/resource_creation_proxy.cc @@ -211,7 +211,7 @@ PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent( data.event_modifiers = modifiers; data.key_code = key_code; if (character_text.type == PP_VARTYPE_STRING) { - scoped_refptr<StringVar> text_str(StringVar::FromPPVar(character_text)); + StringVar* text_str = StringVar::FromPPVar(character_text); if (!text_str) return 0; data.character_text = text_str->value(); |