Title: [164737] trunk/Source/WebKit2
Revision
164737
Author
[email protected]
Date
2014-02-26 12:39:06 -0800 (Wed, 26 Feb 2014)

Log Message

[iOS][WebKit2] Adopt SPI for managing tabs
https://bugs.webkit.org/show_bug.cgi?id=129188
<rdar://problem/15939827>

Reviewed by Gavin Barraclough.

Call into assertions SPI to mark tabs as foreground and background.

* Configurations/WebKit2.xcconfig:
* Platform/IPC/Connection.h:
(IPC::Connection::xpcConnection): Expose the xpc_connection_t.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::viewStateDidChange):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::didFinishLaunching):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::updateProcessState):
* UIProcess/ios/WebProcessProxyIOS.mm:
(WebKit::WebProcessProxy::updateProcessState): Added. This goes through the list of
WebPageProxies and sets the process state to foreground if one of them is in a window.
Otherwise, it sets it to background.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (164736 => 164737)


--- trunk/Source/WebKit2/ChangeLog	2014-02-26 20:18:30 UTC (rev 164736)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-26 20:39:06 UTC (rev 164737)
@@ -1,3 +1,27 @@
+2014-02-26  Pratik Solanki  <[email protected]>
+
+        [iOS][WebKit2] Adopt SPI for managing tabs
+        https://bugs.webkit.org/show_bug.cgi?id=129188
+        <rdar://problem/15939827>
+
+        Reviewed by Gavin Barraclough.
+
+        Call into assertions SPI to mark tabs as foreground and background.
+
+        * Configurations/WebKit2.xcconfig:
+        * Platform/IPC/Connection.h:
+        (IPC::Connection::xpcConnection): Expose the xpc_connection_t.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::viewStateDidChange):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::didFinishLaunching):
+        * UIProcess/WebProcessProxy.h:
+        (WebKit::WebProcessProxy::updateProcessState):
+        * UIProcess/ios/WebProcessProxyIOS.mm:
+        (WebKit::WebProcessProxy::updateProcessState): Added. This goes through the list of
+        WebPageProxies and sets the process state to foreground if one of them is in a window.
+        Otherwise, it sets it to background.
+
 2014-02-26  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r164725 and r164731.

Modified: trunk/Source/WebKit2/Configurations/WebKit2.xcconfig (164736 => 164737)


--- trunk/Source/WebKit2/Configurations/WebKit2.xcconfig	2014-02-26 20:18:30 UTC (rev 164736)
+++ trunk/Source/WebKit2/Configurations/WebKit2.xcconfig	2014-02-26 20:39:06 UTC (rev 164737)
@@ -30,7 +30,7 @@
 DYLIB_INSTALL_NAME_BASE = $(NORMAL_WEBKIT2_FRAMEWORKS_DIR);
 
 FRAMEWORK_AND_LIBRARY_LDFLAGS = $(FRAMEWORK_AND_LIBRARY_LDFLAGS_$(PLATFORM_NAME));
-FRAMEWORK_AND_LIBRARY_LDFLAGS_iphonesimulator = -lobjc -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework UIKit -framework WebKit -lMobileGestalt;
+FRAMEWORK_AND_LIBRARY_LDFLAGS_iphonesimulator = -lobjc -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework UIKit -framework WebKit -lMobileGestalt -lassertion_extension;
 FRAMEWORK_AND_LIBRARY_LDFLAGS_iphoneos = $(FRAMEWORK_AND_LIBRARY_LDFLAGS_iphonesimulator) -framework IOSurface;
 FRAMEWORK_AND_LIBRARY_LDFLAGS_macosx = -framework ApplicationServices -framework Carbon -framework Cocoa -framework CoreServices -framework IOKit -framework CoreAudio -framework IOSurface;
 

Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (164736 => 164737)


--- trunk/Source/WebKit2/Platform/IPC/Connection.h	2014-02-26 20:18:30 UTC (rev 164736)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.h	2014-02-26 20:39:06 UTC (rev 164737)
@@ -113,6 +113,8 @@
         xpc_connection_t xpcConnection;
     };
     static bool identifierIsNull(Identifier identifier) { return identifier.port == MACH_PORT_NULL; }
+    xpc_connection_t xpcConnection() { return m_xpcConnection; }
+
 #elif USE(UNIX_DOMAIN_SOCKETS)
     typedef int Identifier;
     static bool identifierIsNull(Identifier identifier) { return !identifier; }

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (164736 => 164737)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-26 20:18:30 UTC (rev 164736)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-26 20:39:06 UTC (rev 164737)
@@ -1025,6 +1025,9 @@
     }
 #endif
 
+    if (changed & ViewState::IsInWindow)
+        process().updateProcessState();
+
     updateBackingStoreDiscardableState();
 }
 

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (164736 => 164737)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2014-02-26 20:18:30 UTC (rev 164736)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2014-02-26 20:39:06 UTC (rev 164737)
@@ -453,6 +453,7 @@
 #if PLATFORM(COCOA)
     updateProcessSuppressionState();
 #endif
+    updateProcessState();
 }
 
 WebFrameProxy* WebProcessProxy::webFrame(uint64_t frameID) const

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (164736 => 164737)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h	2014-02-26 20:18:30 UTC (rev 164736)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h	2014-02-26 20:39:06 UTC (rev 164737)
@@ -127,6 +127,8 @@
 
     void windowServerConnectionStateChanged();
 
+    void updateProcessState();
+
 private:
     explicit WebProcessProxy(WebContext&);
 
@@ -212,7 +214,11 @@
 
     int m_numberOfTimesSuddenTerminationWasDisabled;
 };
-    
+
+#if !PLATFORM(IOS)
+void WebProcessProxy::updateProcessState() { }
+#endif
+
 } // namespace WebKit
 
 #endif // WebProcessProxy_h

Modified: trunk/Source/WebKit2/UIProcess/ios/WebProcessProxyIOS.mm (164736 => 164737)


--- trunk/Source/WebKit2/UIProcess/ios/WebProcessProxyIOS.mm	2014-02-26 20:18:30 UTC (rev 164736)
+++ trunk/Source/WebKit2/UIProcess/ios/WebProcessProxyIOS.mm	2014-02-26 20:39:06 UTC (rev 164737)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "WebProcessProxy.h"
 
+#import <assertion/extension_private.h>
 #import <WebCore/NotImplemented.h>
 
 namespace WebKit {
@@ -68,4 +69,27 @@
     notImplemented();
 }
 
+void WebProcessProxy::updateProcessState()
+{
+#if USE(XPC_SERVICES)
+    if (!isValid())
+        return;
+
+    xpc_connection_t xpcConnection = connection()->xpcConnection();
+    if (!xpcConnection)
+        return;
+
+    assertion_extension_state_t extensionState = ASSERTION_EXTENSION_STATE_BACKGROUND;
+    for (const auto& page : m_pageMap.values()) {
+        if (page->isInWindow()) {
+            extensionState = ASSERTION_EXTENSION_STATE_FOREGROUND;
+            break;
+        }
+    }
+
+    errno_t tabStateError = assertion_extension_set_state(xpcConnection, extensionState, NULL);
+    ASSERT_UNUSED(tabStateError, !tabStateError);
+#endif
+}
+
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to