Bug 134293

Summary: [Mac] Update the time base of event's timestamp when the system time changes
Product: WebKit Reporter: Benjamin Poulain <benjamin>
Component: New BugsAssignee: Benjamin Poulain <benjamin>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, bunhere, cdumez, commit-queue, gyuyoung.kim, sergio
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Benjamin Poulain 2014-06-24 23:56:26 PDT
[Mac] Update the time base of event's timestamp when the system time changes
Comment 1 Benjamin Poulain 2014-06-25 00:01:41 PDT
Created attachment 233793 [details]
Patch
Comment 2 WebKit Commit Bot 2014-06-25 00:03:08 PDT
Attachment 233793 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/mac/PlatformEventFactoryMac.mm:332:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebCore/platform/mac/PlatformEventFactoryMac.mm:332:  Missing space before {  [whitespace/braces] [5]
ERROR: Source/WebCore/platform/mac/PlatformEventFactoryMac.mm:338:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebCore/platform/mac/PlatformEventFactoryMac.mm:339:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebCore/platform/mac/PlatformEventFactoryMac.mm:340:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 5 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Anders Carlsson 2014-06-25 07:18:22 PDT
Comment on attachment 233793 [details]
Patch

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

> Source/WebCore/platform/mac/PlatformEventFactoryMac.mm:332
> +        void (^updateBlock)(NSNotification *) = Block_copy(^(NSNotification *){ updateSystemStartupTimeIntervalSince1970(); });

There's no need to copy the block, it will be copied by addObserverForName. I'd just use a lambda instead of a block too (they're implicitly converted to blocks, so something like):

auto updateBlock = [](NSNotification *) { updateSystemStartupTimeIntervalSince1970(); };
Comment 4 Benjamin Poulain 2014-06-25 09:40:15 PDT
(In reply to comment #3)
> (From update of attachment 233793 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=233793&action=review
> 
> > Source/WebCore/platform/mac/PlatformEventFactoryMac.mm:332
> > +        void (^updateBlock)(NSNotification *) = Block_copy(^(NSNotification *){ updateSystemStartupTimeIntervalSince1970(); });
> 
> There's no need to copy the block, it will be copied by addObserverForName. I'd just use a lambda instead of a block too (they're implicitly converted to blocks, so something like):

The reason I did that is to avoid having the block copied twice with 2 separate heap allocation.
Comment 5 Benjamin Poulain 2014-06-25 13:42:45 PDT
Comment on attachment 233793 [details]
Patch

Clearing flags on attachment: 233793

Committed r170434: <http://trac.webkit.org/changeset/170434>
Comment 6 Benjamin Poulain 2014-06-25 13:42:49 PDT
All reviewed patches have been landed.  Closing bug.