Commit a6ea9385 authored by barraclough@apple.com's avatar barraclough@apple.com

Debug mechanism to override process QoS on Mac

https://bugs.webkit.org/show_bug.cgi?id=127455

Reviewed by Anders Carlsson.

* NetworkProcess/NetworkProcess.messages.in:
    - added message.
* PluginProcess/PluginProcess.messages.in:
    - added message.
* Shared/ChildProcess.h:
* Shared/mac/ChildProcessMac.mm:
(WebKit::ChildProcess::setQOS):
    - Added implementation of new message.
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::didFinishLaunching):
    - SetQOS for the PluginProcess.
* UIProcess/Plugins/PluginProcessProxy.h:
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::pluginProcessLatencyQOS):
(WebKit::pluginProcessThroughputQOS):
    - read NSUserDefaults.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::ensureNetworkProcess):
    - SetQOS for the NetworkProcess.
(WebKit::WebContext::createNewWebProcess):
    - SetQOS for the WebProcess.
* UIProcess/WebContext.h:
* UIProcess/mac/WebContextMac.mm:
(WebKit::networkProcessLatencyQOS):
(WebKit::networkProcessThroughputQOS):
(WebKit::webProcessLatencyQOS):
(WebKit::webProcessThroughputQOS):
    - read NSUserDefaults.
* WebProcess/WebProcess.messages.in:
    - added message.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7f23b89a
