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

Side by Side Diff: android_webview/browser/aw_browser_context.cc

Issue 888713002: DataReductionProxyStatisticsPrefs should support WeakPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DRPSettings owns DRPStatisticsPrefs Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/browser/aw_browser_context.h" 5 #include "android_webview/browser/aw_browser_context.h"
6 6
7 #include "android_webview/browser/aw_form_database_service.h" 7 #include "android_webview/browser/aw_form_database_service.h"
8 #include "android_webview/browser/aw_pref_store.h" 8 #include "android_webview/browser/aw_pref_store.h"
9 #include "android_webview/browser/aw_quota_manager_bridge.h" 9 #include "android_webview/browser/aw_quota_manager_bridge.h"
10 #include "android_webview/browser/aw_resource_context.h" 10 #include "android_webview/browser/aw_resource_context.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (context == NULL || context->user_pref_service_.get() == NULL) 118 if (context == NULL || context->user_pref_service_.get() == NULL)
119 return; 119 return;
120 data_reduction_proxy::DataReductionProxySettings* proxy_settings = 120 data_reduction_proxy::DataReductionProxySettings* proxy_settings =
121 context->GetDataReductionProxySettings(); 121 context->GetDataReductionProxySettings();
122 if (proxy_settings == NULL) 122 if (proxy_settings == NULL)
123 return; 123 return;
124 // At this point, context->PreMainMessageLoopRun() has run, so 124 // At this point, context->PreMainMessageLoopRun() has run, so
125 // context->data_reduction_proxy_io_data() is valid. 125 // context->data_reduction_proxy_io_data() is valid.
126 DCHECK(context->GetDataReductionProxyIOData()); 126 DCHECK(context->GetDataReductionProxyIOData());
127 context->CreateDataReductionProxyStatisticsIfNecessary(); 127 context->CreateDataReductionProxyStatisticsIfNecessary();
128 proxy_settings->SetDataReductionProxyStatisticsPrefs(
129 context->GetDataReductionProxyIOData()->statistics_prefs());
130 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); 128 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_);
131 } 129 }
132 130
133 // static 131 // static
134 void AwBrowserContext::SetLegacyCacheRemovalDelayForTest(int delay_ms) { 132 void AwBrowserContext::SetLegacyCacheRemovalDelayForTest(int delay_ms) {
135 legacy_cache_removal_delay_ms_ = delay_ms; 133 legacy_cache_removal_delay_ms_ = delay_ms;
136 } 134 }
137 135
138 void AwBrowserContext::PreMainMessageLoopRun() { 136 void AwBrowserContext::PreMainMessageLoopRun() {
139 cookie_store_ = CreateCookieStore(this); 137 cookie_store_ = CreateCookieStore(this);
(...skipping 18 matching lines...) Expand all
158 cache_path, cookie_store_.get(), 156 cache_path, cookie_store_.get(),
159 make_scoped_ptr(CreateProxyConfigService()).Pass()); 157 make_scoped_ptr(CreateProxyConfigService()).Pass());
160 158
161 data_reduction_proxy_settings_.reset( 159 data_reduction_proxy_settings_.reset(
162 new data_reduction_proxy::DataReductionProxySettings( 160 new data_reduction_proxy::DataReductionProxySettings(
163 new data_reduction_proxy::DataReductionProxyParams( 161 new data_reduction_proxy::DataReductionProxyParams(
164 data_reduction_proxy::DataReductionProxyParams::kAllowed))); 162 data_reduction_proxy::DataReductionProxyParams::kAllowed)));
165 data_reduction_proxy_io_data_.reset( 163 data_reduction_proxy_io_data_.reset(
166 new data_reduction_proxy::DataReductionProxyIOData( 164 new data_reduction_proxy::DataReductionProxyIOData(
167 data_reduction_proxy::Client::WEBVIEW_ANDROID, 165 data_reduction_proxy::Client::WEBVIEW_ANDROID,
168 scoped_ptr<
169 data_reduction_proxy::DataReductionProxyStatisticsPrefs>(),
170 data_reduction_proxy_settings_.get(), 166 data_reduction_proxy_settings_.get(),
171 url_request_context_getter_->GetNetLog(), 167 url_request_context_getter_->GetNetLog(),
172 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 168 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
173 BrowserThread::GetMessageLoopProxyForThread( 169 BrowserThread::GetMessageLoopProxyForThread(
174 BrowserThread::UI))); 170 BrowserThread::UI)));
175 data_reduction_proxy_settings_->SetProxyConfigurator( 171 data_reduction_proxy_settings_->SetProxyConfigurator(
176 data_reduction_proxy_io_data_->configurator()); 172 data_reduction_proxy_io_data_->configurator());
177 173
178 visitedlink_master_.reset( 174 visitedlink_master_.reset(
179 new visitedlink::VisitedLinkMaster(this, this, false)); 175 new visitedlink::VisitedLinkMaster(this, this, false));
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 DCHECK(GetDataReductionProxyIOData()); 372 DCHECK(GetDataReductionProxyIOData());
377 if (GetDataReductionProxyIOData()->statistics_prefs()) 373 if (GetDataReductionProxyIOData()->statistics_prefs())
378 return; 374 return;
379 // We don't care about commit_delay for now. It is just a dummy value. 375 // We don't care about commit_delay for now. It is just a dummy value.
380 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); 376 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60);
381 GetDataReductionProxyIOData()->EnableCompressionStatisticsLogging( 377 GetDataReductionProxyIOData()->EnableCompressionStatisticsLogging(
382 user_pref_service_.get(), commit_delay); 378 user_pref_service_.get(), commit_delay);
383 } 379 }
384 380
385 } // namespace android_webview 381 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698