Bug 23207

Summary: Move currentTime() from WebCore into WTF (to use in WTF::MessageQueue::WaitForMessageTimed)
Product: WebKit Reporter: Dmitry Titov <dimich>
Component: Web Template FrameworkAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 22718    
Attachments:
Description Flags
Proposed patch
darin: review+
Updated patch none

Description Dmitry Titov 2009-01-08 22:25:37 PST
Combined implementations of currentTime() from several platform-dependent files in WebCore/platform and from JSC/runtime/DateMath.cpp into JSC/WTF/CurrentTime.(h,cpp)

This brings all implementations close to each other, eliminates duplication and allows to sue currentTime() anywhere in the project, including WTF itself, in particulr to implement WTF::MessageQueue::WaitForMessageTimed and correct implementation of ThreadCondition::waitTimed() - those changes are following.
Comment 1 Dmitry Titov 2009-01-08 23:24:32 PST
Created attachment 26560 [details]
Proposed patch

Although there are many files, most of the files in this patch only have a different header file included.
Comment 2 Darin Adler 2009-01-10 14:34:23 PST
Comment on attachment 26560 [details]
Proposed patch

> +// Platform note: GTK should use gettimeofday everywhere except WIN, where 

Sentence fragment here. Also, I think it might be better to put this comment after the includes rather than in the middle of them.

> +#if PLATFORM(MAC)
> +double currentTime()
> +{
> +    return CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970;
> +}
> +#elif PLATFORM(WIN)

I think some blank lines here would make it easier to read. The per-platform sections are large enough that a little more vertical whitespace will make it easier to spot the boundaries.

r=me
Comment 3 Dmitry Titov 2009-01-10 18:34:19 PST
Created attachment 26596 [details]
Updated patch

Fixed comment, whitespaces and resolved against current tree.
Seems to be ready for landing.
Comment 4 Alexey Proskuryakov 2009-01-11 00:15:57 PST
Committed revision 39784.