From 3c2a3d1369b6fe67239f8dbea1e4879748781f96 Mon Sep 17 00:00:00 2001 From: "darin@chromium.org" Date: Fri, 16 Jan 2009 05:16:56 +0000 Subject: Run ShellExecute on the file thread instead of the IO thread. ShellExecute can be janky so we don't want to be calling it on the IO thread. The file thread is really the "blocking io" thread, and it's where we call ShellExecute for other things. R=nsylvain Review URL: http://codereview.chromium.org/18120 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8166 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/external_protocol_handler.cc | 8 +++++--- chrome/browser/external_protocol_handler.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/chrome/browser/external_protocol_handler.cc b/chrome/browser/external_protocol_handler.cc index 24423ac..18ff2bf 100644 --- a/chrome/browser/external_protocol_handler.cc +++ b/chrome/browser/external_protocol_handler.cc @@ -129,13 +129,15 @@ void ExternalProtocolHandler::LaunchUrl(const GURL& url, return; } - MessageLoop* io_loop = g_browser_process->io_thread()->message_loop(); - if (io_loop == NULL) { + // Put this work on the file thread since ShellExecute may block for a + // significant amount of time. + MessageLoop* loop = g_browser_process->file_thread()->message_loop(); + if (loop == NULL) { return; } // Otherwise the protocol is white-listed, so go ahead and launch. - io_loop->PostTask(FROM_HERE, + loop->PostTask(FROM_HERE, NewRunnableFunction( &ExternalProtocolHandler::LaunchUrlWithoutSecurityCheck, escaped_url)); diff --git a/chrome/browser/external_protocol_handler.h b/chrome/browser/external_protocol_handler.h index 75f3f93..830c290 100644 --- a/chrome/browser/external_protocol_handler.h +++ b/chrome/browser/external_protocol_handler.h @@ -42,7 +42,7 @@ class ExternalProtocolHandler { // NOTE: You should Not call this function directly unless you are sure the // url you have has been checked against the blacklist, and has been escaped. // All calls to this function should originate in some way from LaunchUrl. - // Must run on the IO thread. + // Must run on the file thread. static void LaunchUrlWithoutSecurityCheck(const GURL& url); // Prepopulates the dictionary with known protocols to deny or allow, if -- cgit v1.1