From d85cf074f2186dbe1cf8a9db5d89a2b817ffb0e1 Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Tue, 27 Oct 2009 03:59:31 +0000 Subject: Simplify threading in browser thread by making only ChromeThread deal with different thread lifetimes.The rest of the code doesn't get MessageLoop pointers since they're not thread-safe and instead just call PostTask on ChromeThread. If the target thread is not alive, then the task is simply deleted.In a followup change, I'll remove any remaining MessageLoop* caching. With this change, there's little to be gained by caching since no locks are involved if the target MessageLoop is guaranteed to outlive the current thread (inferred automatically by the order of the chrome_threads_ array).BUG=25354 Review URL: http://codereview.chromium.org/306032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30163 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/plugin_service.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'chrome/browser/plugin_service.cc') diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index 78867e4..54577a7 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -104,8 +104,7 @@ const std::wstring& PluginService::GetUILocale() { PluginProcessHost* PluginService::FindPluginProcess( const FilePath& plugin_path) { - DCHECK(MessageLoop::current() == - ChromeThread::GetMessageLoop(ChromeThread::IO)); + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); if (plugin_path.value().empty()) { NOTREACHED() << "should only be called if we have a plugin to load"; @@ -124,8 +123,7 @@ PluginProcessHost* PluginService::FindPluginProcess( PluginProcessHost* PluginService::FindOrStartPluginProcess( const FilePath& plugin_path) { - DCHECK(MessageLoop::current() == - ChromeThread::GetMessageLoop(ChromeThread::IO)); + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); PluginProcessHost *plugin_host = FindPluginProcess(plugin_path); if (plugin_host) @@ -155,8 +153,7 @@ void PluginService::OpenChannelToPlugin( const std::string& mime_type, const std::wstring& locale, IPC::Message* reply_msg) { - DCHECK(MessageLoop::current() == - ChromeThread::GetMessageLoop(ChromeThread::IO)); + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); // We don't need a policy URL here because that was already checked by a // previous call to GetPluginPath. GURL policy_url; -- cgit v1.1