Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: content/browser/renderer_host/render_sandbox_host_linux.cc

Issue 7578013: Make the Linux sandbox process initialize WebKit before using the WebKit api. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_sandbox_host_linux.cc
diff --git a/content/browser/renderer_host/render_sandbox_host_linux.cc b/content/browser/renderer_host/render_sandbox_host_linux.cc
index 16fa2c44e95db141d40452b3ed8014f0fae7dda5..a1e49e142bd6d190292fd494e1b31ca04f1fe64d 100644
--- a/content/browser/renderer_host/render_sandbox_host_linux.cc
+++ b/content/browser/renderer_host/render_sandbox_host_linux.cc
@@ -31,7 +31,9 @@
#include "content/common/unix_domain_socket_posix.h"
#include "skia/ext/SkFontHost_fontconfig_direct.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 "webkit/glue/webkitclient_impl.h"
using WebKit::WebCString;
using WebKit::WebFontInfo;
@@ -68,6 +70,8 @@ class SandboxIPCProcess {
}
}
+ ~SandboxIPCProcess();
+
void Run() {
struct pollfd pfds[2];
pfds[0].fd = lifeline_fd_;
@@ -101,6 +105,8 @@ class SandboxIPCProcess {
}
private:
+ void EnsureWebKitInitialized();
+
// ---------------------------------------------------------------------------
// Requests from the renderer...
@@ -245,6 +251,7 @@ class SandboxIPCProcess {
return;
}
+ EnsureWebKitInitialized();
scoped_array<WebUChar> chars(new WebUChar[num_chars]);
for (int i = 0; i < num_chars; ++i) {
@@ -283,6 +290,7 @@ class SandboxIPCProcess {
return;
}
+ EnsureWebKitInitialized();
WebKit::WebFontRenderStyle style;
WebFontInfo::renderStyleForStrike(family.c_str(), sizeAndStyle, &style);
@@ -637,8 +645,21 @@ class SandboxIPCProcess {
const int browser_socket_;
FontConfigDirect* const font_config_;
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698