| Index: ppapi/proxy/ppb_file_ref_proxy.cc
|
| diff --git a/ppapi/proxy/ppb_file_ref_proxy.cc b/ppapi/proxy/ppb_file_ref_proxy.cc
|
| index 20b522ccf1f96d6a00fc3c59e00a96d4f4569ed2..e481f868b835930ba8e1e428f09e3f254ffb2283 100644
|
| --- a/ppapi/proxy/ppb_file_ref_proxy.cc
|
| +++ b/ppapi/proxy/ppb_file_ref_proxy.cc
|
| @@ -33,6 +33,9 @@ class FileRef : public PPB_FileRef_Shared {
|
| explicit FileRef(const PPB_FileRef_CreateInfo& info);
|
| virtual ~FileRef();
|
|
|
| + // Resource overrides.
|
| + virtual void LastPluginRefWasDeleted() OVERRIDE;
|
| +
|
| // PPB_FileRef_API implementation (not provided by PPB_FileRef_Shared).
|
| virtual PP_Resource GetParent() OVERRIDE;
|
| virtual int32_t MakeDirectory(PP_Bool make_ancestors,
|
| @@ -77,6 +80,11 @@ FileRef::FileRef(const PPB_FileRef_CreateInfo& info)
|
| }
|
|
|
| FileRef::~FileRef() {
|
| + // The callbacks map should have been cleared by LastPluginRefWasDeleted.
|
| + DCHECK(pending_callbacks_.empty());
|
| +}
|
| +
|
| +void FileRef::LastPluginRefWasDeleted() {
|
| // Abort all pending callbacks. Do this by posting a task to avoid reentering
|
| // the plugin's Release() call that probably deleted this object.
|
| for (PendingCallbackMap::iterator i = pending_callbacks_.begin();
|
| @@ -85,6 +93,7 @@ FileRef::~FileRef() {
|
| i->second.func, i->second.user_data,
|
| static_cast<int32_t>(PP_ERROR_ABORTED)));
|
| }
|
| + pending_callbacks_.clear();
|
| }
|
|
|
| PP_Resource FileRef::GetParent() {
|
|
|