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

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

Issue 2257793002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 632
633 if (config->load_disable_cache) 633 if (config->load_disable_cache)
634 default_load_flags_ |= net::LOAD_DISABLE_CACHE; 634 default_load_flags_ |= net::LOAD_DISABLE_CACHE;
635 635
636 if (config->enable_sdch) { 636 if (config->enable_sdch) {
637 DCHECK(context_->sdch_manager()); 637 DCHECK(context_->sdch_manager());
638 sdch_owner_.reset( 638 sdch_owner_.reset(
639 new net::SdchOwner(context_->sdch_manager(), context_.get())); 639 new net::SdchOwner(context_->sdch_manager(), context_.get()));
640 if (json_pref_store_) { 640 if (json_pref_store_) {
641 sdch_owner_->EnablePersistentStorage( 641 sdch_owner_->EnablePersistentStorage(
642 base::WrapUnique(new SdchOwnerPrefStorage(json_pref_store_.get()))); 642 base::MakeUnique<SdchOwnerPrefStorage>(json_pref_store_.get()));
643 } 643 }
644 } 644 }
645 645
646 if (config->enable_quic) { 646 if (config->enable_quic) {
647 for (auto hint = config->quic_hints.begin(); 647 for (auto hint = config->quic_hints.begin();
648 hint != config->quic_hints.end(); ++hint) { 648 hint != config->quic_hints.end(); ++hint) {
649 const URLRequestContextConfig::QuicHint& quic_hint = **hint; 649 const URLRequestContextConfig::QuicHint& quic_hint = **hint;
650 if (quic_hint.host.empty()) { 650 if (quic_hint.host.empty()) {
651 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; 651 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host;
652 continue; 652 continue;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 // Add a QUIC hint to a URLRequestContextConfig. 989 // Add a QUIC hint to a URLRequestContextConfig.
990 static void AddQuicHint(JNIEnv* env, 990 static void AddQuicHint(JNIEnv* env,
991 const JavaParamRef<jclass>& jcaller, 991 const JavaParamRef<jclass>& jcaller,
992 jlong jurl_request_context_config, 992 jlong jurl_request_context_config,
993 const JavaParamRef<jstring>& jhost, 993 const JavaParamRef<jstring>& jhost,
994 jint jport, 994 jint jport,
995 jint jalternate_port) { 995 jint jalternate_port) {
996 URLRequestContextConfig* config = 996 URLRequestContextConfig* config =
997 reinterpret_cast<URLRequestContextConfig*>(jurl_request_context_config); 997 reinterpret_cast<URLRequestContextConfig*>(jurl_request_context_config);
998 config->quic_hints.push_back( 998 config->quic_hints.push_back(
999 base::WrapUnique(new URLRequestContextConfig::QuicHint( 999 base::MakeUnique<URLRequestContextConfig::QuicHint>(
1000 base::android::ConvertJavaStringToUTF8(env, jhost), jport, 1000 base::android::ConvertJavaStringToUTF8(env, jhost), jport,
1001 jalternate_port))); 1001 jalternate_port));
1002 } 1002 }
1003 1003
1004 // Add a public key pin to URLRequestContextConfig. 1004 // Add a public key pin to URLRequestContextConfig.
1005 // |jhost| is the host to apply the pin to. 1005 // |jhost| is the host to apply the pin to.
1006 // |jhashes| is an array of jbyte[32] representing SHA256 key hashes. 1006 // |jhashes| is an array of jbyte[32] representing SHA256 key hashes.
1007 // |jinclude_subdomains| indicates if pin should be applied to subdomains. 1007 // |jinclude_subdomains| indicates if pin should be applied to subdomains.
1008 // |jexpiration_time| is the time that the pin expires, in milliseconds since 1008 // |jexpiration_time| is the time that the pin expires, in milliseconds since
1009 // Jan. 1, 1970, midnight GMT. 1009 // Jan. 1, 1970, midnight GMT.
1010 static void AddPkp(JNIEnv* env, 1010 static void AddPkp(JNIEnv* env,
1011 const JavaParamRef<jclass>& jcaller, 1011 const JavaParamRef<jclass>& jcaller,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 JNIEnv* env, 1069 JNIEnv* env,
1070 const JavaParamRef<jclass>& jcaller) { 1070 const JavaParamRef<jclass>& jcaller) {
1071 base::StatisticsRecorder::Initialize(); 1071 base::StatisticsRecorder::Initialize();
1072 std::vector<uint8_t> data; 1072 std::vector<uint8_t> data;
1073 if (!HistogramManager::GetInstance()->GetDeltas(&data)) 1073 if (!HistogramManager::GetInstance()->GetDeltas(&data))
1074 return ScopedJavaLocalRef<jbyteArray>(); 1074 return ScopedJavaLocalRef<jbyteArray>();
1075 return base::android::ToJavaByteArray(env, &data[0], data.size()); 1075 return base::android::ToJavaByteArray(env, &data[0], data.size());
1076 } 1076 }
1077 1077
1078 } // namespace cronet 1078 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/android/cronet_data_reduction_proxy.cc ('k') | components/cronet/android/url_request_context_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698