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

Issue 669853003: Adding presubmit check for WeakPtrFactory in the code (Closed)

Created:
6 years, 2 months ago by MRV
Modified:
6 years, 1 month ago
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Adding presubmit check for WeakPtrFactory in the code This change will ensure WeakPtrFactory order is maintained the files properly. As per WeakPtrFactory's documentation: Member variables should appear before the WeakPtrFactory, to ensure that any WeakPtrs to Controller are invalidated before its members variable's destructors are executed, rendering them invalid. BUG=303818

Patch Set 1 #

Patch Set 2 : Fixed indentation issues #

Total comments: 2

Patch Set 3 : incorporated the comments #

Patch Set 4 : Rebased the patch on latest code #

Unified diffs Side-by-side diffs Delta from patch set Stats (+225 lines, -0 lines) Patch
M PRESUBMIT.py View 1 2 3 2 chunks +50 lines, -0 lines 0 comments Download
M PRESUBMIT_test.py View 1 2 3 1 chunk +175 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (5 generated)
MRV
PTAL
6 years, 2 months ago (2014-10-22 05:21:25 UTC) #2
M-A Ruel
Please have someone who know about WeakPtrFactory review this first.
6 years, 2 months ago (2014-10-22 18:02:29 UTC) #3
M-A Ruel
https://chromiumcodereview.appspot.com/669853003/diff/20001/PRESUBMIT.py File PRESUBMIT.py (right): https://chromiumcodereview.appspot.com/669853003/diff/20001/PRESUBMIT.py#newcode1282 PRESUBMIT.py:1282: if (not f.LocalPath().endswith(('.cc', '.cpp', '.h', '.mm'))): if not f.LocalPath().endswith(('.cc', ...
6 years, 2 months ago (2014-10-22 18:02:40 UTC) #4
MRV
Thanks Mr. Ruel for review. I have incorporated the suggested changes. PTAL https://chromiumcodereview.appspot.com/669853003/diff/20001/PRESUBMIT.py File PRESUBMIT.py ...
6 years, 2 months ago (2014-10-23 03:06:31 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/669853003/60001
6 years, 2 months ago (2014-10-23 13:46:03 UTC) #7
commit-bot: I haz the power
No LGTM from a valid reviewer yet. Only full committers are accepted. Even if an ...
6 years, 2 months ago (2014-10-23 13:46:05 UTC) #9
MRV
On 2014/10/23 13:46:05, I haz the power (commit-bot) wrote: > No LGTM from a valid ...
6 years, 2 months ago (2014-10-23 13:47:12 UTC) #10
MRV
On 2014/10/23 13:47:12, MRV wrote: > On 2014/10/23 13:46:05, I haz the power (commit-bot) wrote: ...
6 years, 1 month ago (2014-11-14 15:25:24 UTC) #11
M-A Ruel
On 2014/10/22 18:02:29, M-A Ruel wrote: > Please have someone who know about WeakPtrFactory review ...
6 years, 1 month ago (2014-11-14 15:37:18 UTC) #12
MRV
On 2014/11/14 15:37:18, M-A Ruel wrote: > On 2014/10/22 18:02:29, M-A Ruel wrote: > > ...
6 years, 1 month ago (2014-11-14 15:40:52 UTC) #13
Avi (use Gerrit)
On 2014/11/14 15:40:52, MRV wrote: > On 2014/11/14 15:37:18, M-A Ruel wrote: > > On ...
6 years, 1 month ago (2014-11-14 15:57:25 UTC) #15
MRV
On 2014/11/14 15:57:25, Avi wrote: > On 2014/11/14 15:40:52, MRV wrote: > > On 2014/11/14 ...
6 years, 1 month ago (2014-11-17 03:01:18 UTC) #17
dmichael (off chromium)
There's already a clang plugin to check for this, just waiting to be turned on. ...
6 years, 1 month ago (2014-11-17 16:20:16 UTC) #18
MRV
On 2014/11/17 16:20:16, dmichael wrote: > There's already a clang plugin to check for this, ...
6 years, 1 month ago (2014-11-18 03:35:34 UTC) #19
dmichael (off chromium)
On 2014/11/18 03:35:34, MRV wrote: > On 2014/11/17 16:20:16, dmichael wrote: > > There's already ...
6 years, 1 month ago (2014-11-18 17:58:19 UTC) #20
Wez
I agree w/ dmichael@ that this should be done in Clang. At a cursory glance, ...
6 years, 1 month ago (2014-11-18 18:21:39 UTC) #21
MRV
On 2014/11/18 18:21:39, Wez wrote: > I agree w/ dmichael@ that this should be done ...
6 years, 1 month ago (2014-11-19 08:54:56 UTC) #22
dmichael (off chromium)
On 2014/11/19 08:54:56, MRV wrote: > On 2014/11/18 18:21:39, Wez wrote: > > I agree ...
6 years, 1 month ago (2014-11-20 00:05:14 UTC) #23
MRV
6 years, 1 month ago (2014-11-20 14:43:12 UTC) #24
On 2014/11/20 00:05:14, dmichael wrote:
> On 2014/11/19 08:54:56, MRV wrote:
> > On 2014/11/18 18:21:39, Wez wrote:
> > > I agree w/ dmichael@ that this should be done in Clang.
> > > 
> > > At a cursory glance, IIUC the PRESUBMIT.py check simply enforces that
> > > WeakPtrFactory is immediately followed by DISALLOW_COPY_AND_ASSIGN, which
> > means
> > > it only copes with the case of WeakPtrFactory being used to refer to
> dispense
> > > WeakPtrs to |this|.  It's perfectly valid, though, for WeakPtrFactory to
be
> > used
> > > to wrap another class member, or some other object, though, in which case
> the
> > > positioning of that factory in the containing cass need not be restricted
in
> > > this way.
> > 
> > Thanks mr. dichael and wez for your feedback, I'll understand same try to
come
> > up with the patch.
> 
> I put together a patch here:
> https://codereview.chromium.org/740083002/
> ...but it looks like there are still some places to fix.

Mr.dmichael thanks for your review and making fine tuned patch.
I have submitted 3 patches which were some left outs for cleaning up weakptr.
I abandoning this patch now.
Thanks all for your reviews and time.

Powered by Google App Engine
This is Rietveld 408576698