WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
102405
Replace some trivial WebKitSystemInterface calls with direct SPI calls
https://bugs.webkit.org/show_bug.cgi?id=102405
Summary
Replace some trivial WebKitSystemInterface calls with direct SPI calls
Robert Sesek
Reported
2012-11-15 09:42:49 PST
Replace some trivial WebKitSystemInterface calls with direct SPI calls
Attachments
Patch
(14.70 KB, patch)
2012-11-15 09:52 PST
,
Robert Sesek
no flags
Details
Formatted Diff
Diff
Patch,v2
(7.05 KB, patch)
2012-12-07 13:48 PST
,
Robert Sesek
mrowe
: review-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Robert Sesek
Comment 1
2012-11-15 09:52:03 PST
Created
attachment 174471
[details]
Patch
mitz
Comment 2
2012-11-15 09:54:08 PST
Comment on
attachment 174471
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=174471&action=review
> Source/WebCore/platform/mac/SystemPrivateInterface.h:39 > +// Forward-declaring symbols is preferred to using the WebKitSystemIterface.
Why do you say this?
WebKit Review Bot
Comment 3
2012-11-15 09:54:10 PST
Attachment 174471
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/platform/mac/SystemPrivateInterface.h:42: _NSDrawCarbonThemeBezel is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Source/WebCore/platform/mac/SystemPrivateInterface.h:43: _NSDrawCarbonThemeListBox is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 2 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Robert Sesek
Comment 4
2012-11-15 09:54:43 PST
This is really an RFC to see what people think of this approach of reducing reliance on the WebKitSystemInterface (at least where code is shared between Chromium and Mac). In this patch, I centralized all the forward declares for the SPI into a single file, but I could also just forward-declare at each callsite. Another option would be to keep the wkFunction() pattern, but provide an implementation in code, rather than just linking in the opaque static library.
Robert Sesek
Comment 5
2012-11-15 09:56:25 PST
(In reply to
comment #2
)
> (From update of
attachment 174471
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=174471&action=review
> > > Source/WebCore/platform/mac/SystemPrivateInterface.h:39 > > +// Forward-declaring symbols is preferred to using the WebKitSystemIterface. > > Why do you say this?
There's an on-going discussion. This bug is to discuss if that's actually true, but I wrote the patch assuming it is. (In reply to
comment #3
)
>
Attachment 174471
[details]
did not pass style-queue: > > Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 > Source/WebCore/platform/mac/SystemPrivateInterface.h:42: _NSDrawCarbonThemeBezel is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] > Source/WebCore/platform/mac/SystemPrivateInterface.h:43: _NSDrawCarbonThemeListBox is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] > Total errors found: 2 in 9 files > > > If any of these errors are false positives, please file a bug against check-webkit-style.
I will pending the result of this discussion (if we want to move forward with doing this).
Alexey Proskuryakov
Comment 6
2012-11-15 10:24:40 PST
I don't think that we have reached consensus yet. Redeclaring SPIs has an extremely unfortunate consequence - if you get it wrong, or if the SPI changes later, compiler won't tell you about this, and the outcome will be a difficult to diagnose bug. It's something we've been doing for a long time with some SPIs (it mostly depended on personal preference whether to put something in WKSI or re-declare it), and the problem did happen before. Additionally, please note that these are not APIs, so they may not exist in past or future OS releases. This needs to be handled gracefully at runtime by builds that are intended to have a single binary for multiple OS versions.
Robert Sesek
Comment 7
2012-11-15 10:52:45 PST
(In reply to
comment #6
)
> I don't think that we have reached consensus yet. Redeclaring SPIs has an extremely unfortunate consequence - if you get it wrong, or if the SPI changes later, compiler won't tell you about this, and the outcome will be a difficult to diagnose bug.
OK. I'll relax the comment in the .h and maybe converting to direct SPI is something we only do in code shared by Chromium and Mac.
> It's something we've been doing for a long time with some SPIs (it mostly depended on personal preference whether to put something in WKSI or re-declare it), and the problem did happen before. > > Additionally, please note that these are not APIs, so they may not exist in past or future OS releases. This needs to be handled gracefully at runtime by builds that are intended to have a single binary for multiple OS versions.
Yes, and Chromium is one such example of having a single binary that runs across multiple versions. Maybe we should then keep the wkFunction() pattern, perhaps in a SPI:: namespace, to keep the runtime checks away from the direct callsite (or do we want the checks at the callsite?).
Maciej Stachowiak
Comment 8
2012-11-15 10:58:03 PST
Comment on
attachment 174471
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=174471&action=review
I like the direction of moving from WKSI use to SPI. Though, it might be worth a discussion on webkit-dev because I'm not sure everyone with an interest in this topic was on the private email thread about it. r- because this specific patch has some errors in it, as explained in line-by-line comments.
> Source/WebCore/platform/graphics/mac/FontCacheMac.mm:72 > + CGFontSetShouldUseMulticache();
This will break the build on future OS versions, can you skip this one for now? I can deal with it based on WKSI source.
> Source/WebCore/platform/mac/SystemPrivateInterface.h:35 > +// This file contains non-public functions in Mac system frameworks. These are
In the cases where WebKit already declares non-public symbols itself, we usually do it near the point of use, i.e. top of the same file. I am not sure it is a good direction to have one giant file of these, as each such individual symbol should be imported with caution. In particular, commenting the point of use in this file already makes it dependent on the point of use, but the association of point of use can bitrot.
>>> Source/WebCore/platform/mac/SystemPrivateInterface.h:39 >>> +// Forward-declaring symbols is preferred to using the WebKitSystemIterface. >> >> Why do you say this? > > There's an on-going discussion. This bug is to discuss if that's actually true, but I wrote the patch assuming it is. > > (In reply to
comment #3
)
I don't think this comment is useful. "Is preferred" gives the reader no information because it does not say who prefers it or why. I would suggest dropping it.
>> Source/WebCore/platform/mac/SystemPrivateInterface.h:42 >> +void _NSDrawCarbonThemeBezel(NSRect, BOOL enabled); > > _NSDrawCarbonThemeBezel is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
This declaration of _NSDrawCarbonThemeBezel is incorrect and the point of use is incorrect two (wrong parameters). If it works it is only by accident.
>> Source/WebCore/platform/mac/SystemPrivateInterface.h:43 >> +void _NSDrawCarbonThemeListBox(NSRect, BOOL enabled); > > _NSDrawCarbonThemeListBox is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4]
This declaration of _NSDrawCarbonThemeListBox is incorrect and the point of use is incorrect two (wrong parameters). If it works it is only by accident.
> Source/WebCore/rendering/RenderThemeMacShared.mm:726 > + _NSDrawCarbonThemeBezel(r, isEnabled(o) && !isReadOnlyControl(o));
This call is wrong, as mentioned previously.
> Source/WebCore/rendering/RenderThemeMacShared.mm:761 > + _NSDrawCarbonThemeListBox(r, isEnabled(o) && !isReadOnlyControl(o));
This call is wrong, as mentioned previously.
Maciej Stachowiak
Comment 9
2012-11-15 11:00:36 PST
(In reply to
comment #6
)
> I don't think that we have reached consensus yet. Redeclaring SPIs has an extremely unfortunate consequence - if you get it wrong, or if the SPI changes later, compiler won't tell you about this, and the outcome will be a difficult to diagnose bug. > > It's something we've been doing for a long time with some SPIs (it mostly depended on personal preference whether to put something in WKSI or re-declare it), and the problem did happen before. > > Additionally, please note that these are not APIs, so they may not exist in past or future OS releases. This needs to be handled gracefully at runtime by builds that are intended to have a single binary for multiple OS versions.
I'll just note for the record that, as the person who created WebKitSystemInterface, I personally would like to eliminate it entirely. I don't think the benefits over time have exceeded the costs, and many of the hypothetical reasons we wanted it in the first place have not really panned out.
Robert Sesek
Comment 10
2012-12-07 13:46:52 PST
Comment on
attachment 174471
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=174471&action=review
>> Source/WebCore/platform/graphics/mac/FontCacheMac.mm:72 >> + CGFontSetShouldUseMulticache(); > > This will break the build on future OS versions, can you skip this one for now? I can deal with it based on WKSI source.
Reverted
>> Source/WebCore/platform/mac/SystemPrivateInterface.h:35 >> +// This file contains non-public functions in Mac system frameworks. These are > > In the cases where WebKit already declares non-public symbols itself, we usually do it near the point of use, i.e. top of the same file. I am not sure it is a good direction to have one giant file of these, as each such individual symbol should be imported with caution. In particular, commenting the point of use in this file already makes it dependent on the point of use, but the association of point of use can bitrot.
OK. I've removed this file and now just declare in the files in which the functions are used.
>>> Source/WebCore/platform/mac/SystemPrivateInterface.h:42 >>> +void _NSDrawCarbonThemeBezel(NSRect, BOOL enabled); >> >> _NSDrawCarbonThemeBezel is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] > > This declaration of _NSDrawCarbonThemeBezel is incorrect and the point of use is incorrect two (wrong parameters). If it works it is only by accident.
Thanks for pointing that out. I should have checked the disassembly rather than assuming the signatures for the WK functions are the same. Updated, and below.
Robert Sesek
Comment 11
2012-12-07 13:48:55 PST
Created
attachment 178265
[details]
Patch,v2
Brent Fulgham
Comment 12
2013-06-17 23:38:48 PDT
I propose that we close this bug, since the main reason for it is no longer relevant now that the Blink project has forked.
Mark Rowe (bdash)
Comment 13
2013-06-17 23:59:24 PDT
Comment on
attachment 178265
[details]
Patch,v2 Marking as r- since the change as-is won't compile. It's also not clear that this is the direction we're interested in heading.
Brent Fulgham
Comment 14
2016-03-22 14:14:49 PDT
Comment on
attachment 178265
[details]
Patch,v2 View in context:
https://bugs.webkit.org/attachment.cgi?id=178265&action=review
> Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm:49 > +
This is now in CoreTextSPI.h, etc.
Brent Fulgham
Comment 15
2016-03-22 14:15:40 PDT
This was handled in a series of other commits. E.g.,
r175379
<
https://trac.webkit.org/changeset/175379
>.
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