summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2013-07-05 21:58:24 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-07-09 13:47:30 +0200
commitea1e55ad0f2ae04706c0103e6f613c253cfcb094 (patch)
treef1335c4310797dd9f412a4bd9fed449b6dab1710
parent1daab3653e56469868656b32fa87b7f9585ec577 (diff)
Get rid of or upstream chrome_path patch for zygote
Override base::FILE_EXE in ContentMainDelegateQt::PreSandboxStartup() with the path to our child process and get rid of the command line argument and the content::CHILD_PROCESS_EXE override. This reduces 0001-My-local-fixes.patch to export ContentMainRunner so the patch can be renamed to better reflect it's purpose. This hunk is still needed since we need to access ContentMainRunner's Initialize() to set our ContentMainDelegate. Change-Id: I808cb114100300a33f8cb1b154c6cde89cbf5d98 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--lib/web_engine_context.cpp49
-rw-r--r--patches/0001-Export-ContentMainRunner.patch (renamed from patches/0001-My-local-fixes.patch)16
-rwxr-xr-xpatches/patch-chromium.sh2
3 files changed, 23 insertions, 44 deletions
diff --git a/lib/web_engine_context.cpp b/lib/web_engine_context.cpp
index 3059bc089..149e580b9 100644
--- a/lib/web_engine_context.cpp
+++ b/lib/web_engine_context.cpp
@@ -92,15 +92,6 @@ static QByteArray subProcessPath() {
return processPath;
}
-static void initializeBlinkPaths()
-{
- static bool initialized = false;
- if (initialized)
- return;
-
- PathService::Override(content::CHILD_PROCESS_EXE, base::FilePath(qStringToStringType(QString(subProcessPath()))));
-}
-
// Return a timeout suitable for the glib loop, -1 to block forever,
// 0 to return right away, or a timeout in milliseconds from now.
int GetTimeIntervalMilliseconds(const base::TimeTicks& from) {
@@ -196,7 +187,15 @@ base::MessagePump* messagePumpFactory()
class ContentMainDelegateQt : public content::ContentMainDelegate
{
public:
- content::ContentBrowserClient* CreateContentBrowserClient()
+
+ // This is where the embedder puts all of its startup code that needs to run
+ // before the sandbox is engaged.
+ void PreSandboxStartup() Q_DECL_OVERRIDE
+ {
+ PathService::Override(base::FILE_EXE, base::FilePath(qStringToStringType(subProcessPath())));
+ }
+
+ content::ContentBrowserClient* CreateContentBrowserClient() Q_DECL_OVERRIDE
{
m_browserClient.reset(new ContentBrowserClientQt);
return m_browserClient.get();
@@ -214,26 +213,22 @@ WebEngineContext::WebEngineContext()
sContext = this;
{
- QByteArray subProcessPathOption("--browser-subprocess-path=");
- subProcessPathOption.append(subProcessPath());
-
std::string ua = webkit_glue::BuildUserAgentFromProduct("QtWebEngine/0.1");
-
QByteArray userAgentParameter("--user-agent=");
userAgentParameter.append(QString::fromStdString(ua).toUtf8());
- const QStringList args = QCoreApplication::arguments();
- const int argc = args.size() + 3;
- const char* argv[argc];
- int i = 0;
- for(; i < args.size(); ++i)
- argv[i] = args.at(i).toLatin1().constData();
- argv[i++] = subProcessPathOption.constData();
- argv[i++] = "--no-sandbox";
- argv[i++] = "--disable-plugins";
- argv[i] = userAgentParameter.constData();
-
- CommandLine::Init(argc, argv);
+ QList<QByteArray> args;
+ Q_FOREACH (const QString& arg, QCoreApplication::arguments())
+ args << arg.toUtf8();
+ args << userAgentParameter;
+ args << QByteArrayLiteral("--no-sandbox");
+ args << QByteArrayLiteral("--disable-plugins");
+
+ const char* argv[args.size()];
+ for (int i = 0; i < args.size(); ++i)
+ argv[i] = args[i].constData();
+
+ CommandLine::Init(args.size(), argv);
}
// This needs to be set before the MessageLoop is created by BrowserMainRunner.
@@ -245,8 +240,6 @@ WebEngineContext::WebEngineContext()
runner->Initialize(0, 0, new ContentMainDelegateQt);
}
- initializeBlinkPaths();
-
static content::BrowserMainRunner *browserRunner = 0;
if (!browserRunner) {
browserRunner = content::BrowserMainRunner::Create();
diff --git a/patches/0001-My-local-fixes.patch b/patches/0001-Export-ContentMainRunner.patch
index ab9e927d7..7cd402485 100644
--- a/patches/0001-My-local-fixes.patch
+++ b/patches/0001-Export-ContentMainRunner.patch
@@ -1,26 +1,12 @@
From 0a3b4029af83089cb313b555a47c5c510dc94cc7 Mon Sep 17 00:00:00 2001
From: Simon Hausmann <simon.hausmann@digia.com>
Date: Mon, 29 Apr 2013 11:25:37 +0200
-Subject: [PATCH 1/2] My local fixes
+Subject: Export ContentMainRunner
---
- content/browser/zygote_host/zygote_host_impl_linux.cc | 1 +
content/public/app/content_main_runner.h | 3 ++-
- content/public/common/content_client.h | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
-diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc
-index ba7884f8..50eacc8 100644
---- a/content/browser/zygote_host/zygote_host_impl_linux.cc
-+++ b/content/browser/zygote_host/zygote_host_impl_linux.cc
-@@ -70,6 +70,7 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) {
-
- base::FilePath chrome_path;
- CHECK(PathService::Get(base::FILE_EXE, &chrome_path));
-+ chrome_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath(switches::kBrowserSubprocessPath);
- CommandLine cmd_line(chrome_path);
-
- cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kZygoteProcess);
diff --git a/content/public/app/content_main_runner.h b/content/public/app/content_main_runner.h
index bed5ff2..992e0d0 100644
--- a/content/public/app/content_main_runner.h
diff --git a/patches/patch-chromium.sh b/patches/patch-chromium.sh
index 6bc1c5e05..0ffe6860f 100755
--- a/patches/patch-chromium.sh
+++ b/patches/patch-chromium.sh
@@ -61,7 +61,7 @@ git submodule update --recursive
cd $CHROMIUM_SRC_DIR
echo "Entering $PWD"
-git am $PATCH_DIR/0001-My-local-fixes.patch
+git am $PATCH_DIR/0001-Export-ContentMainRunner.patch
git am $PATCH_DIR/0002-Add-WebEngineContext-to-RunLoop-s-friends.patch
git am $PATCH_DIR/0001-Mac-Use-libc-instead-of-stdlibc.patch
git am $PATCH_DIR/0002-Clang-libc-does-not-support-incomplete-types-in-temp.patch