WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
204320
Move [UIDevice currentDevice] calls to UI process
https://bugs.webkit.org/show_bug.cgi?id=204320
Summary
Move [UIDevice currentDevice] calls to UI process
Per Arne Vollan
Reported
2019-11-18 14:55:10 PST
Calling [UIDevice currentDevice] will cause the runningboard daemon to be accessed. Since this service will be removed from the WebContent sandbox, these calls should be moved to the UI process. For example, the function exernalDeviceDisplayNameForPlayer in MediaPlayerPrivateAVFoundationObjC.mm is calling [[PAL::getUIDeviceClass() currentDevice] localizedModel], which should be moved to the UI process.
Attachments
Patch
(23.02 KB, patch)
2020-02-13 16:04 PST
,
Per Arne Vollan
no flags
Details
Formatted Diff
Diff
Patch
(22.97 KB, patch)
2020-02-14 11:07 PST
,
Per Arne Vollan
no flags
Details
Formatted Diff
Diff
Patch
(23.00 KB, patch)
2020-02-17 11:12 PST
,
Per Arne Vollan
no flags
Details
Formatted Diff
Diff
Patch
(22.90 KB, patch)
2020-02-17 13:28 PST
,
Per Arne Vollan
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2019-11-18 14:55:37 PST
<
rdar://problem/57299885
>
Per Arne Vollan
Comment 2
2020-02-13 16:04:46 PST
Created
attachment 390700
[details]
Patch
Per Arne Vollan
Comment 3
2020-02-13 17:43:40 PST
Comment on
attachment 390700
[details]
Patch Needs more work.
Per Arne Vollan
Comment 4
2020-02-14 11:07:10 PST
Created
attachment 390787
[details]
Patch
Darin Adler
Comment 5
2020-02-16 16:49:06 PST
Comment on
attachment 390787
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=390787&action=review
Looks great, but one significant problem.
> Source/WebCore/platform/ios/LocalizedDeviceModel.mm:47 > + auto localizedDeviceModel = retainPtr([[PAL::getUIDeviceClass() currentDevice] localizedModel]);
This isn’t setting cachedLocalizedDeviceModel, and it should be setting it. Unless our intent is to never cache it? There should be no need to explicitly call retainPtr. It’s almost never something you have to call explicitly.
Per Arne Vollan
Comment 6
2020-02-17 11:12:24 PST
Created
attachment 390943
[details]
Patch
Per Arne Vollan
Comment 7
2020-02-17 11:14:48 PST
(In reply to Darin Adler from
comment #5
)
> Comment on
attachment 390787
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=390787&action=review
> > Looks great, but one significant problem. > > > Source/WebCore/platform/ios/LocalizedDeviceModel.mm:47 > > + auto localizedDeviceModel = retainPtr([[PAL::getUIDeviceClass() currentDevice] localizedModel]); > > This isn’t setting cachedLocalizedDeviceModel, and it should be setting it. > Unless our intent is to never cache it? >
Good point!
> There should be no need to explicitly call retainPtr. It’s almost never > something you have to call explicitly.
Thanks for reviewing! I have updated the patch accordingly.
Darin Adler
Comment 8
2020-02-17 12:36:20 PST
Comment on
attachment 390943
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=390943&action=review
review- before of the overrelease, otherwise looks great
> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:2737 > + displayName = [[NSString stringWithFormat:@"%@ %@", localizedDeviceModelName, displayName] autorelease];
The stringWithFormat function already returns something autoreleased. Calling autorelease on it a second time is going to overrelease it! Please do not do this. Could remove that extra space on this line after the "=" since you are touching this.
> Source/WebCore/platform/ios/LocalizedDeviceModel.h:30 > +#import <wtf/text/WTFString.h>
Only need to include Forward.h here. No need to include WTFString.h.
> Source/WebCore/platform/ios/LocalizedDeviceModel.mm:50 > + if (cachedLocalizedDeviceModel().hasValue()) > + return *cachedLocalizedDeviceModel(); > + > + auto localizedModel = String([[PAL::getUIDeviceClass() currentDevice] localizedModel]); > + cachedLocalizedDeviceModel() = localizedModel; > + > + return localizedModel;
Here’s how I think we should write this: auto& deviceModel = cachedLocalizedDeviceModel(); if (!deviceModel) deviceModel = String([[PAL::getUIDeviceClass() currentDevice] localizedModel]); return *deviceModel;
Darin Adler
Comment 9
2020-02-17 12:36:40 PST
(In reply to Darin Adler from
comment #8
)
> review- before of the overrelease, otherwise looks great
because of
Per Arne Vollan
Comment 10
2020-02-17 13:28:34 PST
Created
attachment 390964
[details]
Patch
Per Arne Vollan
Comment 11
2020-02-17 13:30:11 PST
(In reply to Darin Adler from
comment #8
)
> Comment on
attachment 390943
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=390943&action=review
> > review- before of the overrelease, otherwise looks great > > > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:2737 > > + displayName = [[NSString stringWithFormat:@"%@ %@", localizedDeviceModelName, displayName] autorelease]; > > The stringWithFormat function already returns something autoreleased. > Calling autorelease on it a second time is going to overrelease it! Please > do not do this. >
Ah, thanks for catching this!
> Could remove that extra space on this line after the "=" since you are > touching this. >
Done.
> > Source/WebCore/platform/ios/LocalizedDeviceModel.h:30 > > +#import <wtf/text/WTFString.h> > > Only need to include Forward.h here. No need to include WTFString.h. >
Fixed.
> > Source/WebCore/platform/ios/LocalizedDeviceModel.mm:50 > > + if (cachedLocalizedDeviceModel().hasValue()) > > + return *cachedLocalizedDeviceModel(); > > + > > + auto localizedModel = String([[PAL::getUIDeviceClass() currentDevice] localizedModel]); > > + cachedLocalizedDeviceModel() = localizedModel; > > + > > + return localizedModel; > > Here’s how I think we should write this: > > auto& deviceModel = cachedLocalizedDeviceModel(); > if (!deviceModel) > deviceModel = String([[PAL::getUIDeviceClass() currentDevice] > localizedModel]); > return *deviceModel;
Yes, that is much better :) Thanks for reviewing!
Per Arne Vollan
Comment 12
2020-02-18 09:30:52 PST
Comment on
attachment 390964
[details]
Patch Thanks for reviewing!
WebKit Commit Bot
Comment 13
2020-02-18 10:27:06 PST
Comment on
attachment 390964
[details]
Patch Clearing flags on attachment: 390964 Committed
r256839
: <
https://trac.webkit.org/changeset/256839
>
WebKit Commit Bot
Comment 14
2020-02-18 10:27:08 PST
All reviewed patches have been landed. Closing bug.
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