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

Issue 417403002: Remove weak pointers from CastSocket. (Closed)

Created:
6 years, 4 months ago by mark a. foltz
Modified:
6 years, 4 months ago
Reviewers:
Kevin M, Wez
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Project:
chromium
Visibility:
Public.

Description

Remove weak pointers from CastSocket by explicitly tracking and resetting callbacks created inside the class. Ensure all sockets are closed and callbacks reset in all relevant code paths: Close(), CloseWithError(), and the dtor. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=287477

Patch Set 1 #

Patch Set 2 : Finish reorganizing callbacks. #

Total comments: 24

Patch Set 3 : #

Patch Set 4 : Refactor to use CancelableCallback #

Total comments: 24

Patch Set 5 : Respond to Wez comments. Fire callbacks in CloseInternal. #

Total comments: 4

Patch Set 6 : Change when callbacks are run. #

Patch Set 7 : Clarify deletion policies. #

Total comments: 8

Patch Set 8 : Update comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+166 lines, -84 lines) Patch
M extensions/browser/api/cast_channel/cast_channel_api.h View 1 2 3 4 1 chunk +6 lines, -5 lines 0 comments Download
M extensions/browser/api/cast_channel/cast_channel_api.cc View 1 2 3 4 5 6 7 6 chunks +34 lines, -17 lines 0 comments Download
M extensions/browser/api/cast_channel/cast_channel_apitest.cc View 1 2 3 4 5 2 chunks +3 lines, -5 lines 0 comments Download
M extensions/browser/api/cast_channel/cast_socket.h View 1 2 3 4 5 6 7 9 chunks +36 lines, -16 lines 0 comments Download
M extensions/browser/api/cast_channel/cast_socket.cc View 1 2 3 4 5 15 chunks +87 lines, -41 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
mark a. foltz
6 years, 4 months ago (2014-07-28 20:51:54 UTC) #1
Wez
We should be using WeakPtrFactory rather than SupportsWeakPtr here, but what's the rationale for removing ...
6 years, 4 months ago (2014-07-28 20:55:29 UTC) #2
mark a. foltz
On 2014/07/28 20:55:29, Wez wrote: > We should be using WeakPtrFactory rather than SupportsWeakPtr here, ...
6 years, 4 months ago (2014-07-28 20:57:31 UTC) #3
Wez
On 2014/07/28 20:57:31, mark a. foltz wrote: > On 2014/07/28 20:55:29, Wez wrote: > > ...
6 years, 4 months ago (2014-07-28 20:59:30 UTC) #4
mark a. foltz
On 2014/07/28 20:59:30, Wez wrote: > On 2014/07/28 20:57:31, mark a. foltz wrote: > > ...
6 years, 4 months ago (2014-07-28 21:06:32 UTC) #5
Kevin M
https://codereview.chromium.org/417403002/diff/20001/extensions/browser/api/cast_channel/cast_socket.cc File extensions/browser/api/cast_channel/cast_socket.cc (right): https://codereview.chromium.org/417403002/diff/20001/extensions/browser/api/cast_channel/cast_socket.cc#newcode195 extensions/browser/api/cast_channel/cast_socket.cc:195: base::MessageLoop::current()->PostTask(FROM_HERE, connect_loop_callback_); Should this be turned into PostNonNestableTask now, ...
6 years, 4 months ago (2014-07-28 22:08:17 UTC) #6
Wez
Not LGTM. We can't remove use of WeakPtr because we currently have several places where ...
6 years, 4 months ago (2014-07-28 23:14:57 UTC) #7
Ryan Sleevi
On 2014/07/28 23:14:57, Wez wrote: > As a complete aside, we should also use base::NonThreadSafe ...
6 years, 4 months ago (2014-07-28 23:25:42 UTC) #8
Wez
On 2014/07/28 23:25:42, Ryan Sleevi wrote: > On 2014/07/28 23:14:57, Wez wrote: > > As ...
6 years, 4 months ago (2014-07-28 23:37:44 UTC) #9
mark a. foltz
PTAL https://codereview.chromium.org/417403002/diff/20001/extensions/browser/api/cast_channel/cast_socket.cc File extensions/browser/api/cast_channel/cast_socket.cc (right): https://codereview.chromium.org/417403002/diff/20001/extensions/browser/api/cast_channel/cast_socket.cc#newcode195 extensions/browser/api/cast_channel/cast_socket.cc:195: base::MessageLoop::current()->PostTask(FROM_HERE, connect_loop_callback_); On 2014/07/28 23:14:56, Wez wrote: > ...
6 years, 4 months ago (2014-07-29 00:16:25 UTC) #10
Wez
https://codereview.chromium.org/417403002/diff/20001/extensions/browser/api/cast_channel/cast_socket.cc File extensions/browser/api/cast_channel/cast_socket.cc (right): https://codereview.chromium.org/417403002/diff/20001/extensions/browser/api/cast_channel/cast_socket.cc#newcode195 extensions/browser/api/cast_channel/cast_socket.cc:195: base::MessageLoop::current()->PostTask(FROM_HERE, connect_loop_callback_); On 2014/07/29 00:16:24, mark a. foltz wrote: ...
6 years, 4 months ago (2014-07-29 00:41:26 UTC) #11
mark a. foltz
On 2014/07/29 00:41:26, Wez wrote: > https://codereview.chromium.org/417403002/diff/20001/extensions/browser/api/cast_channel/cast_socket.cc > File extensions/browser/api/cast_channel/cast_socket.cc (right): > > https://codereview.chromium.org/417403002/diff/20001/extensions/browser/api/cast_channel/cast_socket.cc#newcode195 > ...
6 years, 4 months ago (2014-07-29 18:22:52 UTC) #12
Wez
On 2014/07/29 18:22:52, mark a. foltz wrote: > On 2014/07/29 00:41:26, Wez wrote: > > ...
6 years, 4 months ago (2014-07-29 21:08:48 UTC) #13
mark a. foltz
Updated to use CancelableCallback. PTAL.
6 years, 4 months ago (2014-07-30 01:45:05 UTC) #14
Wez
https://codereview.chromium.org/417403002/diff/60001/extensions/browser/api/cast_channel/cast_socket.cc File extensions/browser/api/cast_channel/cast_socket.cc (right): https://codereview.chromium.org/417403002/diff/60001/extensions/browser/api/cast_channel/cast_socket.cc#newcode183 extensions/browser/api/cast_channel/cast_socket.cc:183: base::Unretained(this))); nit: Style guide would prefer wrapping this after ...
6 years, 4 months ago (2014-07-30 19:14:53 UTC) #15
mark a. foltz
https://codereview.chromium.org/417403002/diff/60001/extensions/browser/api/cast_channel/cast_socket.cc File extensions/browser/api/cast_channel/cast_socket.cc (right): https://codereview.chromium.org/417403002/diff/60001/extensions/browser/api/cast_channel/cast_socket.cc#newcode183 extensions/browser/api/cast_channel/cast_socket.cc:183: base::Unretained(this))); On 2014/07/30 19:14:53, Wez wrote: > nit: Style ...
6 years, 4 months ago (2014-07-31 18:33:17 UTC) #16
Wez
https://codereview.chromium.org/417403002/diff/60001/extensions/browser/api/cast_channel/cast_socket.h File extensions/browser/api/cast_channel/cast_socket.h (right): https://codereview.chromium.org/417403002/diff/60001/extensions/browser/api/cast_channel/cast_socket.h#newcode55 extensions/browser/api/cast_channel/cast_socket.h:55: // Do NOT delete the socket in this callback. ...
6 years, 4 months ago (2014-07-31 22:57:54 UTC) #17
mark a. foltz
Refactored out a bit so I no longer run callbacks in the dtor. They are ...
6 years, 4 months ago (2014-08-01 23:21:48 UTC) #18
mark a. foltz
I added some comments to the code to clarify deletion policy to be conservative: deleting ...
6 years, 4 months ago (2014-08-04 18:45:04 UTC) #19
Wez
lgtm https://codereview.chromium.org/417403002/diff/120001/extensions/browser/api/cast_channel/cast_channel_api.cc File extensions/browser/api/cast_channel/cast_channel_api.cc (right): https://codereview.chromium.org/417403002/diff/120001/extensions/browser/api/cast_channel/cast_channel_api.cc#newcode68 extensions/browser/api/cast_channel/cast_channel_api.cc:68: std::numeric_limits<uint16>::max(); unit16_t https://codereview.chromium.org/417403002/diff/120001/extensions/browser/api/cast_channel/cast_channel_api.cc#newcode433 extensions/browser/api/cast_channel/cast_channel_api.cc:433: // This will delete ...
6 years, 4 months ago (2014-08-04 21:32:33 UTC) #20
mark a. foltz
https://codereview.chromium.org/417403002/diff/120001/extensions/browser/api/cast_channel/cast_channel_api.cc File extensions/browser/api/cast_channel/cast_channel_api.cc (right): https://codereview.chromium.org/417403002/diff/120001/extensions/browser/api/cast_channel/cast_channel_api.cc#newcode68 extensions/browser/api/cast_channel/cast_channel_api.cc:68: std::numeric_limits<uint16>::max(); On 2014/08/04 21:32:32, Wez wrote: > unit16_t Done. ...
6 years, 4 months ago (2014-08-04 22:20:44 UTC) #21
mark a. foltz
The CQ bit was checked by mfoltz@chromium.org
6 years, 4 months ago (2014-08-04 22:20:53 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mfoltz@chromium.org/417403002/140001
6 years, 4 months ago (2014-08-04 22:22:49 UTC) #23
commit-bot: I haz the power
6 years, 4 months ago (2014-08-05 07:35:39 UTC) #24
Message was sent while issue was closed.
Change committed as 287477

Powered by Google App Engine
This is Rietveld 408576698