summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins/pepper_file_chooser.cc
diff options
context:
space:
mode:
authorneb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 21:01:10 +0000
committerneb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-20 21:01:10 +0000
commit6205759e4ec4bf1d9e85049cc1cc90d76c916283 (patch)
tree6fd797237c6f8ee0bc532747af2e004b2ca3a865 /webkit/glue/plugins/pepper_file_chooser.cc
parent92a9c68ab835fd2148a8cce64db74dd20e01e9dd (diff)
downloadchromium_src-6205759e4ec4bf1d9e85049cc1cc90d76c916283.zip
chromium_src-6205759e4ec4bf1d9e85049cc1cc90d76c916283.tar.gz
chromium_src-6205759e4ec4bf1d9e85049cc1cc90d76c916283.tar.bz2
De-coupled resource references by plugin from Resource object's refcount. Made so that ResourceTracker keeps the refs-by-plugin count, and when the ppapi plugin releases the last reference, it UnRefs the resource.
TEST=none BUG=none Review URL: http://codereview.chromium.org/2871027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53098 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins/pepper_file_chooser.cc')
-rw-r--r--webkit/glue/plugins/pepper_file_chooser.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/webkit/glue/plugins/pepper_file_chooser.cc b/webkit/glue/plugins/pepper_file_chooser.cc
index 6c4c72a..5e45600 100644
--- a/webkit/glue/plugins/pepper_file_chooser.cc
+++ b/webkit/glue/plugins/pepper_file_chooser.cc
@@ -22,18 +22,17 @@ PP_Resource Create(PP_Instance instance_id,
return 0;
FileChooser* chooser = new FileChooser(instance, options);
- chooser->AddRef(); // AddRef for the caller.
- return chooser->GetResource();
+ return chooser->GetReference();
}
bool IsFileChooser(PP_Resource resource) {
- return !!Resource::GetAs<FileChooser>(resource).get();
+ return !!Resource::GetAs<FileChooser>(resource);
}
int32_t Show(PP_Resource chooser_id, PP_CompletionCallback callback) {
scoped_refptr<FileChooser> chooser(
- Resource::GetAs<FileChooser>(chooser_id).get());
- if (!chooser.get())
+ Resource::GetAs<FileChooser>(chooser_id));
+ if (!chooser)
return PP_ERROR_BADRESOURCE;
return chooser->Show(callback);
@@ -41,16 +40,15 @@ int32_t Show(PP_Resource chooser_id, PP_CompletionCallback callback) {
PP_Resource GetNextChosenFile(PP_Resource chooser_id) {
scoped_refptr<FileChooser> chooser(
- Resource::GetAs<FileChooser>(chooser_id).get());
- if (!chooser.get())
+ Resource::GetAs<FileChooser>(chooser_id));
+ if (!chooser)
return 0;
scoped_refptr<FileRef> file_ref(chooser->GetNextChosenFile());
- if (!file_ref.get())
+ if (!file_ref)
return 0;
- file_ref->AddRef(); // AddRef for the caller.
- return file_ref->GetResource();
+ return file_ref->GetReference();
}
const PPB_FileChooser ppb_filechooser = {