Changeset 255222 in webkit


Ignore:
Timestamp:
Jan 27, 2020 7:09:35 PM (4 years ago)
Author:
david_quesada@apple.com
Message:

Support observing a different set of view service state notifications in ApplicationStateTracker
https://bugs.webkit.org/show_bug.cgi?id=201737
rdar://problem/54786414

Reviewed by Chris Dumez.

  • UIProcess/ApplicationStateTracker.mm:

Make ApplicationStateTracker conditionally (based on a flag to be defined in WebKitAdditions)
use a different pair of notifications when it is in a view service or extension. These
notifications report state changes of the individual scene that hosts the web view, rather
than the state of the overall host application. This allows for more accurate state tracking
for web views in extensions or view services hosted by apps with multiple open scenes.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r255220 r255222  
     12020-01-27  David Quesada  <david_quesada@apple.com>
     2
     3        Support observing a different set of view service state notifications in ApplicationStateTracker
     4        https://bugs.webkit.org/show_bug.cgi?id=201737
     5        rdar://problem/54786414
     6
     7        Reviewed by Chris Dumez.
     8
     9        * UIProcess/ApplicationStateTracker.mm:
     10        Make ApplicationStateTracker conditionally (based on a flag to be defined in WebKitAdditions)
     11        use a different pair of notifications when it is in a view service or extension. These
     12        notifications report state changes of the individual scene that hosts the web view, rather
     13        than the state of the overall host application. This allows for more accurate state tracking
     14        for web views in extensions or view services hosted by apps with multiple open scenes.
     15
    1162020-01-27  Alex Christensen  <achristensen@webkit.org>
    217
  • trunk/Source/WebKit/UIProcess/ApplicationStateTracker.mm

    r250187 r255222  
    4141@end
    4242
     43#if HAVE(UISCENE_BASED_VIEW_SERVICE_STATE_NOTIFICATIONS)
     44static NSNotificationName const viewServiceBackgroundNotificationName = @"_UIViewServiceHostSceneDidEnterBackgroundNotification";
     45static NSNotificationName const viewServiceForegroundNotificationName = @"_UIViewServiceHostSceneWillEnterForegroundNotification";
     46#else
     47static NSNotificationName const viewServiceBackgroundNotificationName = @"_UIViewServiceHostDidEnterBackgroundNotification";
     48static NSNotificationName const viewServiceForegroundNotificationName = @"_UIViewServiceHostWillEnterForegroundNotification";
     49#endif
     50
    4351namespace WebKit {
    4452
     
    169177        RELEASE_LOG(ProcessSuspension, "%{public}s has PID %d, host application PID: %d, isInBackground: %d", _UIApplicationIsExtension() ? "Extension" : "ViewService", getpid(), applicationPID, m_isInBackground);
    170178
    171         m_didEnterBackgroundObserver = [notificationCenter addObserverForName:@"_UIViewServiceHostDidEnterBackgroundNotification" object:serviceViewController queue:nil usingBlock:[this, applicationPID](NSNotification *) {
     179        m_didEnterBackgroundObserver = [notificationCenter addObserverForName:viewServiceBackgroundNotificationName object:serviceViewController queue:nil usingBlock:[this, applicationPID](NSNotification *) {
    172180            RELEASE_LOG(ProcessSuspension, "%{public}s has PID %d, host application PID: %d, didEnterBackground", _UIApplicationIsExtension() ? "Extension" : "ViewService", getpid(), applicationPID);
    173181            applicationDidEnterBackground();
    174182        }];
    175         m_willEnterForegroundObserver = [notificationCenter addObserverForName:@"_UIViewServiceHostWillEnterForegroundNotification" object:serviceViewController queue:nil usingBlock:[this, applicationPID](NSNotification *) {
     183        m_willEnterForegroundObserver = [notificationCenter addObserverForName:viewServiceForegroundNotificationName object:serviceViewController queue:nil usingBlock:[this, applicationPID](NSNotification *) {
    176184            RELEASE_LOG(ProcessSuspension, "%{public}s has PID %d, host application PID: %d, willEnterForeground", _UIApplicationIsExtension() ? "Extension" : "ViewService", getpid(), applicationPID);
    177185            applicationWillEnterForeground();
Note: See TracChangeset for help on using the changeset viewer.