Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2262)

Unified Diff: chrome/browser/web_resource/web_resource_service.cc

Issue 9150016: Move creation and ownership of ResourceDispatcherHost and PluginService to content. This gives a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/web_resource/web_resource_service.cc
===================================================================
--- chrome/browser/web_resource/web_resource_service.cc (revision 116798)
+++ chrome/browser/web_resource/web_resource_service.cc (working copy)
@@ -30,21 +30,18 @@
// the WebResourceService.
class WebResourceService::UnpackerClient : public UtilityProcessHost::Client {
public:
- explicit UnpackerClient(WebResourceService* web_resource_service)
+ UnpackerClient(WebResourceService* web_resource_service,
+ bool use_utility_process)
: web_resource_service_(web_resource_service),
- resource_dispatcher_host_(g_browser_process->resource_dispatcher_host()),
+ use_utility_process_(use_utility_process),
got_response_(false) {
}
void Start(const std::string& json_data) {
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 =
- resource_dispatcher_host_ != NULL &&
+ use_utility_process_ &&
!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
if (use_utility_process) {
BrowserThread::ID thread_id;
@@ -118,8 +115,7 @@
scoped_refptr<WebResourceService> web_resource_service_;
- // Owned by the global browser process.
- ResourceDispatcherHost* resource_dispatcher_host_;
+ bool use_utility_process_;
// True if we got a response from the utility process and have cleaned up
// already.
@@ -140,7 +136,8 @@
apply_locale_to_url_(apply_locale_to_url),
last_update_time_pref_name_(last_update_time_pref_name),
start_fetch_delay_ms_(start_fetch_delay_ms),
- cache_update_delay_ms_(cache_update_delay_ms) {
+ cache_update_delay_ms_(cache_update_delay_ms),
+ use_utility_process_(true) {
DCHECK(prefs);
}
@@ -231,7 +228,7 @@
source->GetResponseAsString(&data);
// UnpackerClient releases itself.
- UnpackerClient* client = new UnpackerClient(this);
+ UnpackerClient* client = new UnpackerClient(this, use_utility_process_);
client->Start(data);
Release();

Powered by Google App Engine
This is Rietveld 408576698