2014-01-22 Gavin Barraclough <barraclough@apple.com>
Debug mechanism to override process QoS on Mac
https://bugs.webkit.org/show_bug.cgi?id=127455
Reviewed by Anders Carlsson.
* NetworkProcess/NetworkProcess.messages.in:
- added message.
* PluginProcess/PluginProcess.messages.in:
- added message.
* Shared/ChildProcess.h:
* Shared/mac/ChildProcessMac.mm:
(WebKit::ChildProcess::setQOS):
- Added implementation of new message.
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::didFinishLaunching):
- SetQOS for the PluginProcess.
* UIProcess/Plugins/PluginProcessProxy.h:
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::pluginProcessLatencyQOS):
(WebKit::pluginProcessThroughputQOS):
- read NSUserDefaults.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::ensureNetworkProcess):
- SetQOS for the NetworkProcess.
(WebKit::WebContext::createNewWebProcess):
- SetQOS for the WebProcess.
* UIProcess/WebContext.h:
* UIProcess/mac/WebContextMac.mm:
(WebKit::networkProcessLatencyQOS):
(WebKit::networkProcessThroughputQOS):
(WebKit::webProcessLatencyQOS):
(WebKit::webProcessThroughputQOS):
- read NSUserDefaults.
* WebProcess/WebProcess.messages.in:
- added message.
2014-01-22 David Farler <dfarler@apple.com>
ASAN builds are broken - missing flags
......
......@@ -42,6 +42,7 @@ messages -> NetworkProcess LegacyReceiver {
#if PLATFORM(MAC)
SetProcessSuppressionEnabled(bool flag)
SetQOS(int latencyQOS, int throughputQOS)
#endif
AllowSpecificHTTPSCertificateForHost(WebCore::CertificateInfo certificate, String host)
......
......@@ -40,7 +40,8 @@ messages -> PluginProcess LegacyReceiver {
ClearSiteData(Vector<String> sites, uint64_t flags, uint64_t maxAgeInSeconds, uint64_t callbackID)
#if PLATFORM(MAC)
SetProcessSuppressionEnabled(bool flag);
SetProcessSuppressionEnabled(bool flag)
SetQOS(int latencyQOS, int throughputQOS)
#endif
}
......
......@@ -69,6 +69,7 @@ public:
#if PLATFORM(MAC)
void setApplicationIsDaemon();
void setQOS(int latencyQOS, int throughputQOS);
#endif
IPC::Connection* parentProcessConnection() const { return m_connection.get(); }
......
......@@ -30,6 +30,7 @@
#import "WebKitSystemInterface.h"
#import <WebCore/FileSystem.h>
#import <WebCore/SystemVersionMac.h>
#import <mach/mach.h>
#import <mach/task.h>
#import <pwd.h>
#import <stdlib.h>
......@@ -200,4 +201,22 @@ void ChildProcess::stopNSAppRunLoop()
}
#endif
void ChildProcess::setQOS(int latencyQOS, int throughputQOS)
{
#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
if (!latencyQOS && !throughputQOS)
return;
struct task_qos_policy qosinfo = {
latencyQOS ? LATENCY_QOS_TIER_0 + latencyQOS - 1 : LATENCY_QOS_TIER_UNSPECIFIED,
throughputQOS ? THROUGHPUT_QOS_TIER_0 + throughputQOS - 1 : THROUGHPUT_QOS_TIER_UNSPECIFIED
};
task_policy_set(mach_task_self(), TASK_OVERRIDE_QOS_POLICY, (task_policy_t)&qosinfo, TASK_QOS_POLICY_COUNT);
#else
UNUSED_PARAM(latencyQOS);
UNUSED_PARAM(throughputQOS);
#endif
}
} // namespace WebKit
......@@ -208,6 +208,10 @@ void PluginProcessProxy::didFinishLaunching(ProcessLauncher*, IPC::Connection::I
// Initialize the plug-in host process.
m_connection->send(Messages::PluginProcess::InitializePluginProcess(parameters), 0);
#if PLATFORM(MAC)
m_connection->send(Messages::PluginProcess::SetQOS(pluginProcessLatencyQOS(), pluginProcessThroughputQOS()), 0);
#endif
// Send all our pending requests.
for (size_t i = 0; i < m_pendingGetSitesRequests.size(); ++i)
m_connection->send(Messages::PluginProcess::GetSitesWithData(m_pendingGetSitesRequests[i]), 0);
......
......@@ -63,6 +63,11 @@ struct RawPluginMetaData {
};
#endif
#if PLATFORM(MAC)
int pluginProcessLatencyQOS();
int pluginProcessThroughputQOS();
#endif
class PluginProcessProxy : public ChildProcessProxy {
public:
static PassRefPtr<PluginProcessProxy> create(PluginProcessManager*, const PluginProcessAttributes&, uint64_t pluginProcessToken);
......
......@@ -463,6 +463,18 @@ void PluginProcessProxy::openFile(const String& fullPath, bool& result)
[[NSWorkspace sharedWorkspace] openFile:fullPath];
}
int pluginProcessLatencyQOS()
{
static int qos = [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitPluginProcessLatencyQOS"];
return qos;
}
int pluginProcessThroughputQOS()
{
static int qos = [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitPluginProcessThroughputQOS"];
return qos;
}
} // namespace WebKit
#endif // ENABLE(NETSCAPE_PLUGIN_API)
......@@ -391,6 +391,10 @@ void WebContext::ensureNetworkProcess()
// Initialize the network process.
m_networkProcess->send(Messages::NetworkProcess::InitializeNetworkProcess(parameters), 0);
#if PLATFORM(MAC)
m_networkProcess->send(Messages::NetworkProcess::SetQOS(networkProcessLatencyQOS(), networkProcessThroughputQOS()), 0);
#endif
}
void WebContext::networkProcessCrashed(NetworkProcessProxy* networkProcessProxy)
......@@ -605,6 +609,10 @@ WebProcessProxy& WebContext::createNewWebProcess()
injectedBundleInitializationUserData = m_injectedBundleInitializationUserData;
process->send(Messages::WebProcess::InitializeWebProcess(parameters, WebContextUserMessageEncoder(injectedBundleInitializationUserData.get(), *process)), 0);
#if PLATFORM(MAC)
process->send(Messages::WebProcess::SetQOS(webProcessLatencyQOS(), webProcessThroughputQOS()), 0);
#endif
if (WebPreferences::anyPageGroupsAreUsingPrivateBrowsing())
process->send(Messages::WebProcess::EnsurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID), 0);
......
......@@ -85,6 +85,13 @@ class WebNetworkInfoManagerProxy;
struct NetworkProcessCreationParameters;
#endif
#if PLATFORM(MAC)
int networkProcessLatencyQOS();
int networkProcessThroughputQOS();
int webProcessLatencyQOS();
int webProcessThroughputQOS();
#endif
class WebContext : public API::ObjectImpl<API::Object::Type::Context>, private IPC::MessageReceiver
#if ENABLE(NETSCAPE_PLUGIN_API)
, private PluginInfoStoreClient
......
......@@ -474,4 +474,28 @@ void WebContext::resetHSTSHosts()
#endif
}
int networkProcessLatencyQOS()
{
static int qos = [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitNetworkProcessLatencyQOS"];
return qos;
}
int networkProcessThroughputQOS()
{
static int qos = [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitNetworkProcessThroughputQOS"];
return qos;
}
int webProcessLatencyQOS()
{
static int qos = [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitWebProcessLatencyQOS"];
return qos;
}
int webProcessThroughputQOS()
{
static int qos = [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitWebProcessThroughputQOS"];
return qos;
}
} // namespace WebKit
......@@ -80,7 +80,8 @@ messages -> WebProcess LegacyReceiver {
ReleasePageCache()
#if PLATFORM(MAC)
SetProcessSuppressionEnabled(bool flag);
SetProcessSuppressionEnabled(bool flag)
SetQOS(int latencyQOS, int throughputQOS)
#endif
#if USE(SOUP)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment