| 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 e6a8b944c9997deeced5acf244c5450b37788e00..11f1d515530e732fe247b2ca9ef659d2fbb55569 100644
|
| --- a/ppapi/proxy/ppb_file_ref_proxy.cc
|
| +++ b/ppapi/proxy/ppb_file_ref_proxy.cc
|
| @@ -32,6 +32,9 @@ class FileRef : public FileRefImpl {
|
| explicit FileRef(const PPB_FileRef_CreateInfo& info);
|
| virtual ~FileRef();
|
|
|
| + // Resource overrides.
|
| + virtual void LastPluginRefWasDeleted() OVERRIDE;
|
| +
|
| // PPB_FileRef_API implementation (not provided by FileRefImpl).
|
| virtual PP_Resource GetParent() OVERRIDE;
|
| virtual int32_t MakeDirectory(PP_Bool make_ancestors,
|
| @@ -71,10 +74,15 @@ class FileRef : public FileRefImpl {
|
|
|
| FileRef::FileRef(const PPB_FileRef_CreateInfo& info)
|
| : FileRefImpl(FileRefImpl::InitAsProxy(), info),
|
| - next_callback_id_(0) {
|
| + next_callback_id_(1) {
|
| }
|
|
|
| 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();
|
| @@ -83,6 +91,7 @@ FileRef::~FileRef() {
|
| i->second.func, i->second.user_data,
|
| static_cast<int32_t>(PP_ERROR_ABORTED)));
|
| }
|
| + pending_callbacks_.clear();
|
| }
|
|
|
| PP_Resource FileRef::GetParent() {
|
|
|