Title: [168441] trunk/Source/WebKit2
Revision
168441
Author
m...@apple.com
Date
2014-05-07 14:57:06 -0700 (Wed, 07 May 2014)

Log Message

<rdar://problem/16831276> [iOS] Unparenting a WKWebView that’s loading pauses it
https://bugs.webkit.org/show_bug.cgi?id=132659

Reviewed by Tim Horton.

* UIProcess/Cocoa/NavigationState.h: Added a member variable.
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::didChangeIsLoading): When transitioning into loading state,
acquire a background activity token. When transitioning out of loading state, dispose of
the token.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (168440 => 168441)


--- trunk/Source/WebKit2/ChangeLog	2014-05-07 21:49:10 UTC (rev 168440)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-07 21:57:06 UTC (rev 168441)
@@ -1,3 +1,16 @@
+2014-05-07  Dan Bernstein  <m...@apple.com>
+
+        <rdar://problem/16831276> [iOS] Unparenting a WKWebView that’s loading pauses it
+        https://bugs.webkit.org/show_bug.cgi?id=132659
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/Cocoa/NavigationState.h: Added a member variable.
+        * UIProcess/Cocoa/NavigationState.mm:
+        (WebKit::NavigationState::didChangeIsLoading): When transitioning into loading state,
+        acquire a background activity token. When transitioning out of loading state, dispose of
+        the token.
+
 2014-05-07  Jeremy Jones  <jere...@apple.com>
 
         HTMLMediaElement should exitFullscreen when view is removed from the window.

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h (168440 => 168441)


--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h	2014-05-07 21:49:10 UTC (rev 168440)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h	2014-05-07 21:57:06 UTC (rev 168441)
@@ -35,6 +35,7 @@
 #import "APILoaderClient.h"
 #import "APIPolicyClient.h"
 #import "PageLoadState.h"
+#import "ProcessThrottler.h"
 #import "WeakObjCPtr.h"
 
 @class WKNavigation;
@@ -159,6 +160,10 @@
         bool webViewDidPerformServerRedirectFromURLToURL : 1;
         bool webViewDidUpdateHistoryTitleForURL : 1;
     } m_historyDelegateMethods;
+
+#if PLATFORM(IOS)
+    std::unique_ptr<ProcessThrottler::BackgroundActivityToken> m_activityToken;
+#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (168440 => 168441)


--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2014-05-07 21:49:10 UTC (rev 168440)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm	2014-05-07 21:57:06 UTC (rev 168441)
@@ -51,6 +51,7 @@
 #import "WKWebViewInternal.h"
 #import "WebFrameProxy.h"
 #import "WebPageProxy.h"
+#import "WebProcessProxy.h"
 #import <wtf/NeverDestroyed.h>
 
 #if USE(QUICK_LOOK)
@@ -625,6 +626,13 @@
 
 void NavigationState::didChangeIsLoading()
 {
+#if PLATFORM(IOS)
+    if (m_webView->_page->pageLoadState().isLoading())
+        m_activityToken = std::make_unique<ProcessThrottler::BackgroundActivityToken>(m_webView->_page->process().throttler());
+    else
+        m_activityToken = nullptr;
+#endif
+
     [m_webView didChangeValueForKey:@"loading"];
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to