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

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

Issue 896713003: Revert of DataReductionProxyStatisticsPrefs should support WeakPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
128 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); 130 proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_);
129 } 131 }
130 132
131 // static 133 // static
132 void AwBrowserContext::SetLegacyCacheRemovalDelayForTest(int delay_ms) { 134 void AwBrowserContext::SetLegacyCacheRemovalDelayForTest(int delay_ms) {
133 legacy_cache_removal_delay_ms_ = delay_ms; 135 legacy_cache_removal_delay_ms_ = delay_ms;
134 } 136 }
135 137
136 void AwBrowserContext::PreMainMessageLoopRun() { 138 void AwBrowserContext::PreMainMessageLoopRun() {
137 cookie_store_ = CreateCookieStore(this); 139 cookie_store_ = CreateCookieStore(this);
(...skipping 20 matching lines...) Expand all
158 160
159 data_reduction_proxy_settings_.reset( 161 data_reduction_proxy_settings_.reset(
160 new data_reduction_proxy::DataReductionProxySettings( 162 new data_reduction_proxy::DataReductionProxySettings(
161 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>( 163 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>(
162 new data_reduction_proxy::DataReductionProxyParams( 164 new data_reduction_proxy::DataReductionProxyParams(
163 data_reduction_proxy::DataReductionProxyParams::kAllowed)) 165 data_reduction_proxy::DataReductionProxyParams::kAllowed))
164 .Pass())); 166 .Pass()));
165 data_reduction_proxy_io_data_.reset( 167 data_reduction_proxy_io_data_.reset(
166 new data_reduction_proxy::DataReductionProxyIOData( 168 new data_reduction_proxy::DataReductionProxyIOData(
167 data_reduction_proxy::Client::WEBVIEW_ANDROID, 169 data_reduction_proxy::Client::WEBVIEW_ANDROID,
168 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(), 170 scoped_ptr<
171 data_reduction_proxy::DataReductionProxyStatisticsPrefs>(),
169 data_reduction_proxy_settings_.get(), 172 data_reduction_proxy_settings_.get(),
170 url_request_context_getter_->GetNetLog(), 173 url_request_context_getter_->GetNetLog(),
171 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 174 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
172 BrowserThread::GetMessageLoopProxyForThread( 175 BrowserThread::GetMessageLoopProxyForThread(
173 BrowserThread::UI))); 176 BrowserThread::UI)));
174 data_reduction_proxy_settings_->SetProxyConfigurator( 177 data_reduction_proxy_settings_->SetProxyConfigurator(
175 data_reduction_proxy_io_data_->configurator()); 178 data_reduction_proxy_io_data_->configurator());
176 179
177 visitedlink_master_.reset( 180 visitedlink_master_.reset(
178 new visitedlink::VisitedLinkMaster(this, this, false)); 181 new visitedlink::VisitedLinkMaster(this, this, false));
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 base::PrefServiceFactory pref_service_factory; 272 base::PrefServiceFactory pref_service_factory;
270 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore())); 273 pref_service_factory.set_user_prefs(make_scoped_refptr(new AwPrefStore()));
271 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError)); 274 pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError));
272 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass(); 275 user_pref_service_ = pref_service_factory.Create(pref_registry).Pass();
273 276
274 user_prefs::UserPrefs::Set(this, user_pref_service_.get()); 277 user_prefs::UserPrefs::Set(this, user_pref_service_.get());
275 278
276 if (data_reduction_proxy_settings_) { 279 if (data_reduction_proxy_settings_) {
277 data_reduction_proxy_settings_->InitDataReductionProxySettings( 280 data_reduction_proxy_settings_->InitDataReductionProxySettings(
278 user_pref_service_.get(), 281 user_pref_service_.get(),
279 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(),
280 GetRequestContext(), 282 GetRequestContext(),
281 GetAwURLRequestContext()->GetNetLog(), 283 GetAwURLRequestContext()->GetNetLog(),
282 data_reduction_proxy_io_data_->event_store()); 284 data_reduction_proxy_io_data_->event_store());
283 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); 285 data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true);
284 286
285 SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); 287 SetDataReductionProxyEnabled(data_reduction_proxy_enabled_);
286 } 288 }
287 } 289 }
288 290
289 scoped_ptr<content::ZoomLevelDelegate> 291 scoped_ptr<content::ZoomLevelDelegate>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 void AwBrowserContext::RebuildTable( 368 void AwBrowserContext::RebuildTable(
367 const scoped_refptr<URLEnumerator>& enumerator) { 369 const scoped_refptr<URLEnumerator>& enumerator) {
368 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client 370 // Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client
369 // can change in the lifetime of this WebView and may not yet be set here. 371 // can change in the lifetime of this WebView and may not yet be set here.
370 // Therefore this initialization path is not used. 372 // Therefore this initialization path is not used.
371 enumerator->OnComplete(true); 373 enumerator->OnComplete(true);
372 } 374 }
373 375
374 void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() { 376 void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() {
375 DCHECK(user_pref_service_.get()); 377 DCHECK(user_pref_service_.get());
376 DCHECK(GetDataReductionProxySettings()); 378 DCHECK(GetDataReductionProxyIOData());
377 if (GetDataReductionProxySettings()->statistics_prefs()) 379 if (GetDataReductionProxyIOData()->statistics_prefs())
378 return; 380 return;
379 // We don't care about commit_delay for now. It is just a dummy value. 381 // We don't care about commit_delay for now. It is just a dummy value.
380 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); 382 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60);
381 GetDataReductionProxySettings()->EnableCompressionStatisticsLogging( 383 GetDataReductionProxyIOData()->EnableCompressionStatisticsLogging(
382 user_pref_service_.get(), 384 user_pref_service_.get(), commit_delay);
383 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
384 commit_delay);
385 GetDataReductionProxyIOData()->SetDataReductionProxyStatisticsPrefs(
386 GetDataReductionProxySettings()->statistics_prefs());
387 } 385 }
388 386
389 } // namespace android_webview 387 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698