Bug 146259

Summary: Add a class that tracks whether we're a background or foreground application
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, commit-queue, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review+

Description Anders Carlsson 2015-06-23 16:35:35 PDT
Add a class that tracks whether we're a background or foreground application
Comment 1 Anders Carlsson 2015-06-23 16:38:24 PDT
Created attachment 255448 [details]
Patch
Comment 2 WebKit Commit Bot 2015-06-23 16:41:13 PDT
Attachment 255448 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/ApplicationStateTracker.mm:51:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/WebKit2/UIProcess/ApplicationStateTracker.mm:55:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 2 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Darin Adler 2015-06-23 17:12:43 PDT
Comment on attachment 255448 [details]
Patch

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

> Source/WebKit2/UIProcess/ApplicationStateTracker.h:45
> +    void addListener(id, SEL willEnterForegroundSelector, SEL didEnterBackgroundSelector);

Why not blocks instead of id/SEL?

> Source/WebKit2/UIProcess/ios/WKContentView.mm:213
> +    ApplicationStateTracker::singleton().addListener(self, @selector(_applicationDidEnterBackground), @selector(_applicationWillEnterForeground));

Need WebCore:: here or in a using above.
Comment 4 Anders Carlsson 2015-06-23 17:23:31 PDT
(In reply to comment #3)
> Comment on attachment 255448 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=255448&action=review
> 
> > Source/WebKit2/UIProcess/ApplicationStateTracker.h:45
> > +    void addListener(id, SEL willEnterForegroundSelector, SEL didEnterBackgroundSelector);
> 
> Why not blocks instead of id/SEL?

Because I didn't want to have to think about retain cycles and figure out a way to remove the observers. (That's done automatically).

> 
> > Source/WebKit2/UIProcess/ios/WKContentView.mm:213
> > +    ApplicationStateTracker::singleton().addListener(self, @selector(_applicationDidEnterBackground), @selector(_applicationWillEnterForeground));
> 
> Need WebCore:: here or in a using above.

Yes (Well, WebKit::).
Comment 5 Anders Carlsson 2015-06-23 17:51:23 PDT
Committed r185894: <http://trac.webkit.org/changeset/185894>