[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 13:39:48 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 989d936476bda6878ecc86f85ec29722b3da2c64
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Sep 22 20:14:43 2010 +0000
Enhance ProcessLauncher to be able to launch plug-in processes
https://bugs.webkit.org/show_bug.cgi?id=46295
Reviewed by Darin Adler.
* UIProcess/Launcher/ProcessLauncher.cpp:
(WebKit::ProcessLauncher::ProcessLauncher):
Make the ProcessLauncher constructor take a LaunchOptions struct.
(WebKit::ProcessLauncher::processTypeAsString):
Given a process type, return its string representation.
(WebKit::ProcessLauncher::getProcessTypeFromString):
And vice versa.
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):
Rename "mode" to "type" and pass the type as a string based on the LaunchOptions struct.
Also, set the launch architecture from the LaunchOptions struct.
* UIProcess/Launcher/win/ProcessLauncherWin.cpp:
(WebKit::ProcessLauncher::launchProcess):
Rename "mode" to "type."
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::connect):
Initialize a LaunchOptions struct.
* WebProcess/WebKitMain.cpp:
(WebKitMain):
Factor code that can be shared between the mac and windows WebKitMain code out into a
WebKitMain overload that takes a CommandLine.
* WebProcess/WebProcessMain.h:
* WebProcess/mac/WebProcessMainMac.mm:
(WebKit::WebProcessMain):
* WebProcess/win/WebProcessMainWin.cpp:
(WebKit::WebProcessMain):
Change WebProcessMain to take a const CommandLine reference instead of a pointer.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68075 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index a6d5213..5fa0d1d 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,47 @@
2010-09-22 Anders Carlsson <andersca at apple.com>
+ Reviewed by Darin Adler.
+
+ Enhance ProcessLauncher to be able to launch plug-in processes
+ https://bugs.webkit.org/show_bug.cgi?id=46295
+
+ * UIProcess/Launcher/ProcessLauncher.cpp:
+ (WebKit::ProcessLauncher::ProcessLauncher):
+ Make the ProcessLauncher constructor take a LaunchOptions struct.
+
+ (WebKit::ProcessLauncher::processTypeAsString):
+ Given a process type, return its string representation.
+
+ (WebKit::ProcessLauncher::getProcessTypeFromString):
+ And vice versa.
+
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ (WebKit::ProcessLauncher::launchProcess):
+ Rename "mode" to "type" and pass the type as a string based on the LaunchOptions struct.
+ Also, set the launch architecture from the LaunchOptions struct.
+
+ * UIProcess/Launcher/win/ProcessLauncherWin.cpp:
+ (WebKit::ProcessLauncher::launchProcess):
+ Rename "mode" to "type."
+
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::connect):
+ Initialize a LaunchOptions struct.
+
+ * WebProcess/WebKitMain.cpp:
+ (WebKitMain):
+ Factor code that can be shared between the mac and windows WebKitMain code out into a
+ WebKitMain overload that takes a CommandLine.
+
+ * WebProcess/WebProcessMain.h:
+ * WebProcess/mac/WebProcessMainMac.mm:
+ (WebKit::WebProcessMain):
+ * WebProcess/win/WebProcessMainWin.cpp:
+ (WebKit::WebProcessMain):
+ Change WebProcessMain to take a const CommandLine reference instead of a pointer.
+
+2010-09-22 Anders Carlsson <andersca at apple.com>
+
Reviewed by Adam Roben.
Rename GetPluginHostConnection to GetPluginPath
diff --git a/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp b/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp
index abbbb46..47cedc1 100644
--- a/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp
+++ b/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp
@@ -36,8 +36,9 @@ static WorkQueue& processLauncherWorkQueue()
return processLauncherWorkQueue;
}
-ProcessLauncher::ProcessLauncher(Client* client)
+ProcessLauncher::ProcessLauncher(Client* client, const LaunchOptions& launchOptions)
: m_client(client)
+ , m_launchOptions(launchOptions)
, m_processIdentifier(0)
{
// Launch the process.
@@ -63,4 +64,32 @@ void ProcessLauncher::invalidate()
m_client = 0;
}
+const char* ProcessLauncher::processTypeAsString(ProcessType processType)
+{
+ switch (processType) {
+ case WebProcess:
+ return "webprocess";
+ case PluginProcess:
+ return "pluginprocess";
+ }
+
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+bool ProcessLauncher::getProcessTypeFromString(const char* string, ProcessType& processType)
+{
+ if (!strcmp(string, "webprocess")) {
+ processType = WebProcess;
+ return true;
+ }
+
+ if (!strcmp(string, "pluginprocess")) {
+ processType = PluginProcess;
+ return true;
+ }
+
+ return false;
+}
+
} // namespace WebKit
diff --git a/WebKit2/UIProcess/Launcher/ProcessLauncher.h b/WebKit2/UIProcess/Launcher/ProcessLauncher.h
index 6398f7c..3cd89ba 100644
--- a/WebKit2/UIProcess/Launcher/ProcessLauncher.h
+++ b/WebKit2/UIProcess/Launcher/ProcessLauncher.h
@@ -46,9 +46,22 @@ public:
virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier) = 0;
};
- static PassRefPtr<ProcessLauncher> create(Client* client)
+ enum ProcessType {
+ WebProcess,
+ PluginProcess
+ };
+
+ struct LaunchOptions {
+ ProcessType processType;
+#if PLATFORM(MAC)
+ static const cpu_type_t MatchCurrentArchitecture = 0;
+ cpu_type_t architecture;
+#endif
+ };
+
+ static PassRefPtr<ProcessLauncher> create(Client* client, const LaunchOptions& launchOptions)
{
- return adoptRef(new ProcessLauncher(client));
+ return adoptRef(new ProcessLauncher(client, launchOptions));
}
bool isLaunching() const { return m_isLaunching; }
@@ -57,19 +70,24 @@ public:
void terminateProcess();
void invalidate();
+ static bool getProcessTypeFromString(const char*, ProcessType&);
+
#if PLATFORM(QT)
friend class ProcessLauncherHelper;
static QLocalSocket* takePendingConnection();
#endif
private:
- explicit ProcessLauncher(Client*);
+ ProcessLauncher(Client*, const LaunchOptions& launchOptions);
+
+ static const char* processTypeAsString(ProcessType);
void launchProcess();
void didFinishLaunchingProcess(PlatformProcessIdentifier, CoreIPC::Connection::Identifier);
Client* m_client;
+ const LaunchOptions m_launchOptions;
bool m_isLaunching;
PlatformProcessIdentifier m_processIdentifier;
};
diff --git a/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm b/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
index dd464ec..bd0d755 100644
--- a/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
+++ b/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
@@ -105,7 +105,7 @@ void ProcessLauncher::launchProcess()
CString serviceName = String::format("com.apple.WebKit.WebProcess-%d-%p", getpid(), this).utf8();
const char* path = [webProcessAppExecutablePath fileSystemRepresentation];
- const char* args[] = { path, "-mode", "legacywebprocess", "-servicename", serviceName.data(), "-parentprocessname", processName(), 0 };
+ const char* args[] = { path, "-type", processTypeAsString(m_launchOptions.processType), "-servicename", serviceName.data(), "-parentprocessname", processName(), 0 };
// Register ourselves.
kern_return_t kr = bootstrap_register2(bootstrap_port, const_cast<char*>(serviceName.data()), listeningPort, 0);
@@ -116,12 +116,14 @@ void ProcessLauncher::launchProcess()
// FIXME: Should we restore signals here?
-#if CPU(X86)
- // Ensure that the child process runs as the same architecture as the parent process.
- cpu_type_t cpuTypes[] = { CPU_TYPE_X86 };
+ // Determine the architecture to use.
+ cpu_type_t architecture = m_launchOptions.architecture;
+ if (architecture == LaunchOptions::MatchCurrentArchitecture)
+ architecture = _NSGetMachExecuteHeader()->cputype;
+
+ cpu_type_t cpuTypes[] = { architecture };
size_t outCount = 0;
posix_spawnattr_setbinpref_np(&attr, 1, cpuTypes, &outCount);
-#endif
// Start suspended so we can set up the termination notification handler.
posix_spawnattr_setflags(&attr, POSIX_SPAWN_START_SUSPENDED);
diff --git a/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp b/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp
index 755ca40..16eb219 100644
--- a/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp
+++ b/WebKit2/UIProcess/Launcher/win/ProcessLauncherWin.cpp
@@ -69,9 +69,10 @@ void ProcessLauncher::launchProcess()
String commandLine(pathStr);
+ // FIXME: It would be nice if we could just create a CommandLine object and output a command line vector from it.
Vector<UChar> commandLineVector;
append(commandLineVector, commandLine);
- append(commandLineVector, " -mode webprocess");
+ append(commandLineVector, " -type webprocess");
append(commandLineVector, " -clientIdentifier ");
append(commandLineVector, String::number(reinterpret_cast<uintptr_t>(clientIdentifier)));
commandLineVector.append('\0');
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index 231ac7d..8d8e5da 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -115,7 +115,14 @@ void WebProcessProxy::connect()
m_threadLauncher = ThreadLauncher::create(this);
} else {
ASSERT(!m_processLauncher);
- m_processLauncher = ProcessLauncher::create(this);
+
+ ProcessLauncher::LaunchOptions launchOptions;
+ launchOptions.processType = ProcessLauncher::WebProcess;
+#if PLATFORM(MAC)
+ // We want the web process to match the architecture of the UI process.
+ launchOptions.architecture = ProcessLauncher::LaunchOptions::MatchCurrentArchitecture;
+#endif
+ m_processLauncher = ProcessLauncher::create(this, launchOptions);
}
}
diff --git a/WebKit2/WebProcess/WebKitMain.cpp b/WebKit2/WebProcess/WebKitMain.cpp
index bc0f04e..e773eae 100644
--- a/WebKit2/WebProcess/WebKitMain.cpp
+++ b/WebKit2/WebProcess/WebKitMain.cpp
@@ -25,7 +25,9 @@
#include "CommandLine.h"
+#include "ProcessLauncher.h"
#include "WebProcessMain.h"
+#include <wtf/text/CString.h>
#if PLATFORM(MAC)
#include <objc/objc-auto.h>
@@ -33,6 +35,23 @@
using namespace WebKit;
+static int WebKitMain(const CommandLine& commandLine)
+{
+ ProcessLauncher::ProcessType processType;
+ if (!ProcessLauncher::getProcessTypeFromString(commandLine["type"].utf8().data(), processType))
+ return EXIT_FAILURE;
+
+ switch (processType) {
+ case ProcessLauncher::WebProcess:
+ return WebProcessMain(commandLine);
+ case ProcessLauncher::PluginProcess:
+ // FIXME: Handle this.
+ break;
+ }
+
+ return EXIT_FAILURE;
+}
+
#if PLATFORM(MAC)
extern "C" WK_EXPORT int WebKitMain(int argc, char** argv);
@@ -45,11 +64,7 @@ int WebKitMain(int argc, char** argv)
if (!commandLine.parse(argc, argv))
return EXIT_FAILURE;
- String mode = commandLine["mode"];
- if (mode == "legacywebprocess")
- return WebProcessMain(&commandLine);
-
- return EXIT_FAILURE;
+ return WebKitMain(commandLine);
}
#elif PLATFORM(WIN)
@@ -126,11 +141,7 @@ int WebKitMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine
if (!commandLine.parse(lpstrCmdLine))
return EXIT_FAILURE;
- String mode = commandLine["mode"];
- if (mode == "webprocess")
- return WebKit::WebProcessMain(&commandLine);
-
- return EXIT_FAILURE;
+ return WebKitMain(commandLine):
}
#endif
diff --git a/WebKit2/WebProcess/WebProcessMain.h b/WebKit2/WebProcess/WebProcessMain.h
index 9f15e3a..8923bdd 100644
--- a/WebKit2/WebProcess/WebProcessMain.h
+++ b/WebKit2/WebProcess/WebProcessMain.h
@@ -29,6 +29,6 @@ namespace WebKit {
class CommandLine;
-int WebProcessMain(CommandLine*);
+int WebProcessMain(const CommandLine&);
} // namespace WebKit
diff --git a/WebKit2/WebProcess/mac/WebProcessMainMac.mm b/WebKit2/WebProcess/mac/WebProcessMainMac.mm
index 4b49921..a5ca4f8 100644
--- a/WebKit2/WebProcess/mac/WebProcessMainMac.mm
+++ b/WebKit2/WebProcess/mac/WebProcessMainMac.mm
@@ -55,7 +55,7 @@ using namespace WebCore;
namespace WebKit {
-int WebProcessMain(CommandLine* commandLine)
+int WebProcessMain(const CommandLine& commandLine)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -71,7 +71,7 @@ int WebProcessMain(CommandLine* commandLine)
}
#endif
- String serviceName = (*commandLine)["servicename"];
+ String serviceName = commandLine["servicename"];
if (serviceName.isEmpty())
return EXIT_FAILURE;
@@ -97,7 +97,7 @@ int WebProcessMain(CommandLine* commandLine)
RunLoop::initializeMainRunLoop();
// Set the visible application name.
- String parentProcessName = (*commandLine)["parentprocessname"];
+ String parentProcessName = commandLine["parentprocessname"];
if (!parentProcessName.isNull()) {
// FIXME: Localization!
NSString *applicationName = [NSString stringWithFormat:@"%@ Web Content", (NSString *)parentProcessName];
diff --git a/WebKit2/WebProcess/win/WebProcessMainWin.cpp b/WebKit2/WebProcess/win/WebProcessMainWin.cpp
index 94730df..944d8ff 100644
--- a/WebKit2/WebProcess/win/WebProcessMainWin.cpp
+++ b/WebKit2/WebProcess/win/WebProcessMainWin.cpp
@@ -56,7 +56,7 @@ static void initializeSafariTheme()
}
#endif // USE(SAFARI_THEME)
-int WebProcessMain(CommandLine* commandLine)
+int WebProcessMain(const CommandLine& commandLine)
{
::OleInitialize(0);
@@ -68,7 +68,7 @@ int WebProcessMain(CommandLine* commandLine)
WTF::initializeMainThread();
RunLoop::initializeMainRunLoop();
- const String& identifierString = (*commandLine)["clientIdentifier"];
+ const String& identifierString = commandLine["clientIdentifier"];
// FIXME: Should we return an error code here?
HANDLE clientIdentifier = reinterpret_cast<HANDLE>(identifierString.toUInt64Strict());
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list