WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
217552
Clean up CAAudioStreamDescription
https://bugs.webkit.org/show_bug.cgi?id=217552
Summary
Clean up CAAudioStreamDescription
Peng Liu
Reported
2020-10-09 20:29:44 PDT
Clean up CAAudioStreamDescription
Attachments
Patch
(7.52 KB, patch)
2020-10-09 20:44 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Fix crashes in layout tests
(8.49 KB, patch)
2020-10-10 14:29 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Patch
(1.34 KB, patch)
2020-10-23 16:28 PDT
,
Peng Liu
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Peng Liu
Comment 1
2020-10-09 20:44:14 PDT
Created
attachment 411004
[details]
Patch
Peng Liu
Comment 2
2020-10-10 14:29:25 PDT
Created
attachment 411020
[details]
Fix crashes in layout tests
youenn fablet
Comment 3
2020-10-12 03:06:17 PDT
Comment on
attachment 411020
[details]
Fix crashes in layout tests View in context:
https://bugs.webkit.org/attachment.cgi?id=411020&action=review
> Source/WebCore/ChangeLog:9 > + constructor and assignment operator because of the updates on the two getters.
Can you describe the benefit of this change?
> Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.cpp:117 > return m_platformDescription;
This is a potential change of behavior. m_streamDescription could for instance be modified (for instance using streamDescription() non const getter). This would make m_platformDescription out of sync.
> Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.cpp:122 > + return m_format;
Why removing the lazy init of m_format?
Peng Liu
Comment 4
2020-10-12 09:45:30 PDT
Comment on
attachment 411020
[details]
Fix crashes in layout tests View in context:
https://bugs.webkit.org/attachment.cgi?id=411020&action=review
>> Source/WebCore/ChangeLog:9 >> + constructor and assignment operator because of the updates on the two getters. > > Can you describe the benefit of this change?
Sure. I encountered some weirdness(linker errors) when I tried to move the WEBCORE_EXPORT from the class to methods, so I took a closer look and found this class looks strange. The class defines the function calculateFormat() but does not provide an implementation, and CAAudioStreamDescription::platformDescription() always needs to update m_platformDescription.
>> Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.cpp:117 >> return m_platformDescription; > > This is a potential change of behavior. > m_streamDescription could for instance be modified (for instance using streamDescription() non const getter). > This would make m_platformDescription out of sync.
Oops, sounds not a good encapsulation. Should we disable that possibility?
>> Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.cpp:122 >> + return m_format; > > Why removing the lazy init of m_format?
So it is just a lazy init? I thought we may need to do some unnecessary work whenever format() is called.
youenn fablet
Comment 5
2020-10-12 09:56:50 PDT
Comment on
attachment 411020
[details]
Fix crashes in layout tests View in context:
https://bugs.webkit.org/attachment.cgi?id=411020&action=review
>>> Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.cpp:117 >>> return m_platformDescription; >> >> This is a potential change of behavior. >> m_streamDescription could for instance be modified (for instance using streamDescription() non const getter). >> This would make m_platformDescription out of sync. > > Oops, sounds not a good encapsulation. Should we disable that possibility?
Actually, I was wrong here since we pass m_streamDescription as a pointer and not by value. If we can remove streamDescription() non const getter, we should probably do it in any case. I am not sure platformDescription is called much, so a lazy init seems fine here.
>>> Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.cpp:122 >>> + return m_format; >> >> Why removing the lazy init of m_format? > > So it is just a lazy init? I thought we may need to do some unnecessary work whenever format() is called.
It is a half lazy init. Agreed, it is a bit weird also since m_streamDescription could change but we would not change m_format accordingly if m_format is not None. I guess that to make it clearer, we could use an Optional<Format>.
Radar WebKit Bug Importer
Comment 6
2020-10-16 20:30:31 PDT
<
rdar://problem/70401637
>
Peng Liu
Comment 7
2020-10-23 15:40:27 PDT
Comment on
attachment 411020
[details]
Fix crashes in layout tests View in context:
https://bugs.webkit.org/attachment.cgi?id=411020&action=review
>>>> Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.cpp:122 >>>> + return m_format; >>> >>> Why removing the lazy init of m_format? >> >> So it is just a lazy init? I thought we may need to do some unnecessary work whenever format() is called. > > It is a half lazy init. Agreed, it is a bit weird also since m_streamDescription could change but we would not change m_format accordingly if m_format is not None. > I guess that to make it clearer, we could use an Optional<Format>.
Yeah, seems better to use an Optional<>. However, it won't solve the problem when m_streamDescription is changed by other objects.
Peng Liu
Comment 8
2020-10-23 16:28:34 PDT
Created
attachment 412215
[details]
Patch
Peng Liu
Comment 9
2020-10-26 09:46:31 PDT
Looks like it is not a good idea to refactor the CAAudioStreamDescription class now. Let’s remove the unused private function and close this bug.
EWS
Comment 10
2020-10-26 11:24:15 PDT
Committed
r268988
: <
https://trac.webkit.org/changeset/268988
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 412215
[details]
.
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