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

Unified Diff: extensions/browser/api/cast_channel/cast_socket.h

Issue 2707543002: [Cast Channel] Fix "leaky" CastChannelOpenFunction. (Closed)
Patch Set: Created 3 years, 10 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
Index: extensions/browser/api/cast_channel/cast_socket.h
diff --git a/extensions/browser/api/cast_channel/cast_socket.h b/extensions/browser/api/cast_channel/cast_socket.h
index 08a69b4bf8108467bb7c727ebfd6382f12906ed8..08932b02209497b766b28afcc4e39cee9c635427 100644
--- a/extensions/browser/api/cast_channel/cast_socket.h
+++ b/extensions/browser/api/cast_channel/cast_socket.h
@@ -70,6 +70,9 @@ class CastSocket : public ApiResource {
// Instead use Close().
// |callback| will be invoked with any ChannelError that occurred, or
// CHANNEL_ERROR_NONE if successful.
+ // If the CastSocket is destroyed while the connection is pending, |callback|
+ // will be invoked with CHANNEL_ERROR_UNKNOWN. In this case, invoking
mark a. foltz 2017/02/21 18:30:01 CHANNEL_ERROR_SOCKET_ERROR is used elsewhere for s
imcheng 2017/02/21 22:55:48 socket_error is used for errors with read/write so
+ // |callback| must not result in an re-entrancy behavior.
mark a. foltz 2017/02/21 18:30:01 s/an/any/
imcheng 2017/02/21 22:55:48 Done.
// |delegate| receives message receipt and error events.
// Ownership of |delegate| is transferred to this CastSocket.
virtual void Connect(std::unique_ptr<CastTransport::Delegate> delegate,
@@ -323,6 +326,8 @@ class CastSocketImpl : public CastSocket {
std::unique_ptr<CastMessage> challenge_reply_;
// Callback invoked when the socket is connected or fails to connect.
+ // TODO(imcheng): Change to OnceCallback? OnceCallback is move-only which
mark a. foltz 2017/02/21 18:30:01 I think the benefit is pretty slight here, not sur
imcheng 2017/02/21 22:55:47 Ok, removed TODO.
+ // is an issue for gmock.
base::Callback<void(ChannelError)> connect_callback_;
// Callback invoked by |connect_timeout_timer_| to cancel the connection.

Powered by Google App Engine
This is Rietveld 408576698