Bug 200936 - CaptureDeviceManager does not need to be CanMakeWeakPtr
Summary: CaptureDeviceManager does not need to be CanMakeWeakPtr
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-20 12:36 PDT by youenn fablet
Modified: 2019-08-22 04:06 PDT (History)
7 users (show)

See Also:


Attachments
Patch (7.90 KB, patch)
2019-08-20 12:43 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (7.88 KB, patch)
2019-08-21 04:29 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (7.10 KB, patch)
2019-08-21 13:54 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (7.10 KB, patch)
2019-08-22 02:21 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2019-08-20 12:36:57 PDT
CaptureDeviceManager does not need to be CanMakeWeakPtr
Comment 1 youenn fablet 2019-08-20 12:43:35 PDT
Created attachment 376792 [details]
Patch
Comment 2 youenn fablet 2019-08-21 04:29:52 PDT
Created attachment 376861 [details]
Patch
Comment 3 EWS Watchlist 2019-08-21 04:30:53 PDT
Attachment 376861 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:119:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Alex Christensen 2019-08-21 08:25:32 PDT
Comment on attachment 376861 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=376861&action=review

> Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:117
> +static inline AudioObjectPropertyListenerBlock createAudioObjectPropertyListenerBlock()

You could've just left this code where it is, removed the Block_copy, and replaced the call to weakThis->refreshAudioCaptureDevices() with CoreAudioCaptureDeviceManager::singleton().refreshAudioCaptureDevices().

> Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:51
> +    enum class NotifyIfDevicesHaveChanged { Notify, DoNotNotify };

I don't see why these need to be public now.
Comment 5 youenn fablet 2019-08-21 13:54:12 PDT
Created attachment 376916 [details]
Patch for landing
Comment 6 youenn fablet 2019-08-21 13:57:12 PDT
(In reply to Alex Christensen from comment #4)
> Comment on attachment 376861 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=376861&action=review
> 
> > Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:117
> > +static inline AudioObjectPropertyListenerBlock createAudioObjectPropertyListenerBlock()
> 
> You could've just left this code where it is, removed the Block_copy, and
> replaced the call to weakThis->refreshAudioCaptureDevices() with
> CoreAudioCaptureDeviceManager::singleton().refreshAudioCaptureDevices().

Sure, the idea was to make sure to not use this.

> > Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:51
> > +    enum class NotifyIfDevicesHaveChanged { Notify, DoNotNotify };
> 
> I don't see why these need to be public now.

Because the block is outside CoreAudioCaptureDeviceManager.
I reinlined the block and kept them private.
Comment 7 Alex Christensen 2019-08-21 14:51:07 PDT
Comment on attachment 376916 [details]
Patch for landing

View in context: https://bugs.webkit.org/attachment.cgi?id=376916&action=review

> Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:124
> +        auto listener = Block_copy(^(UInt32 count, const AudioObjectPropertyAddress properties[]) {

I think this Block_copy makes a leak.  Could you use BlockPtr?
Comment 8 youenn fablet 2019-08-22 02:21:51 PDT
Created attachment 377000 [details]
Patch for landing
Comment 9 EWS Watchlist 2019-08-22 02:23:04 PDT
Attachment 377000 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:124:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 WebKit Commit Bot 2019-08-22 04:05:56 PDT
Comment on attachment 377000 [details]
Patch for landing

Clearing flags on attachment: 377000

Committed r249002: <https://trac.webkit.org/changeset/249002>
Comment 11 WebKit Commit Bot 2019-08-22 04:05:58 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Radar WebKit Bug Importer 2019-08-22 04:06:16 PDT
<rdar://problem/54593543>