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

Issue 15004024: Only use skia::RefPtr for refcounting (Closed)

Created:
7 years, 7 months ago by enne (OOO)
Modified:
7 years, 7 months ago
CC:
chromium-reviews, cc-bugs_chromium.org, darin-cc_chromium.org, Tom Hudson, ccameron
Visibility:
Public.

Description

Only use skia::RefPtr for refcounting For consistency and sanity in Chromium, only use skia::RefPtr in Chromium to ref count skia classes. SkRefPtr is unsafe to use for newly created objects because it refs the object that is passed to its constructor. skia::RefPtr makes this adoption explicit it via skia::AdoptRef and so is much clearer. This patch also adds a skia::ShareRef function which makes it explicit that the callsite is adopting a ref which is already owned somewhere else. Using AdoptRef vs. ShareRef seems much clearer than using SkRefPtr vs. skia::RefPtr. These are the remaining code sites that use internal Skia reference counted classes. Once these have been removed, then we can use a PRESUBMIT rule to prevent new uses from being added. BUG=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=200989

Patch Set 1 #

Total comments: 10

Patch Set 2 : Add missing files oops #

Total comments: 3

Patch Set 3 : Comment rewording #

Total comments: 8

Patch Set 4 : Comment changes, SharePtr #

Unified diffs Side-by-side diffs Delta from patch set Stats (+187 lines, -121 lines) Patch
M cc/cc_tests.gyp View 1 chunk +2 lines, -0 lines 0 comments Download
M cc/resources/picture_pile_impl_unittest.cc View 2 chunks +2 lines, -55 lines 0 comments Download
M cc/resources/picture_unittest.cc View 2 chunks +1 line, -49 lines 0 comments Download
A cc/test/skia_common.h View 1 1 chunk +62 lines, -0 lines 0 comments Download
A cc/test/skia_common.cc View 1 1 chunk +82 lines, -0 lines 0 comments Download
M printing/pdf_metafile_skia.cc View 4 chunks +6 lines, -5 lines 0 comments Download
M skia/ext/refptr.h View 1 2 3 3 chunks +23 lines, -3 lines 0 comments Download
M ui/gfx/render_text.h View 2 chunks +2 lines, -1 line 0 comments Download
M ui/gfx/render_text.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M webkit/plugins/ppapi/ppapi_plugin_instance.h View 2 chunks +2 lines, -2 lines 0 comments Download
M webkit/plugins/ppapi/ppapi_plugin_instance.cc View 1 2 3 3 chunks +3 lines, -3 lines 0 comments Download
M webkit/renderer/compositor_bindings/web_layer_impl.cc View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
enne (OOO)
danakj: for cc/ and webkit/renderer/compositor/bindings/ vandebo: for skia/ext/ and printing/ piman: for webkit/plugins/ppapi/ xji: for ...
7 years, 7 months ago (2013-05-17 00:47:44 UTC) #1
piman
LGTM+nit https://codereview.chromium.org/15004024/diff/1/skia/ext/refptr.h File skia/ext/refptr.h (right): https://codereview.chromium.org/15004024/diff/1/skia/ext/refptr.h#newcode108 skia/ext/refptr.h:108: // For pointers that are already ref'd by ...
7 years, 7 months ago (2013-05-17 01:04:20 UTC) #2
vandebo (ex-Chrome)
It's worth noting that Skia no long uses SkRefPtr. With this CL, the last uses ...
7 years, 7 months ago (2013-05-17 01:12:30 UTC) #3
enne (OOO)
On 2013/05/17 01:12:30, vandebo wrote: > It's worth noting that Skia no long uses SkRefPtr. ...
7 years, 7 months ago (2013-05-17 01:23:33 UTC) #4
enne (OOO)
On 2013/05/17 01:23:33, enne wrote: > Skia starts its reference counting at ref count of ...
7 years, 7 months ago (2013-05-17 01:24:42 UTC) #5
piman
https://codereview.chromium.org/15004024/diff/1011/skia/ext/refptr.h File skia/ext/refptr.h (right): https://codereview.chromium.org/15004024/diff/1011/skia/ext/refptr.h#newcode108 skia/ext/refptr.h:108: // For pointers that are already ref'd by at ...
7 years, 7 months ago (2013-05-17 01:42:13 UTC) #6
danakj
On Thu, May 16, 2013 at 9:12 PM, <vandebo@chromium.org> wrote: > It's worth noting that ...
7 years, 7 months ago (2013-05-17 13:52:54 UTC) #7
danakj
LGTM https://codereview.chromium.org/15004024/diff/1011/cc/resources/picture_pile_impl_unittest.cc File cc/resources/picture_pile_impl_unittest.cc (right): https://codereview.chromium.org/15004024/diff/1011/cc/resources/picture_pile_impl_unittest.cc#newcode9 cc/resources/picture_pile_impl_unittest.cc:9: #include "skia/ext/refptr.h" unused? https://codereview.chromium.org/15004024/diff/1011/skia/ext/refptr.h File skia/ext/refptr.h (right): https://codereview.chromium.org/15004024/diff/1011/skia/ext/refptr.h#newcode108 ...
7 years, 7 months ago (2013-05-17 13:56:55 UTC) #8
vandebo (ex-Chrome)
Note, I think this is a good change and I'm glad you're cleaning up the ...
7 years, 7 months ago (2013-05-17 20:47:49 UTC) #9
enne (OOO)
vandebo: Thanks for all the feedback. This is clearly a confusing bit of code, so ...
7 years, 7 months ago (2013-05-17 21:37:01 UTC) #10
vandebo (ex-Chrome)
LGTM https://codereview.chromium.org/15004024/diff/1/skia/ext/refptr.h File skia/ext/refptr.h (right): https://codereview.chromium.org/15004024/diff/1/skia/ext/refptr.h#newcode110 skia/ext/refptr.h:110: RefPtr<T> ShareRef(T* ptr) { return RefPtr<T>(SkSafeRef(ptr)); } On ...
7 years, 7 months ago (2013-05-18 00:06:02 UTC) #11
enne (OOO)
msw / xji: ui/gfx/render_text OWNERS review?
7 years, 7 months ago (2013-05-18 00:11:52 UTC) #12
msw
ui/gfx/render_text.* LGTM
7 years, 7 months ago (2013-05-18 00:44:24 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/enne@chromium.org/15004024/18001
7 years, 7 months ago (2013-05-18 02:47:50 UTC) #14
commit-bot: I haz the power
7 years, 7 months ago (2013-05-18 09:40:27 UTC) #15
Message was sent while issue was closed.
Change committed as 200989

Powered by Google App Engine
This is Rietveld 408576698