summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 18:09:12 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 18:09:12 +0000
commitf963b1d5006ed35450befe042bf58810d9d36bea (patch)
treefe7f035ae7972e055f648fcf8e527f1e777c5984 /chrome/browser/renderer_host
parentcb5ea4db21261528710f13c5513e1143ca757386 (diff)
downloadchromium_src-f963b1d5006ed35450befe042bf58810d9d36bea.zip
chromium_src-f963b1d5006ed35450befe042bf58810d9d36bea.tar.gz
chromium_src-f963b1d5006ed35450befe042bf58810d9d36bea.tar.bz2
Linux: Make SandboxIPCProcess not be a WebKitClient
Previously, SandboxIPCProcess had to be a full WebKitClient because of the following assertion failure: 0 0x08af0a77 in buildBaseTextCodecMaps () at third_party/WebKit/WebCore/platform/text/TextEncodingRegistry.cpp:176 1 0x08af0e73 in WebCore::atomicCanonicalTextEncodingName (name=0x985d665 "UTF-8") at third_party/WebKit/WebCore/platform/text/TextEncodingRegistry.cpp:241 2 0x08aee811 in TextEncoding (this=0xb876ef8, name=0x985d665 "UTF-8") at third_party/WebKit/WebCore/platform/text/TextEncoding.cpp:61 3 0x08aee88a in WebCore::UTF8Encoding () at third_party/WebKit/WebCore/platform/text/TextEncoding.cpp:266 4 0x08ae744c in WebCore::String::fromUTF8 (string=0x56d7a120 "�226\207�211�233正�221", size=15) at third_party/WebKit/WebCore/platform/text/String.cpp:674 5 0x0872a7c0 in WebKit::WebString::fromUTF8 (data=0x56d7a120 "�226\207�211�233正�221", length=15) at webkit/api/src/WebString.cpp:72 6 0x087245bd in WebKit::WebFontInfo::familyForChars (characters=0x56c11628, numCharacters=1) at webkit/api/src/gtk/WebFontInfo.cpp:98 7 0x0847599a in SandboxIPCProcess::HandleGetFontFamilyForChars (this=0xff869ba8, fd=29, pickle=@0xff86900c, iter=0xff869054, fds=@0xff86901c) at chrome/browser/renderer_host/render_sandbox_host_linux.cc:215 8 0x08475d70 in SandboxIPCProcess::HandleRequestFromRenderer (this=0xff869ba8, fd=29) at chrome/browser/renderer_host/render_sandbox_host_linux.cc:115 9 0x08475fea in SandboxIPCProcess::Run (this=0xff869ba8) at chrome/browser/renderer_host/render_sandbox_host_linux.cc:84 10 0x084747f9 in RenderSandboxHostLinux (this=0x56c10e78) at chrome/browser/renderer_host/render_sandbox_host_linux.cc:299 This this patch, we remove the need to use WebString and the codec translation (which was just a translation from UTF8 to UTF16 and back again anyway) and thus can remove all of the WebKitClient gubbins. BUG=17260 http://codereview.chromium.org/164112 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/render_sandbox_host_linux.cc120
1 files changed, 8 insertions, 112 deletions
diff --git a/chrome/browser/renderer_host/render_sandbox_host_linux.cc b/chrome/browser/renderer_host/render_sandbox_host_linux.cc
index 460f1cb..e34efe6 100644
--- a/chrome/browser/renderer_host/render_sandbox_host_linux.cc
+++ b/chrome/browser/renderer_host/render_sandbox_host_linux.cc
@@ -21,38 +21,20 @@
#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 "webkit/api/public/WebStorageArea.h"
-#include "webkit/api/public/WebStorageNamespace.h"
#include "SkFontHost_fontconfig_direct.h"
#include "SkFontHost_fontconfig_ipc.h"
-using WebKit::WebClipboard;
-using WebKit::WebData;
+using WebKit::WebCString;
using WebKit::WebFontInfo;
-using WebKit::WebKitClient;
-using WebKit::WebLocalizedString;
-using WebKit::WebMimeRegistry;
-using WebKit::WebPluginInfo;
-using WebKit::WebPluginListBuilder;
-using WebKit::WebSandboxSupport;
-using WebKit::WebStorageArea;
-using WebKit::WebStorageNamespace;
-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 : public WebKitClient {
+class SandboxIPCProcess {
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
@@ -64,8 +46,6 @@ class SandboxIPCProcess : public WebKitClient {
: 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));
@@ -105,93 +85,6 @@ class SandboxIPCProcess : public WebKitClient {
}
}
- // ---------------------------------------------------------------------------
- // WebKitClient impl...
-
- virtual WebClipboard* clipboard() { return NULL; }
- virtual WebMimeRegistry* mimeRegistry() { return NULL; }
- virtual WebSandboxSupport* sandboxSupport() { return NULL; }
- virtual bool sandboxEnabled() { return true; }
- virtual WebThemeEngine* themeEngine() { return NULL; }
-
- virtual WebStorageNamespace* createLocalStorageNamespace(
- const WebString& path) { return 0; }
- virtual WebStorageNamespace* createSessionStorageNamespace() { return 0; }
-
- virtual unsigned long long visitedLinkHash(const char*, size_t) { return 0; }
- virtual bool isLinkVisited(unsigned long long) { return false; }
-
- virtual WebKit::WebMessagePortChannel* createMessagePortChannel() {
- return NULL;
- }
-
- 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 WebString queryLocalizedString(WebLocalizedString::Name) {
- return WebString();
- }
- virtual WebString queryLocalizedString(WebLocalizedString::Name, int) {
- return WebString();
- }
-
- 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 (*)()) { }
-
- virtual base::PlatformFile databaseOpenFile(
- const WebString& fileName, int desiredFlags) {
- return base::kInvalidPlatformFileValue;
- }
- virtual bool databaseDeleteFile(const WebString& fileName) {
- return false;
- }
- virtual long databaseGetFileAttributes(const WebString& fileName) {
- return -1;
- }
- virtual long long databaseGetFileSize(const WebString& fileName) {
- return 0;
- }
-
- bool fileExists(const WebString& path) { return false; }
- bool deleteFile(const WebString& path) { return false; }
- bool deleteEmptyDirectory(const WebString& path) { return false; }
- bool getFileSize(const WebString& path, long long& result) {
- return false;
- }
- bool getFileModificationTime(const WebString& path, time_t& result) {
- return false;
- }
- WebString directoryName(const WebString& path) { return WebString(); }
- WebString pathByAppendingComponent(const WebString& path,
- const WebString& component) {
- return WebString();
- }
- bool makeAllDirectories(const WebString& path) { return false; }
-
private:
// ---------------------------------------------------------------------------
// Requests from the renderer...
@@ -318,11 +211,14 @@ class SandboxIPCProcess : public WebKitClient {
chars[i] = c;
}
- const WebString family = WebFontInfo::familyForChars(chars.get(), num_chars);
- const std::string family_utf8 = UTF16ToUTF8(family);
+ WebCString family = WebFontInfo::familyForChars(chars.get(), num_chars);
Pickle reply;
- reply.WriteString(family_utf8);
+ if (family.data()) {
+ reply.WriteString(family.data());
+ } else {
+ reply.WriteString("");
+ }
SendRendererReply(fds, reply, -1);
}