Bug 146259 - Add a class that tracks whether we're a background or foreground application
Summary: Add a class that tracks whether we're a background or foreground application
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-23 16:35 PDT by Anders Carlsson
Modified: 2015-06-23 17:51 PDT (History)
3 users (show)

See Also:


Attachments
Patch (19.94 KB, patch)
2015-06-23 16:38 PDT, Anders Carlsson
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>