summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-05 16:38:41 +0000
committerjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-05 16:38:41 +0000
commit1831acf00bbfad84ffe7492dee9fe87550bfae32 (patch)
tree7a3b9dd190cfbfcbcdbf848a56cf0e82e11fcf46 /chrome
parent9ba448d61f35443f907d6b434ce58acd14a1c235 (diff)
downloadchromium_src-1831acf00bbfad84ffe7492dee9fe87550bfae32.zip
chromium_src-1831acf00bbfad84ffe7492dee9fe87550bfae32.tar.gz
chromium_src-1831acf00bbfad84ffe7492dee9fe87550bfae32.tar.bz2
Add a dummy call to icu::TimeZone.createDefault() before the sandbox kicks in.
This is necessary to get the datetime formatting work correctly in a renderer process (e.g. FTP directory list that is now done in a renderer process.) BUG=23361,23082 TEST=... Review URL: http://codereview.chromium.org/243060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27999 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/zygote_main_linux.cc9
-rw-r--r--chrome/renderer/renderer_main_platform_delegate_win.cc14
2 files changed, 22 insertions, 1 deletions
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index fd365ab..eb0ef42 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -18,6 +18,7 @@
#include "base/path_service.h"
#include "base/pickle.h"
#include "base/rand_util.h"
+#include "base/scoped_ptr.h"
#include "base/sys_info.h"
#include "base/unix_domain_socket_posix.h"
@@ -37,6 +38,8 @@
#include <selinux/context.h>
#endif
+#include "unicode/timezone.h"
+
// http://code.google.com/p/chromium/wiki/LinuxZygote
static const int kMagicSandboxIPCDescriptor = 5;
@@ -377,6 +380,12 @@ static void PreSandboxInit() {
const char* locale = setlocale(LC_ALL, "");
LOG_IF(WARNING, locale == NULL) << "setlocale failed.";
+ // ICU DateFormat class (used in base/time_format.cc) needs to get the
+ // Olson timezone ID by accessing the zoneinfo files on disk. After
+ // TimeZone::createDefault is called once here, the timezone ID is
+ // cached and there's no more need to access the file system.
+ scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
+
FilePath module_path;
if (PathService::Get(base::DIR_MODULE, &module_path))
media::InitializeMediaLibrary(module_path);
diff --git a/chrome/renderer/renderer_main_platform_delegate_win.cc b/chrome/renderer/renderer_main_platform_delegate_win.cc
index 8d725e7..12f8242 100644
--- a/chrome/renderer/renderer_main_platform_delegate_win.cc
+++ b/chrome/renderer/renderer_main_platform_delegate_win.cc
@@ -6,10 +6,12 @@
#include "base/command_line.h"
#include "base/gfx/native_theme.h"
+#include "base/scoped_ptr.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/injection_test_dll.h"
#include "sandbox/src/sandbox.h"
+#include "unicode/timezone.h"
namespace {
@@ -33,7 +35,7 @@ void EnableThemeSupportForRenderer(bool no_sandbox) {
}
HWND window = ::CreateWindowExW(0, L"Static", L"", WS_POPUP | WS_DISABLED,
- CW_USEDEFAULT, 0, 0, 0, HWND_MESSAGE, NULL,
+ CW_USEDEFAULT, 0, 0, 0, HWND_MESSAGE, NULL,
::GetModuleHandleA(NULL), NULL);
if (!window) {
DLOG(WARNING) << "failed to enable theme support";
@@ -75,6 +77,16 @@ void RendererMainPlatformDelegate::PlatformInitialize() {
const CommandLine& command_line = parameters_.command_line_;
bool no_sandbox = command_line.HasSwitch(switches::kNoSandbox);
EnableThemeSupportForRenderer(no_sandbox);
+
+ if (!no_sandbox) {
+ // ICU DateFormat class (used in base/time_format.cc) needs to get the
+ // Olson timezone ID by accessing the registry keys under
+ // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.
+ // After TimeZone::createDefault is called once here, the timezone ID is
+ // cached and there's no more need to access the registry. If the sandbox
+ // is disabled, we don't have to make this dummy call.
+ scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
+ }
}
void RendererMainPlatformDelegate::PlatformUninitialize() {