summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-26 00:47:05 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-26 00:47:05 +0000
commite00f9da2250748213690b3586fc08a60e989b58f (patch)
tree6a4f3e9cfeb43eaa442e85ffd6c1ed371f6d523a
parent0fbf0fe469cdd79468e97bd144fb4380e5dab2ef (diff)
downloadchromium_src-e00f9da2250748213690b3586fc08a60e989b58f.zip
chromium_src-e00f9da2250748213690b3586fc08a60e989b58f.tar.gz
chromium_src-e00f9da2250748213690b3586fc08a60e989b58f.tar.bz2
Linux: fix font fallback for charactors missing from the primary font.
We are using the sandbox host for font fallback now via the WebKit API. However, a patch landed in WebKit which added an assertion about being on the correct thread. Since the sandbox host was using WebString::fromUTF8, we hit the assertion and died. So, we have to implement a WebKitClient for the sandbox host. We cannot just pass in NULL because there's an assertion that it's non-NULL. Also, we cannot pass in a bogus pointer because it actually ends up getting called back. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19324 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc4
-rw-r--r--chrome/browser/renderer_host/render_sandbox_host_linux.cc57
-rw-r--r--chrome/browser/zygote_host_linux.cc2
-rw-r--r--chrome/browser/zygote_main_linux.cc2
-rw-r--r--chrome/renderer/renderer_sandbox_support_linux.cc7
5 files changed, 67 insertions, 5 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 2630790..ecea28c 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -55,6 +55,7 @@
#if defined(OS_LINUX)
#include "chrome/browser/zygote_host_linux.h"
#include "chrome/browser/renderer_host/render_crash_handler_host_linux.h"
+#include "chrome/browser/renderer_host/render_sandbox_host_linux.h"
#endif
using WebKit::WebCache;
@@ -392,6 +393,9 @@ bool BrowserRenderProcessHost::Init() {
fds_to_map.push_back(std::make_pair(crash_signal_fd,
kCrashDumpSignal + 3));
}
+ const int sandbox_fd =
+ Singleton<RenderSandboxHostLinux>()->GetRendererSocket();
+ fds_to_map.push_back(std::make_pair(sandbox_fd, kSandboxIPCChannel + 3));
#endif
base::LaunchApp(cmd_line.argv(), fds_to_map, false, &process);
zygote_child_ = false;
diff --git a/chrome/browser/renderer_host/render_sandbox_host_linux.cc b/chrome/browser/renderer_host/render_sandbox_host_linux.cc
index e657af4..ef47f92 100644
--- a/chrome/browser/renderer_host/render_sandbox_host_linux.cc
+++ b/chrome/browser/renderer_host/render_sandbox_host_linux.cc
@@ -19,20 +19,33 @@
#include "base/unix_domain_socket_posix.h"
#include "chrome/common/sandbox_methods_linux.h"
#include "webkit/api/public/gtk/WebFontInfo.h"
+#include "webkit/api/public/WebData.h"
+#include "webkit/api/public/WebKit.h"
+#include "webkit/api/public/WebKitClient.h"
#include "SkFontHost_fontconfig_direct.h"
#include "SkFontHost_fontconfig_ipc.h"
+using WebKit::WebClipboard;
+using WebKit::WebData;
using WebKit::WebFontInfo;
+using WebKit::WebKitClient;
+using WebKit::WebMimeRegistry;
+using WebKit::WebPluginInfo;
+using WebKit::WebPluginListBuilder;
+using WebKit::WebSandboxSupport;
using WebKit::WebString;
+using WebKit::WebThemeEngine;
using WebKit::WebUChar;
+using WebKit::WebURL;
+using WebKit::WebURLLoader;
// http://code.google.com/p/chromium/wiki/LinuxSandboxIPC
// BEWARE: code in this file run across *processes* (not just threads).
// This code runs in a child process
-class SandboxIPCProcess {
+class SandboxIPCProcess : public WebKitClient {
public:
// lifeline_fd: this is the read end of a pipe which the browser process
// holds the other end of. If the browser process dies, it's descriptors are
@@ -44,6 +57,8 @@ class SandboxIPCProcess {
: lifeline_fd_(lifeline_fd),
browser_socket_(browser_socket),
font_config_(new FontConfigDirect()) {
+ WebKit::initialize(this);
+
base::InjectiveMultimap multimap;
multimap.push_back(base::InjectionArc(0, lifeline_fd, false));
multimap.push_back(base::InjectionArc(0, browser_socket, false));
@@ -83,6 +98,46 @@ class SandboxIPCProcess {
}
}
+ // ---------------------------------------------------------------------------
+ // WebKitClient impl...
+
+ virtual WebClipboard* clipboard() { return NULL; }
+ virtual WebMimeRegistry* mimeRegistry() { return NULL; }
+ virtual WebSandboxSupport* sandboxSupport() { return NULL; }
+ virtual WebThemeEngine* themeEngine() { return NULL; }
+
+ virtual unsigned long long visitedLinkHash(const char*, size_t) { return 0; }
+ virtual bool isLinkVisited(unsigned long long) { return false; }
+
+ virtual void setCookies(const WebURL&, const WebURL&, const WebString&) { }
+ virtual WebString cookies(const WebURL&, const WebURL&) { return WebString(); }
+
+ virtual void prefetchHostName(const WebString&) { }
+
+ virtual WebURLLoader* createURLLoader() { return NULL; }
+
+ virtual void getPluginList(bool refresh, WebPluginListBuilder*) { }
+
+ virtual void decrementStatsCounter(const char*) { }
+ virtual void incrementStatsCounter(const char*) { }
+
+ virtual void traceEventBegin(const char* name, void*, const char*) { }
+ virtual void traceEventEnd(const char* name, void*, const char*) { }
+
+ virtual WebData loadResource(const char*) { return WebData(); }
+
+ virtual void suddenTerminationChanged(bool) { }
+
+ virtual WebString defaultLocale() { return WebString(); }
+
+ virtual double currentTime() { return 0; }
+
+ virtual void setSharedTimerFiredFunction(void (*)()) { }
+ virtual void setSharedTimerFireTime(double) { }
+ virtual void stopSharedTimer() { }
+
+ virtual void callOnMainThread(void (*)()) { }
+
private:
// ---------------------------------------------------------------------------
// Requests from the renderer...
diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc
index 230373c..afa55da 100644
--- a/chrome/browser/zygote_host_linux.cc
+++ b/chrome/browser/zygote_host_linux.cc
@@ -42,7 +42,7 @@ ZygoteHost::ZygoteHost() {
// Start up the sandbox host process and get the file descriptor for the
// renderers to talk to it.
const int sfd = Singleton<RenderSandboxHostLinux>()->GetRendererSocket();
- fds_to_map.push_back(std::make_pair(sfd, 4));
+ fds_to_map.push_back(std::make_pair(sfd, 5));
base::ProcessHandle process;
base::LaunchApp(cmd_line.argv(), fds_to_map, false, &process);
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index ba550d9..3f9b570 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -166,7 +166,7 @@ class Zygote {
}
mapping.push_back(std::make_pair(
- static_cast<uint32_t>(kSandboxIPCChannel), 4));
+ static_cast<uint32_t>(kSandboxIPCChannel), 5));
child = fork();
diff --git a/chrome/renderer/renderer_sandbox_support_linux.cc b/chrome/renderer/renderer_sandbox_support_linux.cc
index 29fe183..a08fff1 100644
--- a/chrome/renderer/renderer_sandbox_support_linux.cc
+++ b/chrome/renderer/renderer_sandbox_support_linux.cc
@@ -4,8 +4,10 @@
#include "chrome/renderer/renderer_sandbox_support_linux.h"
+#include "base/global_descriptors_posix.h"
#include "base/pickle.h"
#include "base/unix_domain_socket_posix.h"
+#include "chrome/common/chrome_descriptors.h"
#include "chrome/common/sandbox_methods_linux.h"
namespace renderer_sandbox_support {
@@ -18,8 +20,9 @@ std::string getFontFamilyForCharacters(const uint16_t* utf16, size_t num_utf16)
request.WriteUInt32(utf16[i]);
uint8_t buf[512];
- static const int kMagicSandboxFD = 4;
- const ssize_t n = base::SendRecvMsg(kMagicSandboxFD, buf, sizeof(buf), NULL,
+ const int sandbox_fd =
+ kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor;
+ const ssize_t n = base::SendRecvMsg(sandbox_fd, buf, sizeof(buf), NULL,
request);
std::string family_name;