diff options
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/ppb_flash_net_connector_proxy.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/ppapi/proxy/ppb_flash_net_connector_proxy.cc b/ppapi/proxy/ppb_flash_net_connector_proxy.cc index f7279d35..45c33ee 100644 --- a/ppapi/proxy/ppb_flash_net_connector_proxy.cc +++ b/ppapi/proxy/ppb_flash_net_connector_proxy.cc @@ -26,6 +26,19 @@ void StringToNetAddress(const std::string& str, PP_Flash_NetAddress* addr) { memcpy(addr->data, str.data(), addr->size); } +class AbortCallbackTask : public Task { + public: + AbortCallbackTask(PP_CompletionCallback callback) + : callback_(callback) {} + + virtual void Run() { + PP_RunCompletionCallback(&callback_, PP_ERROR_ABORTED); + } + + private: + PP_CompletionCallback callback_; +}; + class FlashNetConnector : public PluginResource { public: FlashNetConnector(const HostResource& resource) @@ -35,8 +48,10 @@ class FlashNetConnector : public PluginResource { remote_addr_out_(NULL) { } ~FlashNetConnector() { - if (callback_.func) - PP_RunCompletionCallback(&callback_, PP_ERROR_ABORTED); + if (callback_.func) { + MessageLoop::current()->PostTask(FROM_HERE, + new AbortCallbackTask(callback_)); + } } // Resource overrides. |