Commit 199f0db1 authored by levin@chromium.org's avatar levin@chromium.org

Make the Linux sandbox process initialize WebKit before using the WebKit api.

TEST=Starting DumpRenderTree will assert without this after I land a change in WebKIt.

Review URL: http://codereview.chromium.org/7578013

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95533 0039d316-1c4b-4281-b951-d872f2087c98
parent a33d3a92
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
#include "content/common/unix_domain_socket_posix.h" #include "content/common/unix_domain_socket_posix.h"
#include "skia/ext/SkFontHost_fontconfig_direct.h" #include "skia/ext/SkFontHost_fontconfig_direct.h"
#include "third_party/npapi/bindings/npapi_extensions.h" #include "third_party/npapi/bindings/npapi_extensions.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebFontInfo.h" #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebFontInfo.h"
#include "webkit/glue/webkitclient_impl.h"
using WebKit::WebCString; using WebKit::WebCString;
using WebKit::WebFontInfo; using WebKit::WebFontInfo;
...@@ -68,6 +70,8 @@ class SandboxIPCProcess { ...@@ -68,6 +70,8 @@ class SandboxIPCProcess {
} }
} }
~SandboxIPCProcess();
void Run() { void Run() {
struct pollfd pfds[2]; struct pollfd pfds[2];
pfds[0].fd = lifeline_fd_; pfds[0].fd = lifeline_fd_;
...@@ -101,6 +105,8 @@ class SandboxIPCProcess { ...@@ -101,6 +105,8 @@ class SandboxIPCProcess {
} }
private: private:
void EnsureWebKitInitialized();
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Requests from the renderer... // Requests from the renderer...
...@@ -245,6 +251,7 @@ class SandboxIPCProcess { ...@@ -245,6 +251,7 @@ class SandboxIPCProcess {
return; return;
} }
EnsureWebKitInitialized();
scoped_array<WebUChar> chars(new WebUChar[num_chars]); scoped_array<WebUChar> chars(new WebUChar[num_chars]);
for (int i = 0; i < num_chars; ++i) { for (int i = 0; i < num_chars; ++i) {
...@@ -283,6 +290,7 @@ class SandboxIPCProcess { ...@@ -283,6 +290,7 @@ class SandboxIPCProcess {
return; return;
} }
EnsureWebKitInitialized();
WebKit::WebFontRenderStyle style; WebKit::WebFontRenderStyle style;
WebFontInfo::renderStyleForStrike(family.c_str(), sizeAndStyle, &style); WebFontInfo::renderStyleForStrike(family.c_str(), sizeAndStyle, &style);
...@@ -637,8 +645,21 @@ class SandboxIPCProcess { ...@@ -637,8 +645,21 @@ class SandboxIPCProcess {
const int browser_socket_; const int browser_socket_;
FontConfigDirect* const font_config_; FontConfigDirect* const font_config_;
std::vector<std::string> sandbox_cmd_; std::vector<std::string> sandbox_cmd_;
scoped_ptr<webkit_glue::WebKitClientImpl> webkit_client_;
}; };
SandboxIPCProcess::~SandboxIPCProcess() {
if (webkit_client_.get())
WebKit::shutdown();
}
void SandboxIPCProcess::EnsureWebKitInitialized() {
if (webkit_client_.get())
return;
webkit_client_.reset(new webkit_glue::WebKitClientImpl);
WebKit::initialize(webkit_client_.get());
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Runs on the main thread at startup. // Runs on the main thread at startup.
......
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