diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-24 12:57:09 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-24 12:57:09 +0000 |
commit | a153f552cead8a317b8a95671fad9d0d5360bc87 (patch) | |
tree | 62619de4a951ef6d38583e30c3160d6db3e8aa6d | |
parent | 3154c3cb41b75321bc746eda5ccdfbd54180affc (diff) | |
download | chromium_src-a153f552cead8a317b8a95671fad9d0d5360bc87.zip chromium_src-a153f552cead8a317b8a95671fad9d0d5360bc87.tar.gz chromium_src-a153f552cead8a317b8a95671fad9d0d5360bc87.tar.bz2 |
Cleanup: Convert chrome_browser_main_linux.cc to use the blocking thread pool.
Also remove cruft and simplify code.
Review URL: https://codereview.chromium.org/297023002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272728 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chrome_browser_main_linux.cc | 29 | ||||
-rw-r--r-- | chrome/browser/sxs_linux.cc | 6 | ||||
-rw-r--r-- | chrome/browser/sxs_linux.h | 2 |
3 files changed, 10 insertions, 27 deletions
diff --git a/chrome/browser/chrome_browser_main_linux.cc b/chrome/browser/chrome_browser_main_linux.cc index 52f8641..dba10a3 100644 --- a/chrome/browser/chrome_browser_main_linux.cc +++ b/chrome/browser/chrome_browser_main_linux.cc @@ -4,33 +4,16 @@ #include "chrome/browser/chrome_browser_main_linux.h" -#include <stdlib.h> - -#include "base/command_line.h" -#include "base/linux_util.h" -#include "base/prefs/pref_service.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/metrics/metrics_service.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/common/env_vars.h" -#include "chrome/common/pref_names.h" #include "components/breakpad/app/breakpad_linux.h" #if !defined(OS_CHROMEOS) +#include "base/linux_util.h" #include "chrome/browser/sxs_linux.h" #include "content/public/browser/browser_thread.h" #endif -namespace { - -#if !defined(OS_CHROMEOS) -void GetLinuxDistroCallback() { - base::GetLinuxDistro(); // Initialize base::linux_distro if needed. -} -#endif - -} // namespace - ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( const content::MainFunctionParams& parameters) : ChromeBrowserMainPartsPosix(parameters) { @@ -43,12 +26,12 @@ void ChromeBrowserMainPartsLinux::PreProfileInit() { #if !defined(OS_CHROMEOS) // Needs to be called after we have chrome::DIR_USER_DATA and // g_browser_process. This happens in PreCreateThreads. - content::BrowserThread::PostTask(content::BrowserThread::FILE, - FROM_HERE, - base::Bind(&GetLinuxDistroCallback)); + // base::GetLinuxDistro() will initialize its value if needed. + content::BrowserThread::PostBlockingPoolTask( + FROM_HERE, + base::Bind(base::IgnoreResult(&base::GetLinuxDistro))); - content::BrowserThread::PostTask( - content::BrowserThread::FILE, + content::BrowserThread::PostBlockingPoolTask( FROM_HERE, base::Bind(&sxs_linux::AddChannelMarkToUserDataDir)); #endif diff --git a/chrome/browser/sxs_linux.cc b/chrome/browser/sxs_linux.cc index 0d6b7dd..4979dee 100644 --- a/chrome/browser/sxs_linux.cc +++ b/chrome/browser/sxs_linux.cc @@ -89,7 +89,7 @@ bool DoAddChannelMarkToUserDataDir(const base::FilePath& user_data_dir) { namespace sxs_linux { void AddChannelMarkToUserDataDir() { - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); + DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); base::FilePath user_data_dir; if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) { LOG(ERROR) << "Failed to get user data dir path. The profile will not be " @@ -105,7 +105,7 @@ void AddChannelMarkToUserDataDir() { } bool ShouldMigrateUserDataDir() { - return CommandLine::ForCurrentProcess()->HasSwitch( + return base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kMigrateDataDirForSxS); } @@ -142,7 +142,7 @@ int MigrateUserDataDir() { } base::FilePath target_path = - CommandLine::ForCurrentProcess()->GetSwitchValuePath( + base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( switches::kMigrateDataDirForSxS); if (!base::Move(source_path, target_path)) { diff --git a/chrome/browser/sxs_linux.h b/chrome/browser/sxs_linux.h index cff48f2..618654e 100644 --- a/chrome/browser/sxs_linux.h +++ b/chrome/browser/sxs_linux.h @@ -16,7 +16,7 @@ namespace sxs_linux { // Records channel of the running browser in user data dir. This is needed // to support a seamless and automatic upgrade from non-side-by-side // to side-by-side Linux packages (the latter use different default data dirs). -// Must be run on FILE thread. +// Must be run on a blocking thread pool. void AddChannelMarkToUserDataDir(); // Returns true if user data dir migration has been requested. |