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

Unified Diff: extensions/browser/api/cast_channel/cast_channel_api.cc

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_channel_api.cc
diff --git a/extensions/browser/api/cast_channel/cast_channel_api.cc b/extensions/browser/api/cast_channel/cast_channel_api.cc
index 4355e0e418463847d6305a24e9cb592eff2b41a9..690c1972ae9072093e7b481e76db878e5eb25105 100644
--- a/extensions/browser/api/cast_channel/cast_channel_api.cc
+++ b/extensions/browser/api/cast_channel/cast_channel_api.cc
@@ -346,12 +346,14 @@ void CastChannelOpenFunction::AsyncWorkStart() {
void CastChannelOpenFunction::OnOpen(cast_channel::ChannelError result) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
VLOG(1) << "Connect finished, OnOpen invoked.";
- CastSocket* socket = GetSocket(new_channel_id_);
- if (!socket) {
- SetResultFromError(new_channel_id_, result);
- } else {
+ if (result == cast_channel::CHANNEL_ERROR_NONE) {
imcheng 2017/02/17 22:34:45 I changed the behavior slightly. It's not clear to
mark a. foltz 2017/02/21 18:30:01 IIRC, GetSocket should never be nullptr. AddSocke
imcheng 2017/02/21 22:55:47 Yeah. I reasoned that since CastSocket is always o
+ CastSocket* socket = GetSocket(new_channel_id_);
+ CHECK(socket);
mark a. foltz 2017/02/21 18:30:01 SECURITY_CHECK?
imcheng 2017/02/21 22:55:47 Done.
imcheng 2017/02/21 23:34:20 Turns out SECURITY_CHECK is defined in Blink codeb
SetResultFromSocket(*socket);
+ } else {
+ SetResultFromError(new_channel_id_, result);
mark a. foltz 2017/02/21 18:33:20 If you want to aggressively destroy sockets on fai
imcheng 2017/02/21 22:55:47 I will save it for a separate patch as it's a risk
}
+
AsyncWorkCompleted();
}
« no previous file with comments | « no previous file | extensions/browser/api/cast_channel/cast_socket.h » ('j') | extensions/browser/api/cast_channel/cast_socket.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698