WebCore uses the main thread to process sleep notifications
<rdar://problem/8495374>
Created attachment 69383 [details] Patch
Comment on attachment 69383 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=69383&action=review > WebCore/platform/mac/SharedTimerMac.mm:40 > +#define IOKIT_CAN_USE_LIBDISPATCH 1 I’d like this to be reversed. Maybe IOKIT_WITHOUT_LIBDISPATCH? > WebCore/platform/mac/SharedTimerMac.mm:67 > + static void systemPowerCallback(void* context, io_service_t service, uint32_t messageType, void* messageArgument); > + void systemPowerCallback(io_service_t service, uint32_t messageType, void* messageArgument); The argument name service could be left out in these two function declarations. > WebCore/platform/mac/SharedTimerMac.mm:143 > +#ifdef IOKIT_CAN_USE_LIBDISPATCH > + // We need to call the timer functions on the main thread. > + CFRunLoopPerformBlock(CFRunLoopGetMain(), kCFRunLoopCommonModes, ^() { > +#endif > > - if (WebCore::sharedTimer) { > - WebCore::stopSharedTimer(); > - WebCore::timerFired(0, 0); > + if (sharedTimer) { > + stopSharedTimer(); > + timerFired(0, 0); > } > + > +#ifdef IOKIT_CAN_USE_LIBDISPATCH > + }); > +#endif > } You could do this more cleanly if the body here was a member function. Then you could call it in the block and in the #else and not feel the need to use #if in this fancier way.
Comment on attachment 69383 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=69383&action=review > WebCore/WebCore.xcodeproj/project.pbxproj:20875 > + developmentRegion = English; Please don’t commit this. > WebCore/platform/mac/SharedTimerMac.mm:30 > +#import <IOKit/pwr_mgt/IOPMLib.h> > +#import <IOKit/IOMessage.h> I comes before p. > WebCore/platform/mac/SharedTimerMac.mm:67 > + void systemPowerCallback(io_service_t service, uint32_t messageType, void* messageArgument); This is not a great name for this method.
Committed r68836: <http://trac.webkit.org/changeset/68836>