WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
178514
RenderLayerCompositor: Move implementation of simple methods into the header file.
https://bugs.webkit.org/show_bug.cgi?id=178514
Summary
RenderLayerCompositor: Move implementation of simple methods into the header ...
Frédéric Wang (:fredw)
Reported
2017-10-19 07:39:16 PDT
RenderLayerCompositor: Move implementation of simple methods into the header file.
Attachments
Patch
(22.63 KB, patch)
2017-10-19 07:46 PDT
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Patch for landing
(5.38 KB, patch)
2017-10-20 00:22 PDT
,
Frédéric Wang (:fredw)
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Frédéric Wang (:fredw)
Comment 1
2017-10-19 07:46:16 PDT
Created
attachment 324226
[details]
Patch
Frédéric Wang (:fredw)
Comment 2
2017-10-19 07:51:14 PDT
Comment on
attachment 324226
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=324226&action=review
> Source/WebCore/ChangeLog:10 > + use RenderLayer.h and ChromeClient.h which are already required by RenderLayerCompositor.h
Note to reviewers: I mean, I'm not sure whether it's a good idea to move the bodies of methods that actually require RenderLayer.h and ChromeClient.h. WDYT?
Darin Adler
Comment 3
2017-10-19 09:27:19 PDT
Comment on
attachment 324226
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=324226&action=review
> Source/WebCore/ChangeLog:3 > + RenderLayerCompositor: Move implementation of simple methods into the header file.
I am OK moving these function bodies into the header file. But I personally would slightly prefer that these be kept as separate function bodies with the "inline" keyword rather than moving them into the class definition for four reasons: 1) Separate function bodies makes it easier to later refactor if we are reducing includes, moving them back into the implementation file removing "inline" or moving them into an inlines file. 2) Separate function bodies can cut down on distractions in the class definition and make it easier to focus on what the interface of the class is. It’s especially hard to read through a class if there are multi-line function implementations interspersed in the interface. 3) Separate function bodies avoid the need to comment out argument names for unused arguments. 4) Longer function bodies like useCoordinatedScrollingForLayer can turn into quite long lines that aren’t so easy to read. Of course, there are arguments in favor of putting the function definitions into the class definition: a) For short functions this is much more terse and keeps the overall source code smaller. b) For short functions having the definition right there can help make it clear exactly what a function does. But I personally think (1)-(4) outweigh (a)-(b).
>> Source/WebCore/ChangeLog:10 >> + use RenderLayer.h and ChromeClient.h which are already required by RenderLayerCompositor.h > > Note to reviewers: I mean, I'm not sure whether it's a good idea to move the bodies of methods that actually require RenderLayer.h and ChromeClient.h. WDYT?
I think it’s fine to either move these function bodies into the header, or to do the work to remove the need to include RenderLayer.h and ChromeClient.h. I don’t think we need to leave them out of the header just because of the possibility that some day we want to remove the includes.
Frédéric Wang (:fredw)
Comment 4
2017-10-19 09:39:30 PDT
Comment on
attachment 324226
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=324226&action=review
>> Source/WebCore/ChangeLog:3 >> + RenderLayerCompositor: Move implementation of simple methods into the header file. > > I am OK moving these function bodies into the header file. > > But I personally would slightly prefer that these be kept as separate function bodies with the "inline" keyword rather than moving them into the class definition for four reasons: > > 1) Separate function bodies makes it easier to later refactor if we are reducing includes, moving them back into the implementation file removing "inline" or moving them into an inlines file. > > 2) Separate function bodies can cut down on distractions in the class definition and make it easier to focus on what the interface of the class is. It’s especially hard to read through a class if there are multi-line function implementations interspersed in the interface. > > 3) Separate function bodies avoid the need to comment out argument names for unused arguments. > > 4) Longer function bodies like useCoordinatedScrollingForLayer can turn into quite long lines that aren’t so easy to read. > > Of course, there are arguments in favor of putting the function definitions into the class definition: > > a) For short functions this is much more terse and keeps the overall source code smaller. > > b) For short functions having the definition right there can help make it clear exactly what a function does. > > But I personally think (1)-(4) outweigh (a)-(b).
Thanks. I was also not quite sure about this. However, I believe that for the straightforward setter/getter of class members like scrollLayer() or setTracksRepaints(), (1)-(4) do not really apply. So I guess I'll upload a simplified patch to handle only these cases and use "inline" for other functions.
Simon Fraser (smfr)
Comment 5
2017-10-19 14:11:22 PDT
Comment on
attachment 324226
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=324226&action=review
I don't really see the point of this kind of change unless you've identified that functions need to inline for performance reasons.
> Source/WebCore/rendering/RenderLayerCompositor.h:339 > + WEBCORE_EXPORT void startTrackingLayerFlushes() { m_layerFlushCount = 0; } > + WEBCORE_EXPORT unsigned layerFlushCount() const { return m_layerFlushCount; }
You can't export an inline function.
> Source/WebCore/rendering/RenderLayerCompositor.h:342 > + WEBCORE_EXPORT void startTrackingCompositingUpdates() { m_compositingUpdateCount = 0; } > + WEBCORE_EXPORT unsigned compositingUpdateCount() const { return m_compositingUpdateCount; }
Ditto.
Frédéric Wang (:fredw)
Comment 6
2017-10-19 23:48:36 PDT
(In reply to Simon Fraser (smfr) from
comment #5
)
> Comment on
attachment 324226
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=324226&action=review
> > I don't really see the point of this kind of change unless you've identified > that functions need to inline for performance reasons.
What Darin said in (a)-(b). As I said, I'll probably restrict the change to straigthforward setters/getters. Or otherwise WONTFIX this...
Frédéric Wang (:fredw)
Comment 7
2017-10-20 00:22:18 PDT
Created
attachment 324367
[details]
Patch for landing
WebKit Commit Bot
Comment 8
2017-10-20 01:30:35 PDT
Comment on
attachment 324367
[details]
Patch for landing Clearing flags on attachment: 324367 Committed
r223749
: <
https://trac.webkit.org/changeset/223749
>
WebKit Commit Bot
Comment 9
2017-10-20 01:30:37 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 10
2017-11-15 13:05:03 PST
<
rdar://problem/35568754
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug