From ad1e6fef08b3b2d0e372e8597fe362657ea0a11d Mon Sep 17 00:00:00 2001 From: jeremyim Date: Fri, 6 Mar 2015 12:34:21 -0800 Subject: [PATCH] Ensure the DRP message filter is always created This is a speculative fix, as I'm unable to get a local repro. BUG=464317 Review URL: https://codereview.chromium.org/988753002 Cr-Commit-Position: refs/heads/master@{#319485} --- chrome/browser/chrome_content_browser_client.cc | 6 ++---- .../content/browser/data_reduction_proxy_message_filter.cc | 4 ++-- .../content/browser/data_reduction_proxy_message_filter.h | 3 ++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index e821dfbdd056..bfa6e90bcd68 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -948,10 +948,8 @@ void ChromeContentBrowserClient::RenderProcessWillLaunch( DataReductionProxyChromeSettings* data_reduction_proxy_settings = DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile); - if (data_reduction_proxy_settings) { - host->AddFilter(new data_reduction_proxy::DataReductionProxyMessageFilter( - data_reduction_proxy_settings)); - } + host->AddFilter(new data_reduction_proxy::DataReductionProxyMessageFilter( + data_reduction_proxy_settings)); host->Send(new ChromeViewMsg_SetIsIncognitoProcess( profile->IsOffTheRecord())); diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.cc index e01c4998d715..ed2cd4d40c8c 100644 --- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.cc +++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.cc @@ -17,8 +17,8 @@ DataReductionProxyMessageFilter::DataReductionProxyMessageFilter( DataReductionProxySettings* settings) : BrowserMessageFilter(DataReductionProxyStart), config_(nullptr) { - DCHECK(settings); - config_ = settings->Config(); + if (settings) + config_ = settings->Config(); } DataReductionProxyMessageFilter::~DataReductionProxyMessageFilter() { diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.h b/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.h index c7b3dcc4aef8..e9ede87d8d6e 100644 --- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.h +++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_message_filter.h @@ -21,6 +21,7 @@ class DataReductionProxySettings; class DataReductionProxyMessageFilter : public content::BrowserMessageFilter { public: + // |settings| may be null. DataReductionProxyMessageFilter(DataReductionProxySettings* settings); // Sets |response| to true if the |proxy_server| corresponds to a Data @@ -36,7 +37,7 @@ class DataReductionProxyMessageFilter void OverrideThreadForMessage(const IPC::Message& message, content::BrowserThread::ID* thread) override; - // Must outlive |this|. + // Must outlive |this|. May be null. DataReductionProxyConfig* config_; DISALLOW_COPY_AND_ASSIGN(DataReductionProxyMessageFilter); -- 2.11.4.GIT