Title: [213430] trunk/Source/WebKit2
Revision
213430
Author
[email protected]
Date
2017-03-04 14:39:47 -0800 (Sat, 04 Mar 2017)

Log Message

[iOS] The web process should inherit application state from UI process
https://bugs.webkit.org/show_bug.cgi?id=169156
<rdar://problem/30845473>

Reviewed by Alexey Proskuryakov.

* Platform/spi/ios/CelestialSPI.h: Added.

* WebKit2.xcodeproj/project.pbxproj: Include CelestialSPI.h.

* WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist: Add entitlement.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::platformInitialize): Set up PID proxying.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (213429 => 213430)


--- trunk/Source/WebKit2/ChangeLog	2017-03-04 21:49:30 UTC (rev 213429)
+++ trunk/Source/WebKit2/ChangeLog	2017-03-04 22:39:47 UTC (rev 213430)
@@ -1,3 +1,20 @@
+2017-03-04  Eric Carlson  <[email protected]>
+
+        [iOS] The web process should inherit application state from UI process
+        https://bugs.webkit.org/show_bug.cgi?id=169156
+        <rdar://problem/30845473>
+
+        Reviewed by Alexey Proskuryakov.
+
+        * Platform/spi/ios/CelestialSPI.h: Added.
+
+        * WebKit2.xcodeproj/project.pbxproj: Include CelestialSPI.h.
+
+        * WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist: Add entitlement.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::platformInitialize): Set up PID proxying.
+
 2017-03-04  Aakash Jain  <[email protected]>
 
         Add symbols required by TAPI from Shared/API/Cocoa/WebKit.m in a header file

Added: trunk/Source/WebKit2/Platform/spi/ios/CelestialSPI.h (0 => 213430)


--- trunk/Source/WebKit2/Platform/spi/ios/CelestialSPI.h	                        (rev 0)
+++ trunk/Source/WebKit2/Platform/spi/ios/CelestialSPI.h	2017-03-04 22:39:47 UTC (rev 213430)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if PLATFORM(IOS)
+
+#pragma once
+
+#import <Foundation/Foundation.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <Celestial/AVSystemController.h>
+
+#else
+
+@interface AVSystemController : NSObject
+
++(AVSystemController*)sharedAVSystemController;
+
+- (id)attributeForKey:(NSString *)attributeKey;
+- (BOOL)setAttribute:(id)value forKey:(NSString *)attributeKey error:(NSError **)errorPtr;
+
+@end
+
+#endif
+
+#endif // PLATFORM(IOS)

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (213429 => 213430)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2017-03-04 21:49:30 UTC (rev 213429)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2017-03-04 22:39:47 UTC (rev 213430)
@@ -2154,6 +2154,7 @@
 		076E884F1A13CBC6005E90FC /* APIInjectedBundlePageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIInjectedBundlePageContextMenuClient.h; sourceTree = "<group>"; };
 		07A5EBB91C7BA43E00B9CA69 /* WKFrameHandleRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKFrameHandleRef.cpp; sourceTree = "<group>"; };
 		07A5EBBA1C7BA43E00B9CA69 /* WKFrameHandleRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFrameHandleRef.h; sourceTree = "<group>"; };
+		07A8F3861E64A8F900B668E8 /* CelestialSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CelestialSPI.h; sourceTree = "<group>"; };
 		0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
 		089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		0F08CF511D63C13A00B48DF1 /* WKFormSelectPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKFormSelectPicker.h; path = ios/forms/WKFormSelectPicker.h; sourceTree = "<group>"; };
@@ -7760,6 +7761,7 @@
 		CE1A0BCB1A48E6C60054EF74 /* ios */ = {
 			isa = PBXGroup;
 			children = (
+				07A8F3861E64A8F900B668E8 /* CelestialSPI.h */,
 				CE1A0BCC1A48E6C60054EF74 /* AssertionServicesSPI.h */,
 				CDA041F31ACE2105004A13EC /* BackBoardServicesSPI.h */,
 				CE1A0BCD1A48E6C60054EF74 /* CorePDFSPI.h */,

Modified: trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist (213429 => 213430)


--- trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist	2017-03-04 21:49:30 UTC (rev 213429)
+++ trunk/Source/WebKit2/WebProcess/EntryPoint/mac/XPCService/WebContentService/Info-iOS.plist	2017-03-04 22:39:47 UTC (rev 213430)
@@ -41,5 +41,7 @@
 	<array>
 		<string>audio</string>
 	</array>
+	<key>CanInheritApplicationStateFromOtherProcesses</key>
+	<true/>
 </dict>
 </plist>

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (213429 => 213430)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2017-03-04 21:49:30 UTC (rev 213429)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2017-03-04 22:39:47 UTC (rev 213430)
@@ -30,6 +30,7 @@
 
 #import "AccessibilityIOS.h"
 #import "AssistedNodeInformation.h"
+#import "CelestialSPI.h"
 #import "DataReference.h"
 #import "DrawingArea.h"
 #import "EditingRange.h"
@@ -98,6 +99,7 @@
 #import <WebCore/RenderView.h>
 #import <WebCore/Settings.h>
 #import <WebCore/SharedBuffer.h>
+#import <WebCore/SoftLinking.h>
 #import <WebCore/StyleProperties.h>
 #import <WebCore/TextIndicator.h>
 #import <WebCore/TextIterator.h>
@@ -109,6 +111,14 @@
 #import <wtf/MemoryPressureHandler.h>
 #import <wtf/SetForScope.h>
 
+SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(Celestial)
+
+SOFT_LINK_CLASS_OPTIONAL(Celestial, AVSystemController)
+
+SOFT_LINK_CONSTANT_MAY_FAIL(Celestial, AVSystemController_PIDToInheritApplicationStateFrom, NSString *)
+
+#define AVSystemController_PIDToInheritApplicationStateFrom getAVSystemController_PIDToInheritApplicationStateFrom()
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -119,6 +129,14 @@
 void WebPage::platformInitialize()
 {
     platformInitializeAccessibility();
+
+    if (canLoadAVSystemController_PIDToInheritApplicationStateFrom()) {
+        pid_t pid = WebProcess::singleton().presenterApplicationPid();
+        NSError *error = nil;
+        [[getAVSystemControllerClass() sharedAVSystemController] setAttribute:@(pid) forKey:AVSystemController_PIDToInheritApplicationStateFrom error:&error];
+        if (error)
+            WTFLogAlways("Failed to set up PID proxying: %s", [[error localizedDescription] UTF8String]);
+    }
 }
 
 void WebPage::platformDetach()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to