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

Unified Diff: net/websockets/websocket_stream.h

Issue 26544003: Make net::WebSocketChannel deletion safe and enable new IPCs (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase (again). Created 7 years, 2 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 | « net/websockets/websocket_event_interface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_stream.h
diff --git a/net/websockets/websocket_stream.h b/net/websockets/websocket_stream.h
index ce9551dcb3844f8920756a5067d089426fa94833..c5f6f971b301b1894cdea35cc16e1523a2718daa 100644
--- a/net/websockets/websocket_stream.h
+++ b/net/websockets/websocket_stream.h
@@ -119,6 +119,12 @@ class NET_EXPORT_PRIVATE WebSocketStream {
// ReadFrames may discard the incomplete frame. Since the renderer will
// discard any incomplete messages when the connection is closed, this makes
// no difference to the overall semantics.
+ //
+ // Implementations of ReadFrames() must be able to handle being deleted during
+ // the execution of callback.Run(). In practice this means that the method
+ // calling callback.Run() (and any calling methods in the same object) must
+ // return immediately without any further method calls or access to member
+ // variables. Implementors should write test(s) for this case.
virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames,
const CompletionCallback& callback) = 0;
@@ -131,6 +137,11 @@ class NET_EXPORT_PRIVATE WebSocketStream {
//
// This method will only return OK if all frames were written completely.
// Otherwise it will return an appropriate net error code.
+ //
+ // The callback implementation is permitted to delete this
+ // object. Implementations of WriteFrames() should be robust against
+ // this. This generally means returning to the event loop immediately after
+ // calling the callback.
virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames,
const CompletionCallback& callback) = 0;
« no previous file with comments | « net/websockets/websocket_event_interface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698