Bug 77885

Summary: Use CMClock as a timing source for PlatformClock where available.
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: New BugsAssignee: Jer Noble <jer.noble>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch eric.carlson: review+

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>