From 52657f6d8188d091335f056c3c2a8bf0893fd99e Mon Sep 17 00:00:00 2001 From: "enne@chromium.org" Date: Mon, 20 May 2013 05:30:31 +0000 Subject: Forbid unwanted Skia ref-counting containers skia::RefPtr is the closest Chromium construct to scoped_refptr and also the safest Skia refcounting class. To avoid other people continually shooting themselves in the face mistaking SkRefPtr for skia::RefPtr (one of which refs the pointer you give it and the other doesn't), ban this in Chromium via global PRESUBMIT. The Skia team also prefers to keep the SkAutoTUnref template private (see discussion here: https://codereview.appspot.com/6849109/), so prefer SkRefPtr over that as well. Finally, SkAutoUnref and SkAutoRef are both templates that support SkRefPtr and SkAutoTUnref, so make sure these are unused as well. R=maruel@chromium.org BUG=none Review URL: https://chromiumcodereview.appspot.com/15063008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201029 0039d316-1c4b-4281-b951-d872f2087c98 --- PRESUBMIT.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index e61f385..3418265 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -160,6 +160,43 @@ _BANNED_CPP_FUNCTIONS = ( r"^net[\\\/]disk_cache[\\\/]cache_util\.cc$", ), ), + ( + 'SkRefPtr', + ( + 'The use of SkRefPtr is prohibited. ', + 'Please use skia::RefPtr instead.' + ), + True, + (), + ), + ( + 'SkAutoRef', + ( + 'The indirect use of SkRefPtr via SkAutoRef is prohibited. ', + 'Please use skia::RefPtr instead.' + ), + True, + (), + ), + ( + 'SkAutoTUnref', + ( + 'The use of SkAutoTUnref is dangerous because it implicitly ', + 'converts to a raw pointer. Please use skia::RefPtr instead.' + ), + True, + (), + ), + ( + 'SkAutoUnref', + ( + 'The indirect use of SkAutoTUnref through SkAutoUnref is dangerous ', + 'because it implicitly converts to a raw pointer. ', + 'Please use skia::RefPtr instead.' + ), + True, + (), + ), ) -- cgit v1.1