Bug 187402 - Make RealtimeOutgoingVideoSource use DestructionThread::Main
Summary: Make RealtimeOutgoingVideoSource use DestructionThread::Main
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: 2018-07-06 12:45 PDT by youenn fablet
Modified: 2018-07-06 16:45 PDT (History)
6 users (show)

See Also:


Attachments
Patch (2.18 KB, patch)
2018-07-06 12:49 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 2018-07-06 12:45:39 PDT
Make RealtimeOutgoingVideoSource use DestructionThread::Main
Comment 1 youenn fablet 2018-07-06 12:49:48 PDT
Created attachment 344442 [details]
Patch
Comment 2 Chris Dumez 2018-07-06 12:57:41 PDT
Comment on attachment 344442 [details]
Patch

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

> Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h:57
> +        auto result = hasOneRef() ? rtc::RefCountReleaseStatus::kDroppedLastRef : rtc::RefCountReleaseStatus::kOtherRefsRemained;

Is this thread safe? If Release() can be called from various threads, then a ref() / deref() can happen on another thread after your hasOneRef() check.
Comment 3 youenn fablet 2018-07-06 13:02:22 PDT
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=344442&action=review
> 
> > Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h:57
> > +        auto result = hasOneRef() ? rtc::RefCountReleaseStatus::kDroppedLastRef : rtc::RefCountReleaseStatus::kOtherRefsRemained;
> 
> Is this thread safe? If Release() can be called from various threads, then a
> ref() / deref() can happen on another thread after your hasOneRef() check.

Well, this whole API is not really thread safe but we need to return something as an API contract. Even if we return the true value at the time we did defer(), it will be useless for the caller, except maybe for logging.
 
I am fine continuing returning rtc::RefCountReleaseStatus::kOtherRefsRemained like done before.
Comment 4 WebKit Commit Bot 2018-07-06 16:30:28 PDT
Comment on attachment 344442 [details]
Patch

Clearing flags on attachment: 344442

Committed r233602: <https://trac.webkit.org/changeset/233602>
Comment 5 WebKit Commit Bot 2018-07-06 16:30:30 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2018-07-06 16:45:04 PDT
<rdar://problem/41914556>