summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi/ppb_file_ref_impl.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 15:41:01 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 15:41:01 +0000
commit7f8b26b5f223689de7af4803bc07e1e953ff5953 (patch)
treed6f3e574d97c6253b8b202264fe23dea1b489dc2 /webkit/plugins/ppapi/ppb_file_ref_impl.cc
parentd8886526085a42874663be638be1421e78f6172c (diff)
downloadchromium_src-7f8b26b5f223689de7af4803bc07e1e953ff5953.zip
chromium_src-7f8b26b5f223689de7af4803bc07e1e953ff5953.tar.gz
chromium_src-7f8b26b5f223689de7af4803bc07e1e953ff5953.tar.bz2
Add a unified resource tracker shared between the proxy and the impl.
This renames the old ResourceObjectBase to Resource and removes the old PluginResource. It moves the resource tracker from the impl to the shared_impl, and makes the proxy use it. Some things become a little less neat because there's no proxy resource base class. In particular GetDispatcher() is now gone. I considered whether to add a helper base class that provides this function, but decided against it and had individual resource classes implement this when their implementation would find it useful. This is because ultimately I want more of this functionality to move into the shared_impl, and it's easier to do that if there are fewer proxy-specific things in the resources. This changes the way that plugins are added to the tracker. Previously they would only be in the tracker if the plugin had a reference to them, although they could be alive if the impl had a scoped_ptr referencing an object. This actually has the bug that if we then give the resource back to the plugin, it wouldn't be refcounted properly and everything would get confused. Now the tracker tracks all live resource objects whether or not the plugin has a ref. This works basically like the var tracker (it would be nice if the var and resource trackers shared more code, but that would further complicate this already overcomplicated patch). The resource tracker takes an extra ref whenever the plugin has one or more, and otherwise just tracks live resources. Review URL: http://codereview.chromium.org/7629017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97314 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi/ppb_file_ref_impl.cc')
-rw-r--r--webkit/plugins/ppapi/ppb_file_ref_impl.cc18
1 files changed, 6 insertions, 12 deletions
diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.cc b/webkit/plugins/ppapi/ppb_file_ref_impl.cc
index 00d5db4..1a1e397 100644
--- a/webkit/plugins/ppapi/ppb_file_ref_impl.cc
+++ b/webkit/plugins/ppapi/ppb_file_ref_impl.cc
@@ -97,10 +97,8 @@ PP_Resource PPB_FileRef_Impl::Create(PP_Resource pp_file_system,
return 0;
TrimTrailingSlash(&validated_path);
- PPB_FileRef_Impl* file_ref =
- new PPB_FileRef_Impl(file_system->instance(),
- file_system, validated_path);
- return file_ref->GetReference();
+ return (new PPB_FileRef_Impl(file_system->instance(),
+ file_system, validated_path))->GetReference();
}
PPB_FileRef_API* PPB_FileRef_Impl::AsPPB_FileRef_API() {
@@ -176,8 +174,7 @@ int32_t PPB_FileRef_Impl::MakeDirectory(PP_Bool make_ancestors,
if (!instance()->delegate()->MakeDirectory(
GetFileSystemURL(), PP_ToBool(make_ancestors),
new FileCallbacks(instance()->module()->AsWeakPtr(),
- GetReferenceNoAddRef(), callback,
- NULL, NULL, NULL)))
+ pp_resource(), callback, NULL, NULL, NULL)))
return PP_ERROR_FAILED;
return PP_OK_COMPLETIONPENDING;
}
@@ -192,8 +189,7 @@ int32_t PPB_FileRef_Impl::Touch(PP_Time last_access_time,
PPTimeToTime(last_access_time),
PPTimeToTime(last_modified_time),
new FileCallbacks(instance()->module()->AsWeakPtr(),
- GetReferenceNoAddRef(), callback,
- NULL, NULL, NULL)))
+ pp_resource(), callback, NULL, NULL, NULL)))
return PP_ERROR_FAILED;
return PP_OK_COMPLETIONPENDING;
}
@@ -204,8 +200,7 @@ int32_t PPB_FileRef_Impl::Delete(PP_CompletionCallback callback) {
if (!instance()->delegate()->Delete(
GetFileSystemURL(),
new FileCallbacks(instance()->module()->AsWeakPtr(),
- GetReferenceNoAddRef(), callback,
- NULL, NULL, NULL)))
+ pp_resource(), callback, NULL, NULL, NULL)))
return PP_ERROR_FAILED;
return PP_OK_COMPLETIONPENDING;
}
@@ -227,8 +222,7 @@ int32_t PPB_FileRef_Impl::Rename(PP_Resource new_pp_file_ref,
if (!instance()->delegate()->Rename(
GetFileSystemURL(), new_file_ref->GetFileSystemURL(),
new FileCallbacks(instance()->module()->AsWeakPtr(),
- GetReferenceNoAddRef(), callback,
- NULL, NULL, NULL)))
+ pp_resource(), callback, NULL, NULL, NULL)))
return PP_ERROR_FAILED;
return PP_OK_COMPLETIONPENDING;
}