1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/browser/chrome_browser_main_linux.h" 6 7 #include <fontconfig/fontconfig.h> 8 9 #include "chrome/browser/browser_process.h" 10 #include "components/crash/app/breakpad_linux.h" 11 #include "components/metrics/metrics_service.h" 12 13 #if !defined(OS_CHROMEOS) 14 #include "base/linux_util.h" 15 #include "chrome/browser/sxs_linux.h" 16 #include "content/public/browser/browser_thread.h" 17 #endif 18 19 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( 20 const content::MainFunctionParams& parameters) 21 : ChromeBrowserMainPartsPosix(parameters) { 22 } 23 24 ChromeBrowserMainPartsLinux::~ChromeBrowserMainPartsLinux() { 25 } 26 27 void ChromeBrowserMainPartsLinux::ToolkitInitialized() { 28 // Explicitly initialize Fontconfig early on to prevent races later due to 29 // implicit initialization in response to threads' first calls to Fontconfig: 30 // http://crbug.com/404311 31 FcInit(); 32 33 ChromeBrowserMainPartsPosix::ToolkitInitialized(); 34 } 35 36 void ChromeBrowserMainPartsLinux::PreProfileInit() { 37 #if !defined(OS_CHROMEOS) 38 // Needs to be called after we have chrome::DIR_USER_DATA and 39 // g_browser_process. This happens in PreCreateThreads. 40 // base::GetLinuxDistro() will initialize its value if needed. 41 content::BrowserThread::PostBlockingPoolTask( 42 FROM_HERE, 43 base::Bind(base::IgnoreResult(&base::GetLinuxDistro))); 44 45 content::BrowserThread::PostBlockingPoolTask( 46 FROM_HERE, 47 base::Bind(&sxs_linux::AddChannelMarkToUserDataDir)); 48 #endif 49 50 ChromeBrowserMainPartsPosix::PreProfileInit(); 51 } 52 53 void ChromeBrowserMainPartsLinux::PostProfileInit() { 54 ChromeBrowserMainPartsPosix::PostProfileInit(); 55 56 g_browser_process->metrics_service()->RecordBreakpadRegistration( 57 breakpad::IsCrashReporterEnabled()); 58 } 59