Bug 77885 - Use CMClock as a timing source for PlatformClock where available.
Summary: Use CMClock as a timing source for PlatformClock where available.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-06 11:07 PST by Jer Noble
Modified: 2012-02-07 12:48 PST (History)
1 user (show)

See Also:


Attachments
Patch (14.05 KB, patch)
2012-02-06 11:17 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (13.85 KB, patch)
2012-02-06 11:18 PST, Jer Noble
eric.carlson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2012-02-06 11:07:54 PST
Use CMClock as a timing source for PlatformClock where available.
Comment 1 Jer Noble 2012-02-06 11:17:08 PST
Created attachment 125671 [details]
Patch
Comment 2 Jer Noble 2012-02-06 11:18:40 PST
Created attachment 125672 [details]
Patch
Comment 3 Eric Carlson 2012-02-07 08:29:59 PST
Comment on attachment 125672 [details]
Patch

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

> Source/WebCore/platform/mac/PlatformClockCM.mm:48
> +static const int32_t DefaultTimeScale = 1000;

Please include a comment explaining why 1000 is the best magic timescale.

> Source/WebCore/platform/mac/PlatformClockCM.mm:57
> +    CMAudioDeviceClockCreate(kCFAllocatorDefault, NULL, &rawClockPtr);
> +    RetainPtr<CMClockRef> clock(AdoptCF, rawClockPtr);
> +    initializeWithTimingSource(clock.get());

Is the temporary RetainPtr necessary?
Comment 4 Jer Noble 2012-02-07 09:53:49 PST
(In reply to comment #3)
> (From update of attachment 125672 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=125672&action=review
> 
> > Source/WebCore/platform/mac/PlatformClockCM.mm:48
> > +static const int32_t DefaultTimeScale = 1000;
> 
> Please include a comment explaining why 1000 is the best magic timescale.

Sure thing.

> > Source/WebCore/platform/mac/PlatformClockCM.mm:57
> > +    CMAudioDeviceClockCreate(kCFAllocatorDefault, NULL, &rawClockPtr);
> > +    RetainPtr<CMClockRef> clock(AdoptCF, rawClockPtr);
> > +    initializeWithTimingSource(clock.get());
> 
> Is the temporary RetainPtr necessary?

Not strictly, no.  But the RetainPtr takes care of null-checking before calling CFRelease, and does so even if an exception is thrown.  And I've been yelled at* for not using RetainPtrs for temporary variables before. ;)

*figuratively
Comment 5 Jer Noble 2012-02-07 12:48:47 PST
Committed r106978: <http://trac.webkit.org/changeset/106978>