Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: webkit/plugins/ppapi/ppb_websocket_impl.cc

Issue 10661026: WebSocket Pepper API: allow to release in completion callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remvoe redundant checker Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/tests/test_websocket.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_websocket_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_websocket_impl.cc b/webkit/plugins/ppapi/ppb_websocket_impl.cc
index bc9fae483d460f51ce2309dd3e402afc97a5ea1f..2893fea23676cb84d77fd357ad72e7b1149419f8 100644
--- a/webkit/plugins/ppapi/ppb_websocket_impl.cc
+++ b/webkit/plugins/ppapi/ppb_websocket_impl.cc
@@ -502,6 +502,10 @@ void PPB_WebSocket_Impl::didClose(unsigned long unhandled_buffered_amount,
PP_WebSocketReadyState state = state_;
state_ = PP_WEBSOCKETREADYSTATE_CLOSED;
+ // User handlers may release WebSocket PP_Resource in the following
+ // completion callbacks. Retain |this| here to assure that this object
+ // keep on being valid in this function.
+ scoped_refptr<PPB_WebSocket_Impl> retain_this(this);
if (state == PP_WEBSOCKETREADYSTATE_CONNECTING)
TrackedCallback::ClearAndRun(&connect_callback_, PP_ERROR_FAILED);
« no previous file with comments | « ppapi/tests/test_websocket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698