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

Side by Side Diff: components/cronet/android/cronet_url_request_context_adapter.cc

Issue 2977693003: Use TaskRunner passed in to URLRequestContextBuilder only for the cache (Closed)
Patch Set: Actually, don't need to set the thread everywhere Created 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/cronet/android/cronet_url_request_context_adapter.h" 5 #include "components/cronet/android/cronet_url_request_context_adapter.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 if (!config->storage_path.empty()) { 652 if (!config->storage_path.empty()) {
653 base::FilePath storage_path(config->storage_path); 653 base::FilePath storage_path(config->storage_path);
654 // Make sure storage directory has correct version. 654 // Make sure storage directory has correct version.
655 InitializeStorageDirectory(storage_path); 655 InitializeStorageDirectory(storage_path);
656 base::FilePath filepath = 656 base::FilePath filepath =
657 storage_path.Append(FILE_PATH_LITERAL(kPrefsDirectoryName)) 657 storage_path.Append(FILE_PATH_LITERAL(kPrefsDirectoryName))
658 .Append(FILE_PATH_LITERAL(kPrefsFileName)); 658 .Append(FILE_PATH_LITERAL(kPrefsFileName));
659 json_pref_store_ = 659 json_pref_store_ =
660 new JsonPrefStore(filepath, GetFileThread()->task_runner(), 660 new JsonPrefStore(filepath, GetFileThread()->task_runner(),
661 std::unique_ptr<PrefFilter>()); 661 std::unique_ptr<PrefFilter>());
662 context_builder.SetFileTaskRunner(GetFileThread()->task_runner()); 662 context_builder.SetCacheThreadTaskRunner(GetFileThread()->task_runner());
663 663
664 // Register prefs and set up the PrefService. 664 // Register prefs and set up the PrefService.
665 PrefServiceFactory factory; 665 PrefServiceFactory factory;
666 factory.set_user_prefs(json_pref_store_); 666 factory.set_user_prefs(json_pref_store_);
667 scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple()); 667 scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple());
668 registry->RegisterDictionaryPref(kHttpServerPropertiesPref, 668 registry->RegisterDictionaryPref(kHttpServerPropertiesPref,
669 base::MakeUnique<base::DictionaryValue>()); 669 base::MakeUnique<base::DictionaryValue>());
670 if (config->enable_network_quality_estimator) { 670 if (config->enable_network_quality_estimator) {
671 // Use lossy prefs to limit the overhead of reading/writing the prefs. 671 // Use lossy prefs to limit the overhead of reading/writing the prefs.
672 registry->RegisterDictionaryPref(kNetworkQualitiesPref, 672 registry->RegisterDictionaryPref(kNetworkQualitiesPref,
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 JNIEnv* env, 1211 JNIEnv* env,
1212 const JavaParamRef<jclass>& jcaller) { 1212 const JavaParamRef<jclass>& jcaller) {
1213 DCHECK(base::StatisticsRecorder::IsActive()); 1213 DCHECK(base::StatisticsRecorder::IsActive());
1214 std::vector<uint8_t> data; 1214 std::vector<uint8_t> data;
1215 if (!HistogramManager::GetInstance()->GetDeltas(&data)) 1215 if (!HistogramManager::GetInstance()->GetDeltas(&data))
1216 return ScopedJavaLocalRef<jbyteArray>(); 1216 return ScopedJavaLocalRef<jbyteArray>();
1217 return base::android::ToJavaByteArray(env, &data[0], data.size()); 1217 return base::android::ToJavaByteArray(env, &data[0], data.size());
1218 } 1218 }
1219 1219
1220 } // namespace cronet 1220 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698