Commit dd357e1e authored by derat@chromium.org's avatar derat@chromium.org

linux: Explicitly call FcInit() in ToolkitInitialized().

This hopefully prevents implicit Fontconfig initialization
from occurring later when queries are first made from
gfx::FontRenderParams/Skia/Blink/etc.

BUG=404311

Review URL: https://codereview.chromium.org/497523002

Cr-Commit-Position: refs/heads/master@{#291298}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291298 0039d316-1c4b-4281-b951-d872f2087c98
parent 4e9e8c7a
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "chrome/browser/chrome_browser_main_linux.h" #include "chrome/browser/chrome_browser_main_linux.h"
#include <fontconfig/fontconfig.h>
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "components/breakpad/app/breakpad_linux.h" #include "components/breakpad/app/breakpad_linux.h"
#include "components/metrics/metrics_service.h" #include "components/metrics/metrics_service.h"
...@@ -22,6 +24,15 @@ ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( ...@@ -22,6 +24,15 @@ ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux(
ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() {
} }
void ChromeBrowserMainPartsLinux::ToolkitInitialized() {
// Explicitly initialize Fontconfig early on to prevent races later due to
// implicit initialization in response to threads' first calls to Fontconfig:
// http://crbug.com/404311
FcInit();
ChromeBrowserMainPartsPosix::ToolkitInitialized();
}
void ChromeBrowserMainPartsLinux::PreProfileInit() { void ChromeBrowserMainPartsLinux::PreProfileInit() {
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
// Needs to be called after we have chrome::DIR_USER_DATA and // Needs to be called after we have chrome::DIR_USER_DATA and
......
...@@ -17,6 +17,7 @@ class ChromeBrowserMainPartsLinux : public ChromeBrowserMainPartsPosix { ...@@ -17,6 +17,7 @@ class ChromeBrowserMainPartsLinux : public ChromeBrowserMainPartsPosix {
virtual ~ChromeBrowserMainPartsLinux(); virtual ~ChromeBrowserMainPartsLinux();
// ChromeBrowserMainParts overrides. // ChromeBrowserMainParts overrides.
virtual void ToolkitInitialized() OVERRIDE;
virtual void PreProfileInit() OVERRIDE; virtual void PreProfileInit() OVERRIDE;
virtual void PostProfileInit() OVERRIDE; virtual void PostProfileInit() OVERRIDE;
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "ui/gfx/font_render_params.h" #include "ui/gfx/font_render_params.h"
#include <fontconfig/fontconfig.h>
#include "base/command_line.h" #include "base/command_line.h"
#include "base/containers/mru_cache.h" #include "base/containers/mru_cache.h"
#include "base/hash.h" #include "base/hash.h"
...@@ -17,8 +19,6 @@ ...@@ -17,8 +19,6 @@
#include "ui/gfx/linux_font_delegate.h" #include "ui/gfx/linux_font_delegate.h"
#include "ui/gfx/switches.h" #include "ui/gfx/switches.h"
#include <fontconfig/fontconfig.h>
namespace gfx { namespace gfx {
namespace { namespace {
......
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