summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/zygote_main_linux.cc8
-rw-r--r--chrome/renderer/renderer_main_platform_delegate_linux.cc3
2 files changed, 8 insertions, 3 deletions
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index 4da9bfe..7c50e148 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -310,6 +310,14 @@ static bool MaybeEnterChroot() {
// files and cache the results or the descriptors.
base::RandUint64();
+ // To make wcstombs/mbstowcs work in a renderer, setlocale() has to be
+ // called before the sandbox is triggered. It's possible to avoid calling
+ // setlocale() by pulling out the conversion between FilePath and
+ // WebCore String out of the renderer and using string16 in place of
+ // FilePath for IPC.
+ const char* locale = setlocale(LC_ALL, "");
+ LOG_IF(WARNING, locale == NULL) << "setlocale failed.";
+
#if defined(ARCH_CPU_X86_FAMILY)
PATCH_GLOBAL_OFFSET_TABLE(localtime, sandbox_wrapper::localtime);
PATCH_GLOBAL_OFFSET_TABLE(localtime_r, sandbox_wrapper::localtime_r);
diff --git a/chrome/renderer/renderer_main_platform_delegate_linux.cc b/chrome/renderer/renderer_main_platform_delegate_linux.cc
index 637f749..34e04d2 100644
--- a/chrome/renderer/renderer_main_platform_delegate_linux.cc
+++ b/chrome/renderer/renderer_main_platform_delegate_linux.cc
@@ -17,9 +17,6 @@ RendererMainPlatformDelegate::~RendererMainPlatformDelegate() {
}
void RendererMainPlatformDelegate::PlatformInitialize() {
- // To make wcstombs/mbstowcs work in a renderer.
- const char* locale = setlocale(LC_ALL, "");
- LOG_IF(WARNING, locale == NULL) << "setlocale failed.";
}
void RendererMainPlatformDelegate::PlatformUninitialize() {