diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 21:42:38 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 21:42:38 +0000 |
commit | 06dbd0779f5a378f33d26526db0f9216c28ff35c (patch) | |
tree | bf8a6a4170b28e11006eaa77f2005070cb1729ba | |
parent | a92b2d393e4e751f25d2b03c7140fde1af8c56c4 (diff) | |
download | chromium_src-06dbd0779f5a378f33d26526db0f9216c28ff35c.zip chromium_src-06dbd0779f5a378f33d26526db0f9216c28ff35c.tar.gz chromium_src-06dbd0779f5a378f33d26526db0f9216c28ff35c.tar.bz2 |
Remove RDH from UtilityProcessHost.
The utility process should not need to issue resource requests.
BUG=78596
TEST=none
Review URL: http://codereview.chromium.org/6805008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80702 0039d316-1c4b-4281-b951-d872f2087c98
8 files changed, 23 insertions, 34 deletions
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index 22af3a1..731d9bf 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -579,7 +579,7 @@ class SafeManifestParser : public UtilityProcessHost::Client { !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); if (use_utility_process) { UtilityProcessHost* host = new UtilityProcessHost( - rdh, this, BrowserThread::UI); + this, BrowserThread::UI); host->StartUpdateManifestParse(xml_); } else { UpdateManifest manifest; diff --git a/chrome/browser/extensions/extension_webstore_private_api.cc b/chrome/browser/extensions/extension_webstore_private_api.cc index ca7e984..ff8b374 100644 --- a/chrome/browser/extensions/extension_webstore_private_api.cc +++ b/chrome/browser/extensions/extension_webstore_private_api.cc @@ -164,13 +164,12 @@ class SafeBeginInstallHelper : public UtilityProcessHost::Client { BrowserThread::IO, FROM_HERE, NewRunnableMethod(this, - &SafeBeginInstallHelper::StartWorkOnIOThread, - g_browser_process->resource_dispatcher_host())); + &SafeBeginInstallHelper::StartWorkOnIOThread)); } - void StartWorkOnIOThread(ResourceDispatcherHost* rdh) { + void StartWorkOnIOThread() { CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - utility_host_ = new UtilityProcessHost(rdh, this, BrowserThread::IO); + utility_host_ = new UtilityProcessHost(this, BrowserThread::IO); utility_host_->StartBatchMode(); if (icon_data_.empty()) icon_decode_complete_ = true; diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc index 8b42d5e..6c41707 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc @@ -146,8 +146,7 @@ SandboxedExtensionUnpacker::~SandboxedExtensionUnpacker() { void SandboxedExtensionUnpacker::StartProcessOnIOThread( const FilePath& temp_crx_path) { - UtilityProcessHost* host = new UtilityProcessHost( - rdh_, this, thread_identifier_); + UtilityProcessHost* host = new UtilityProcessHost(this, thread_identifier_); host->StartExtensionUnpacker(temp_crx_path); } diff --git a/chrome/browser/idbbindingutilities_browsertest.cc b/chrome/browser/idbbindingutilities_browsertest.cc index cf95cb6..aa7a2d7 100644 --- a/chrome/browser/idbbindingutilities_browsertest.cc +++ b/chrome/browser/idbbindingutilities_browsertest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -67,18 +67,16 @@ class IDBKeyPathHelper : public UtilityProcessHost::Client { value_for_key_path_failed_(false) { } - void CreateUtilityProcess(ResourceDispatcherHost* resource_dispatcher_host) { + void CreateUtilityProcess() { if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - NewRunnableMethod(this, &IDBKeyPathHelper::CreateUtilityProcess, - resource_dispatcher_host)); + NewRunnableMethod(this, &IDBKeyPathHelper::CreateUtilityProcess)); return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); utility_process_host_ = - new UtilityProcessHost(resource_dispatcher_host, this, - BrowserThread::IO); + new UtilityProcessHost(this, BrowserThread::IO); utility_process_host_->StartBatchMode(); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, new MessageLoop::QuitTask()); @@ -193,8 +191,7 @@ class ScopedIDBKeyPathHelper { public: ScopedIDBKeyPathHelper() { key_path_helper_ = new IDBKeyPathHelper(); - key_path_helper_->CreateUtilityProcess( - g_browser_process->resource_dispatcher_host()); + key_path_helper_->CreateUtilityProcess(); ui_test_utils::RunMessageLoop(); } diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc index 888da1e..5669ec0 100644 --- a/chrome/browser/utility_process_host.cc +++ b/chrome/browser/utility_process_host.cc @@ -17,10 +17,9 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/ui_base_switches.h" -UtilityProcessHost::UtilityProcessHost(ResourceDispatcherHost* rdh, - Client* client, +UtilityProcessHost::UtilityProcessHost(Client* client, BrowserThread::ID client_thread_id) - : BrowserChildProcessHost(UTILITY_PROCESS, rdh), + : BrowserChildProcessHost(UTILITY_PROCESS, NULL), client_(client), client_thread_id_(client_thread_id), is_batch_mode_(false) { diff --git a/chrome/browser/utility_process_host.h b/chrome/browser/utility_process_host.h index fa8a9c6..b8c8cff 100644 --- a/chrome/browser/utility_process_host.h +++ b/chrome/browser/utility_process_host.h @@ -116,8 +116,7 @@ class UtilityProcessHost : public BrowserChildProcessHost { DISALLOW_COPY_AND_ASSIGN(Client); }; - UtilityProcessHost(ResourceDispatcherHost* rdh, Client* client, - BrowserThread::ID client_thread_id); + UtilityProcessHost(Client* client, BrowserThread::ID client_thread_id); virtual ~UtilityProcessHost(); // Start a process to unpack the extension at the given path. The process diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc index 717c850..1bd0393 100644 --- a/chrome/browser/web_resource/web_resource_service.cc +++ b/chrome/browser/web_resource/web_resource_service.cc @@ -123,6 +123,8 @@ class WebResourceService::UnpackerClient void Start() { AddRef(); // balanced in Cleanup. + // TODO(willchan): Look for a better signal of whether we're in a unit test + // or not. Using |resource_dispatcher_host_| for this is pretty lame. // If we don't have a resource_dispatcher_host_, assume we're in // a test and run the unpacker directly in-process. bool use_utility_process = @@ -134,7 +136,6 @@ class WebResourceService::UnpackerClient BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, NewRunnableMethod(this, &UnpackerClient::StartProcessOnIOThread, - web_resource_service_->resource_dispatcher_host_, thread_id)); } else { WebResourceUnpacker unpacker(json_data_); @@ -178,9 +179,8 @@ class WebResourceService::UnpackerClient Release(); } - void StartProcessOnIOThread(ResourceDispatcherHost* rdh, - BrowserThread::ID thread_id) { - UtilityProcessHost* host = new UtilityProcessHost(rdh, this, thread_id); + void StartProcessOnIOThread(BrowserThread::ID thread_id) { + UtilityProcessHost* host = new UtilityProcessHost(this, thread_id); // TODO(mrc): get proper file path when we start using web resources // that need to be unpacked. host->StartWebResourceUnpacker(json_data_); diff --git a/content/browser/in_process_webkit/indexed_db_key_utility_client.cc b/content/browser/in_process_webkit/indexed_db_key_utility_client.cc index d3e0300..d995334 100644 --- a/content/browser/in_process_webkit/indexed_db_key_utility_client.cc +++ b/content/browser/in_process_webkit/indexed_db_key_utility_client.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,6 @@ #include "base/lazy_instance.h" #include "base/synchronization/waitable_event.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/utility_process_host.h" #include "content/common/indexed_db_key.h" #include "content/common/serialized_script_value.h" @@ -62,7 +61,7 @@ class KeyUtilityClientImpl ~KeyUtilityClientImpl(); void GetRDHAndStartUtilityProcess(); - void StartUtilityProcessInternal(ResourceDispatcherHost* rdh); + void StartUtilityProcessInternal(); void EndUtilityProcessInternal(); void CallStartIDBKeyFromValueAndKeyPathFromIOThread( const std::vector<SerializedScriptValue>& values, @@ -252,12 +251,10 @@ void KeyUtilityClientImpl::GetRDHAndStartUtilityProcess() { return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - StartUtilityProcessInternal(g_browser_process->resource_dispatcher_host()); + StartUtilityProcessInternal(); } -void KeyUtilityClientImpl::StartUtilityProcessInternal( - ResourceDispatcherHost* rdh) { - DCHECK(rdh); +void KeyUtilityClientImpl::StartUtilityProcessInternal() { // The ResourceDispatcherHost can only be used on the IO thread. if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -265,8 +262,7 @@ void KeyUtilityClientImpl::StartUtilityProcessInternal( BrowserThread::IO, FROM_HERE, NewRunnableMethod( this, - &KeyUtilityClientImpl::StartUtilityProcessInternal, - rdh)); + &KeyUtilityClientImpl::StartUtilityProcessInternal)); return; } DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); @@ -274,7 +270,7 @@ void KeyUtilityClientImpl::StartUtilityProcessInternal( client_ = new KeyUtilityClientImpl::Client(this); utility_process_host_ = new UtilityProcessHost( - rdh, client_.get(), BrowserThread::IO); + client_.get(), BrowserThread::IO); utility_process_host_->StartBatchMode(); state_ = STATE_INITIALIZED; waitable_event_.Signal(); |