Add abilility to specify presentingApplicationPID for a WebProcessPool.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2017 19:04:59 +0000 (19:04 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2017 19:04:59 +0000 (19:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172839
rdar://problem/32247170

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-06-02
Reviewed by Tim Horton.

Expose presentingApplicationPID through WebProcessPoolConfiguration.
This allows rehosted WebViews to specify the hosting application.

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration setPresentingApplicationPID:]):
(-[_WKProcessPoolConfiguration presentingApplicationPID]):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::createNewWebProcess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217728 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit2/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit2/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h
Source/WebKit2/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
Source/WebKit2/UIProcess/WebProcessPool.cpp

index 08fd1b7..ab9c570 100644 (file)
@@ -1,3 +1,25 @@
+2017-06-02  Jeremy Jones  <jeremyj@apple.com>
+
+        Add abilility to specify presentingApplicationPID for a WebProcessPool.
+        https://bugs.webkit.org/show_bug.cgi?id=172839
+        rdar://problem/32247170
+
+        Reviewed by Tim Horton.
+
+        Expose presentingApplicationPID through WebProcessPoolConfiguration.
+        This allows rehosted WebViews to specify the hosting application.
+
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::copy):
+        * UIProcess/API/APIProcessPoolConfiguration.h:
+        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h:
+        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
+        (-[_WKProcessPoolConfiguration setPresentingApplicationPID:]):
+        (-[_WKProcessPoolConfiguration presentingApplicationPID]):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::ensureNetworkProcess):
+        (WebKit::WebProcessPool::createNewWebProcess):
+
 2017-06-02  Frederic Wang  <fwang@igalia.com>
 
         [Mac] Use compositing for frames when ScrollingTreeIncludesFrames=true
index 2338ba3..3bf2a1c 100644 (file)
@@ -123,6 +123,7 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
 #if PLATFORM(IOS)
     copy->m_ctDataConnectionServiceType = this->m_ctDataConnectionServiceType;
 #endif
+    copy->m_presentingApplicationPID = this->m_presentingApplicationPID;
     
     return copy;
 }
index e442b13..c29da20 100644 (file)
@@ -131,6 +131,9 @@ public:
     void setCTDataConnectionServiceType(const WTF::String& ctDataConnectionServiceType) { m_ctDataConnectionServiceType = ctDataConnectionServiceType; }
 #endif
 
+    pid_t presentingApplicationPID() const { return m_presentingApplicationPID; }
+    void setPresentingApplicationPID(pid_t pid) { m_presentingApplicationPID = pid; }
+
 private:
     bool m_shouldHaveLegacyDataStore { false };
 
@@ -162,6 +165,7 @@ private:
     bool m_alwaysRunsAtBackgroundPriority { false };
     bool m_shouldTakeUIBackgroundAssertion { true };
     bool m_shouldCaptureAudioInUIProcess { false };
+    pid_t m_presentingApplicationPID { getpid() };
 #if PLATFORM(IOS)
     WTF::String m_ctDataConnectionServiceType;
 #endif
index eb52dd2..8a3969e 100644 (file)
@@ -56,7 +56,7 @@ WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0))
 @property (nonatomic) BOOL alwaysRunsAtBackgroundPriority WK_API_AVAILABLE(ios(WK_IOS_TBA));
 @property (nonatomic) BOOL shouldTakeUIBackgroundAssertion WK_API_AVAILABLE(ios(WK_IOS_TBA));
 #endif
-
+@property (nonatomic) pid_t presentingApplicationPID WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @end
 
index 10d2812..3792287 100644 (file)
     _processPoolConfiguration->setShouldCaptureAudioInUIProcess(shouldCaptureAudioInUIProcess);
 }
 
+- (void)setPresentingApplicationPID:(pid_t)presentingApplicationPID
+{
+    _processPoolConfiguration->setPresentingApplicationPID(presentingApplicationPID);
+}
+
+- (pid_t)presentingApplicationPID
+{
+    return _processPoolConfiguration->presentingApplicationPID();
+}
+
 #if PLATFORM(IOS)
 - (NSString *)CTDataConnectionServiceType
 {
index 26f5b2b..c6e70c6 100644 (file)
@@ -460,7 +460,7 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess()
 #endif
 
     parameters.shouldUseTestingNetworkSession = m_shouldUseTestingNetworkSession;
-    parameters.presentingApplicationPID = getpid();
+    parameters.presentingApplicationPID = m_configuration->presentingApplicationPID();
 
     // Add any platform specific parameters
     platformInitializeNetworkProcess(parameters);
@@ -753,7 +753,7 @@ WebProcessProxy& WebProcessPool::createNewWebProcess(WebsiteDataStore& websiteDa
     parameters.shouldCaptureAudioInUIProcess = m_configuration->shouldCaptureAudioInUIProcess();
 #endif
 
-    parameters.presentingApplicationPID = getpid();
+    parameters.presentingApplicationPID = m_configuration->presentingApplicationPID();
 
     // Add any platform specific parameters
     platformInitializeWebProcess(parameters);