summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl/url_util_impl.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-09 23:14:13 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-09 23:14:13 +0000
commit2bbd2c670008e30aaaef6c3c25ae37e0c17f8c3f (patch)
tree79595eeb026dd29841a7380fd7753f992c2e466b /ppapi/shared_impl/url_util_impl.cc
parent32131b9030d8313f7adc9b765f706ffbee7ca709 (diff)
downloadchromium_src-2bbd2c670008e30aaaef6c3c25ae37e0c17f8c3f.zip
chromium_src-2bbd2c670008e30aaaef6c3c25ae37e0c17f8c3f.tar.gz
chromium_src-2bbd2c670008e30aaaef6c3c25ae37e0c17f8c3f.tar.bz2
Unify var tracking between webkit and the proxy.
This replaces the var tracking in the proxy with the var tracking in the shared_impl that's used by the implementation. It adds a new ProxyObjectVar to be the proxied plugin analog of NPObjectVar in the impl. This new object just keeps track of the host data. The tricky part is to make the var tracker able to do all the crazy messaging. This adds some virtual functions to the shared var tracker that we override in the plugin in PluginVarTracker. This removes the calls to the GetLiveObjectsForInstance in the var deprecated test. It turns out this function really can't be implemented properly in the proxy, and I don't know why it even worked before. A Release() call posts a non-nestable task so the object isn't released until later. So to implement the proxy for GetLiveObjectsForInstance we would also need to post a non-nestable task. But when the test runs we're getting called from within the plugin, so blocking on a non-nestable task deadlocks. So I just gave up and deleted the parts of the test that uses it. TEST=included BUG=none Review URL: http://codereview.chromium.org/7578001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl/url_util_impl.cc')
-rw-r--r--ppapi/shared_impl/url_util_impl.cc41
1 files changed, 17 insertions, 24 deletions
diff --git a/ppapi/shared_impl/url_util_impl.cc b/ppapi/shared_impl/url_util_impl.cc
index f45d4fef..66a6185 100644
--- a/ppapi/shared_impl/url_util_impl.cc
+++ b/ppapi/shared_impl/url_util_impl.cc
@@ -5,6 +5,7 @@
#include "ppapi/shared_impl/url_util_impl.h"
#include "googleurl/src/gurl.h"
+#include "ppapi/shared_impl/var.h"
namespace ppapi {
@@ -40,48 +41,42 @@ void ConvertComponents(const url_parse::Parsed& input,
} // namespace
// static
-PP_Var URLUtilImpl::Canonicalize(StringFromVar string_from_var,
- VarFromUtf8 var_from_utf8,
- PP_Module pp_module,
+PP_Var URLUtilImpl::Canonicalize(PP_Module pp_module,
PP_Var url,
PP_URLComponents_Dev* components) {
- const std::string* url_string = string_from_var(url);
+ scoped_refptr<StringVar> url_string(StringVar::FromPPVar(url));
if (!url_string)
return PP_MakeNull();
- return GenerateURLReturn(var_from_utf8, pp_module,
- GURL(*url_string), components);
+ return GenerateURLReturn(pp_module, GURL(url_string->value()), components);
}
// static
-PP_Var URLUtilImpl::ResolveRelativeToURL(StringFromVar string_from_var,
- VarFromUtf8 var_from_utf8,
- PP_Module pp_module,
+PP_Var URLUtilImpl::ResolveRelativeToURL(PP_Module pp_module,
PP_Var base_url,
PP_Var relative,
PP_URLComponents_Dev* components) {
- const std::string* base_url_string = string_from_var(base_url);
- const std::string* relative_string = string_from_var(relative);
+ scoped_refptr<StringVar> base_url_string(StringVar::FromPPVar(base_url));
+ scoped_refptr<StringVar> relative_string(StringVar::FromPPVar(relative));
if (!base_url_string || !relative_string)
return PP_MakeNull();
- GURL base_gurl(*base_url_string);
+ GURL base_gurl(base_url_string->value());
if (!base_gurl.is_valid())
return PP_MakeNull();
- return GenerateURLReturn(var_from_utf8, pp_module,
- base_gurl.Resolve(*relative_string),
+ return GenerateURLReturn(pp_module,
+ base_gurl.Resolve(relative_string->value()),
components);
}
// static
-PP_Bool URLUtilImpl::IsSameSecurityOrigin(StringFromVar string_from_var,
- PP_Var url_a, PP_Var url_b) {
- const std::string* url_a_string = string_from_var(url_a);
- const std::string* url_b_string = string_from_var(url_b);
+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));
if (!url_a_string || !url_b_string)
return PP_FALSE;
- GURL gurl_a(*url_a_string);
- GURL gurl_b(*url_b_string);
+ GURL gurl_a(url_a_string->value());
+ GURL gurl_b(url_b_string->value());
if (!gurl_a.is_valid() || !gurl_b.is_valid())
return PP_FALSE;
@@ -90,15 +85,13 @@ PP_Bool URLUtilImpl::IsSameSecurityOrigin(StringFromVar string_from_var,
// Used for returning the given GURL from a PPAPI function, with an optional
// out param indicating the components.
-PP_Var URLUtilImpl::GenerateURLReturn(VarFromUtf8 var_from_utf8,
- PP_Module module,
+PP_Var URLUtilImpl::GenerateURLReturn(PP_Module module,
const GURL& url,
PP_URLComponents_Dev* components) {
if (!url.is_valid())
return PP_MakeNull();
ConvertComponents(url.parsed_for_possibly_invalid_spec(), components);
- return var_from_utf8(module, url.possibly_invalid_spec().c_str(),
- static_cast<uint32_t>(url.possibly_invalid_spec().size()));
+ return StringVar::StringToPPVar(module, url.possibly_invalid_spec());
}
} // namespace ppapi