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

Issue 72603005: Guard against most unintentionally ephemeral SkAutoFoo instantiations. (Closed)

Created:
7 years, 1 month ago by mtklein
Modified:
7 years, 1 month ago
Reviewers:
caryclark, reed1
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

Guard against most unintentionally ephemeral SkAutoFoo instantiations. I think I applied the trick everywhere possible. Limitations: - can't be used with templated classes - all constructors and destructors must be defined inline A couple of the SkAutoFoo were unused in Skia, Chromium, and Android, so I deleted them. This change caught the same bugs Cary found in SkPath, plus one more in SampleApp. BUG= Committed: http://code.google.com/p/skia/source/detail?r=12301

Patch Set 1 #

Patch Set 2 : prettier #

Patch Set 3 : finish up #

Total comments: 1

Patch Set 4 : docs and REQUIRE_LOCAL_VAR #

Total comments: 3

Patch Set 5 : undo autoasciitolc #

Unified diffs Side-by-side diffs Delta from patch set Stats (+61 lines, -69 lines) Patch
M include/core/SkBitmap.h View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
M include/core/SkCanvas.h View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
M include/core/SkMask.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkPicture.h View 1 chunk +0 lines, -20 lines 0 comments Download
M include/core/SkRefCnt.h View 1 2 3 2 chunks +3 lines, -0 lines 0 comments Download
M include/core/SkString.h View 1 chunk +0 lines, -18 lines 0 comments Download
M include/core/SkThread.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkTime.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkTypes.h View 1 2 3 4 chunks +29 lines, -0 lines 0 comments Download
M include/core/SkUtils.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M samplecode/SampleLayers.cpp View 1 chunk +1 line, -1 line 0 comments Download
M src/core/SkBlitter.cpp View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/core/SkCanvas.cpp View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/core/SkComposeShader.cpp View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/core/SkDescriptor.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/core/SkDraw.cpp View 1 2 3 3 chunks +9 lines, -9 lines 0 comments Download
M src/core/SkGlyphCache.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/core/SkPath.cpp View 1 2 3 3 chunks +3 lines, -0 lines 0 comments Download
M src/core/SkRasterClip.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/core/SkString.cpp View 1 chunk +0 lines, -21 lines 0 comments Download
M src/ports/SkFontHost_win.cpp View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/utils/mac/SkCreateCGImageRef.cpp View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 20 (0 generated)
mtklein
7 years, 1 month ago (2013-11-14 16:43:13 UTC) #1
caryclark
lgtm -- my change to add fix SkPath.cpp is winding its way through the commit ...
7 years, 1 month ago (2013-11-14 16:50:33 UTC) #2
reed1
can we have a macro that creates this macro? e.g. DECLARE_GUARD_CONSTRUCTOR(myclass)
7 years, 1 month ago (2013-11-14 18:30:51 UTC) #3
mtklein
On 2013/11/14 18:30:51, reed1 wrote: > can we have a macro that creates this macro? ...
7 years, 1 month ago (2013-11-14 18:53:34 UTC) #4
bungeman-skia
Is it possible to use variadic macros to do this (which would be a nice ...
7 years, 1 month ago (2013-11-14 20:56:06 UTC) #5
mtklein
On 2013/11/14 20:56:06, bungeman1 wrote: > Is it possible to use variadic macros to do ...
7 years, 1 month ago (2013-11-15 14:33:34 UTC) #6
bungeman-skia
On 2013/11/15 14:33:34, mtklein wrote: > On 2013/11/14 20:56:06, bungeman1 wrote: > > Is it ...
7 years, 1 month ago (2013-11-15 15:15:50 UTC) #7
mtklein
On 2013/11/15 15:15:50, bungeman1 wrote: > On 2013/11/15 14:33:34, mtklein wrote: > > On 2013/11/14 ...
7 years, 1 month ago (2013-11-15 15:26:46 UTC) #8
bungeman-skia
On 2013/11/15 15:26:46, mtklein wrote: > On 2013/11/15 15:15:50, bungeman1 wrote: > > On 2013/11/15 ...
7 years, 1 month ago (2013-11-15 15:38:16 UTC) #9
mtklein
On 2013/11/15 15:38:16, bungeman1 wrote: > On 2013/11/15 15:26:46, mtklein wrote: > > On 2013/11/15 ...
7 years, 1 month ago (2013-11-15 17:19:40 UTC) #10
caryclark
lgtm
7 years, 1 month ago (2013-11-15 17:23:37 UTC) #11
caryclark
lgtm
7 years, 1 month ago (2013-11-15 17:23:39 UTC) #12
reed1
https://codereview.chromium.org/72603005/diff/110002/include/core/SkTypes.h File include/core/SkTypes.h (right): https://codereview.chromium.org/72603005/diff/110002/include/core/SkTypes.h#newcode152 include/core/SkTypes.h:152: // It's almost always a bug to create an ...
7 years, 1 month ago (2013-11-15 17:41:39 UTC) #13
mtklein
On 2013/11/15 17:41:39, reed1 wrote: > https://codereview.chromium.org/72603005/diff/110002/include/core/SkTypes.h > File include/core/SkTypes.h (right): > > https://codereview.chromium.org/72603005/diff/110002/include/core/SkTypes.h#newcode152 > ...
7 years, 1 month ago (2013-11-15 17:44:16 UTC) #14
mtklein
updated
7 years, 1 month ago (2013-11-15 17:58:44 UTC) #15
reed1
https://codereview.chromium.org/72603005/diff/100002/include/core/SkTSearch.h File include/core/SkTSearch.h (right): https://codereview.chromium.org/72603005/diff/100002/include/core/SkTSearch.h#newcode129 include/core/SkTSearch.h:129: SkAutoAsciiToLC(const char str[], size_t len = (size_t)-1) { Not ...
7 years, 1 month ago (2013-11-15 18:20:11 UTC) #16
mtklein
Yep, you caught me looking for SkAuto*. https://codereview.chromium.org/72603005/diff/100002/include/core/SkTSearch.h File include/core/SkTSearch.h (right): https://codereview.chromium.org/72603005/diff/100002/include/core/SkTSearch.h#newcode129 include/core/SkTSearch.h:129: SkAutoAsciiToLC(const char ...
7 years, 1 month ago (2013-11-15 18:28:13 UTC) #17
reed1
lgtm
7 years, 1 month ago (2013-11-15 18:40:31 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/mtklein@google.com/72603005/300001
7 years, 1 month ago (2013-11-18 15:52:00 UTC) #19
commit-bot: I haz the power
7 years, 1 month ago (2013-11-18 16:04:09 UTC) #20
Message was sent while issue was closed.
Change committed as 12301

Powered by Google App Engine
This is Rietveld 408576698