RESOLVED FIXED 94996
[chromium] Clean up dependencies of WebScrollbar and WebScrollbarLayer
https://bugs.webkit.org/show_bug.cgi?id=94996
Summary [chromium] Clean up dependencies of WebScrollbar and WebScrollbarLayer
James Robinson
Reported 2012-08-24 18:46:38 PDT
[chromium] Clean up dependencies of WebScrollbar and WebScrollbarLayer
Attachments
Patch (25.82 KB, patch)
2012-08-24 18:48 PDT, James Robinson
enne: review+
enne: commit-queue-
James Robinson
Comment 1 2012-08-24 18:48:29 PDT
James Robinson
Comment 2 2012-08-24 18:48:49 PDT
Enne - I wasn't sure if this was already on your plate or not, but it wasn't too hard so I went ahead and did it.
WebKit Review Bot
Comment 3 2012-08-24 18:51:17 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Adrienne Walker
Comment 4 2012-08-27 09:38:14 PDT
Comment on attachment 160540 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=160540&action=review R=me. Thanks for taking care of this. > Source/Platform/chromium/public/WebScrollbarLayer.h:42 > + // This takes ownership of the provided WebScrollbar. > + WEBKIT_EXPORT static WebScrollbarLayer* create(WebScrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>); No need for a comment--make the WebScrollbar a PassOwnPtr too like the geometry. It's weird to be inconsistent about ownership transfer. > Source/WebCore/platform/chromium/support/WebScrollbarImpl.h:38 > + explicit WebScrollbarImpl(WebCore::Scrollbar*); Can you add a static create function that returns a PassOwnPtr so you don't have to adoptPtr it all over the place?
James Robinson
Comment 5 2012-08-27 10:06:08 PDT
(In reply to comment #4) > (From update of attachment 160540 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=160540&action=review > > R=me. Thanks for taking care of this. > > > Source/Platform/chromium/public/WebScrollbarLayer.h:42 > > + // This takes ownership of the provided WebScrollbar. > > + WEBKIT_EXPORT static WebScrollbarLayer* create(WebScrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>); > > No need for a comment--make the WebScrollbar a PassOwnPtr too like the geometry. It's weird to be inconsistent about ownership transfer. Can't do that - you can't expect users of the WebKit API to have access to PassOwnPtr since it's in WTF and we have no equivalent concept in the public API. I have to kill the other PassOwnPtr as well soon. > > > Source/WebCore/platform/chromium/support/WebScrollbarImpl.h:38 > > + explicit WebScrollbarImpl(WebCore::Scrollbar*); > > Can you add a static create function that returns a PassOwnPtr so you don't have to adoptPtr it all over the place? No, you can't PassOwnPtr<> through the WebKit API
Adrienne Walker
Comment 6 2012-08-27 10:13:04 PDT
(In reply to comment #5) > (In reply to comment #4) > > (From update of attachment 160540 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=160540&action=review > > > > R=me. Thanks for taking care of this. > > > > > Source/Platform/chromium/public/WebScrollbarLayer.h:42 > > > + // This takes ownership of the provided WebScrollbar. > > > + WEBKIT_EXPORT static WebScrollbarLayer* create(WebScrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>); > > > > No need for a comment--make the WebScrollbar a PassOwnPtr too like the geometry. It's weird to be inconsistent about ownership transfer. > > Can't do that - you can't expect users of the WebKit API to have access to PassOwnPtr since it's in WTF and we have no equivalent concept in the public API. I have to kill the other PassOwnPtr as well soon. Ok, sure. I still think you should be consistent here, one way or the other. > > > Source/WebCore/platform/chromium/support/WebScrollbarImpl.h:38 > > > + explicit WebScrollbarImpl(WebCore::Scrollbar*); > > > > Can you add a static create function that returns a PassOwnPtr so you don't have to adoptPtr it all over the place? > > No, you can't PassOwnPtr<> through the WebKit API What's wrong with PassOwnPtr here?
Adrienne Walker
Comment 7 2012-08-27 10:43:32 PDT
(In reply to comment #6) > (In reply to comment #5) > > (In reply to comment #4) > > > (From update of attachment 160540 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=160540&action=review > > > > > > R=me. Thanks for taking care of this. > > > > > > > Source/Platform/chromium/public/WebScrollbarLayer.h:42 > > > > + // This takes ownership of the provided WebScrollbar. > > > > + WEBKIT_EXPORT static WebScrollbarLayer* create(WebScrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>); > > > > > > No need for a comment--make the WebScrollbar a PassOwnPtr too like the geometry. It's weird to be inconsistent about ownership transfer. > > > > Can't do that - you can't expect users of the WebKit API to have access to PassOwnPtr since it's in WTF and we have no equivalent concept in the public API. I have to kill the other PassOwnPtr as well soon. > > Ok, sure. I still think you should be consistent here, one way or the other. Actually, this is in WebScrollbarLayerImpl, so why not use PassOwnPtr?
James Robinson
Comment 8 2012-08-27 11:02:47 PDT
Comment on attachment 160540 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=160540&action=review >>>>> Source/Platform/chromium/public/WebScrollbarLayer.h:42 >>>>> + WEBKIT_EXPORT static WebScrollbarLayer* create(WebScrollbar*, WebScrollbarThemePainter, PassOwnPtr<WebScrollbarThemeGeometry>); >>>> >>>> No need for a comment--make the WebScrollbar a PassOwnPtr too like the geometry. It's weird to be inconsistent about ownership transfer. >>> >>> Can't do that - you can't expect users of the WebKit API to have access to PassOwnPtr since it's in WTF and we have no equivalent concept in the public API. I have to kill the other PassOwnPtr as well soon. >> >> Ok, sure. I still think you should be consistent here, one way or the other. > > Actually, this is in WebScrollbarLayerImpl, so why not use PassOwnPtr? Not sure what you mean. This header is public/WebScrollbarLayer.h, so I can't use PassOwnPtr<> here. >>>> Source/WebCore/platform/chromium/support/WebScrollbarImpl.h:38 >>>> + explicit WebScrollbarImpl(WebCore::Scrollbar*); >>> >>> Can you add a static create function that returns a PassOwnPtr so you don't have to adoptPtr it all over the place? >> >> No, you can't PassOwnPtr<> through the WebKit API > > What's wrong with PassOwnPtr here? This constructor is only called by the implementation of WebScrollbarLayer::create(). I could make this PassOwnPtr<> and implement WebScrollbarLayer::create() thusly: return WebScrollbarLayerImpl::create(...).leakPtr(); but that doesn't seem worth it. The adoptPtr()s are all around the return value of WebScrollbarLayer::create(), not around this constructor, so I couldn't remove any
Adrienne Walker
Comment 9 2012-08-27 13:18:21 PDT
Ah, you're right on both counts. Sorry, I was thinking about this backwards. Having OwnPtr stuff (for now) on both sides of the Platform API but not crossing it is super confusing.
James Robinson
Comment 10 2012-08-27 13:20:27 PDT
No kidding! I think I can write a PassOwnPtr<> equiv that crosses the API boundary, will mess around with that a bit. It'd be great to get type safety for these functions that transfer ownership. Probably not worth holding the rest of this up, however.
James Robinson
Comment 11 2012-08-27 13:54:47 PDT
WebPassOwnPtr<> in https://bugs.webkit.org/show_bug.cgi?id=95040 should help on both counts. I'll land this as-is and convert to smart API types once we get those sorted out.
James Robinson
Comment 12 2012-08-27 15:01:18 PDT
James Robinson
Comment 13 2012-08-27 15:05:15 PDT
(In reply to comment #12) > Committed r126803: <http://trac.webkit.org/changeset/126803> Landed with raw pointers everywhere. I'll convert over the WebPassOwnPtr<> where possible when bug 95040 lands - still figuring out some type details on that.
Note You need to log in before you can comment on or make changes to this bug.