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

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

Issue 1221663009: Expose API to store and load data usage stats from UI task runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Breakdown
Patch Set: Sync to head Created 5 years, 5 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_permission_manager.h" 8 #include "android_webview/browser/aw_permission_manager.h"
9 #include "android_webview/browser/aw_pref_store.h" 9 #include "android_webview/browser/aw_pref_store.h"
10 #include "android_webview/browser/aw_quota_manager_bridge.h" 10 #include "android_webview/browser/aw_quota_manager_bridge.h"
11 #include "android_webview/browser/aw_resource_context.h" 11 #include "android_webview/browser/aw_resource_context.h"
12 #include "android_webview/browser/jni_dependency_factory.h" 12 #include "android_webview/browser/jni_dependency_factory.h"
13 #include "android_webview/browser/net/aw_url_request_context_getter.h" 13 #include "android_webview/browser/net/aw_url_request_context_getter.h"
14 #include "android_webview/browser/net/init_native_callback.h" 14 #include "android_webview/browser/net/init_native_callback.h"
15 #include "android_webview/common/aw_content_client.h" 15 #include "android_webview/common/aw_content_client.h"
16 #include "base/base_paths_android.h" 16 #include "base/base_paths_android.h"
17 #include "base/bind.h" 17 #include "base/bind.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/prefs/pref_registry_simple.h" 19 #include "base/prefs/pref_registry_simple.h"
20 #include "base/prefs/pref_service.h" 20 #include "base/prefs/pref_service.h"
21 #include "base/prefs/pref_service_factory.h" 21 #include "base/prefs/pref_service_factory.h"
22 #include "components/autofill/core/common/autofill_pref_names.h" 22 #include "components/autofill/core/common/autofill_pref_names.h"
23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h" 23 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp ression_stats.h"
24 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h" 24 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d ata.h"
25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" 25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h"
26 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h" 26 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv ice.h"
27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h" 27 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings.h"
28 #include "components/data_reduction_proxy/core/browser/data_store.h"
28 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" 29 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
29 #include "components/user_prefs/user_prefs.h" 30 #include "components/user_prefs/user_prefs.h"
30 #include "components/visitedlink/browser/visitedlink_master.h" 31 #include "components/visitedlink/browser/visitedlink_master.h"
31 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/ssl_host_state_delegate.h" 33 #include "content/public/browser/ssl_host_state_delegate.h"
33 #include "content/public/browser/storage_partition.h" 34 #include "content/public/browser/storage_partition.h"
34 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
35 #include "net/cookies/cookie_store.h" 36 #include "net/cookies/cookie_store.h"
36 #include "net/proxy/proxy_config_service_android.h" 37 #include "net/proxy/proxy_config_service_android.h"
37 #include "net/proxy/proxy_service.h" 38 #include "net/proxy/proxy_service.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 data_reduction_proxy::Client::WEBVIEW_ANDROID, 161 data_reduction_proxy::Client::WEBVIEW_ANDROID,
161 data_reduction_proxy::DataReductionProxyParams::kAllowed, 162 data_reduction_proxy::DataReductionProxyParams::kAllowed,
162 url_request_context_getter_->GetNetLog(), 163 url_request_context_getter_->GetNetLog(),
163 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 164 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
164 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 165 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
165 false /* enable */, 166 false /* enable */,
166 false /* enable_quic */, 167 false /* enable_quic */,
167 GetUserAgent())); 168 GetUserAgent()));
168 data_reduction_proxy_settings_.reset( 169 data_reduction_proxy_settings_.reset(
169 new data_reduction_proxy::DataReductionProxySettings()); 170 new data_reduction_proxy::DataReductionProxySettings());
171 scoped_ptr<data_reduction_proxy::DataStore> store(
172 new data_reduction_proxy::DataStore());
173 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
174 scoped_refptr<base::SequencedTaskRunner> db_task_runner =
175 pool->GetSequencedTaskRunnerWithShutdownBehavior(
176 pool->GetSequenceToken(),
177 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
170 data_reduction_proxy_service_.reset( 178 data_reduction_proxy_service_.reset(
171 new data_reduction_proxy::DataReductionProxyService( 179 new data_reduction_proxy::DataReductionProxyService(
172 scoped_ptr< 180 scoped_ptr<
173 data_reduction_proxy::DataReductionProxyCompressionStats>(), 181 data_reduction_proxy::DataReductionProxyCompressionStats>(),
174 data_reduction_proxy_settings_.get(), nullptr, 182 data_reduction_proxy_settings_.get(), nullptr,
175 GetAwURLRequestContext(), 183 GetAwURLRequestContext(), store.Pass(),
176 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); 184 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
185 db_task_runner));
177 data_reduction_proxy_io_data_->SetDataReductionProxyService( 186 data_reduction_proxy_io_data_->SetDataReductionProxyService(
178 data_reduction_proxy_service_->GetWeakPtr()); 187 data_reduction_proxy_service_->GetWeakPtr());
179 188
180 visitedlink_master_.reset( 189 visitedlink_master_.reset(
181 new visitedlink::VisitedLinkMaster(this, this, false)); 190 new visitedlink::VisitedLinkMaster(this, this, false));
182 visitedlink_master_->Init(); 191 visitedlink_master_->Init();
183 192
184 form_database_service_.reset( 193 form_database_service_.reset(
185 new AwFormDatabaseService(context_storage_path_)); 194 new AwFormDatabaseService(context_storage_path_));
186 } 195 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 DCHECK(user_pref_service_.get()); 385 DCHECK(user_pref_service_.get());
377 DCHECK(GetDataReductionProxySettings()); 386 DCHECK(GetDataReductionProxySettings());
378 data_reduction_proxy::DataReductionProxyService* 387 data_reduction_proxy::DataReductionProxyService*
379 data_reduction_proxy_service = 388 data_reduction_proxy_service =
380 GetDataReductionProxySettings()->data_reduction_proxy_service(); 389 GetDataReductionProxySettings()->data_reduction_proxy_service();
381 DCHECK(data_reduction_proxy_service); 390 DCHECK(data_reduction_proxy_service);
382 if (data_reduction_proxy_service->compression_stats()) 391 if (data_reduction_proxy_service->compression_stats())
383 return; 392 return;
384 // We don't care about commit_delay for now. It is just a dummy value. 393 // We don't care about commit_delay for now. It is just a dummy value.
385 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); 394 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60);
395 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
396 scoped_refptr<base::SequencedTaskRunner> db_task_runner =
397 pool->GetSequencedTaskRunnerWithShutdownBehavior(
398 pool->GetSequenceToken(),
399 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
jeremyim 2015/07/14 23:06:03 This shouldn't be necessary, as drp_service_ alrea
Not at Google. Contact bengr 2015/07/15 00:08:17 Done.
386 data_reduction_proxy_service->EnableCompressionStatisticsLogging( 400 data_reduction_proxy_service->EnableCompressionStatisticsLogging(
387 user_pref_service_.get(), 401 user_pref_service_.get(),
388 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 402 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
389 commit_delay); 403 db_task_runner, commit_delay);
390 } 404 }
391 405
392 } // namespace android_webview 406 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698