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

Side by Side Diff: components/cronet/ios/cronet_environment.cc

Issue 1888963004: Add HttpProtocolHandler and convert everything to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-supports-scheme
Patch Set: more addressing comments Created 4 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ios/cronet_environment.h" 5 #include "components/cronet/ios/cronet_environment.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 // TODO(mmenke): These really shouldn't be leaked. 346 // TODO(mmenke): These really shouldn't be leaked.
347 // See https://crbug.com/523858. 347 // See https://crbug.com/523858.
348 net::HttpNetworkSession* http_network_session = 348 net::HttpNetworkSession* http_network_session =
349 new net::HttpNetworkSession(params); 349 new net::HttpNetworkSession(params);
350 net::HttpCache* main_cache = 350 net::HttpCache* main_cache =
351 new net::HttpCache(http_network_session, std::move(main_backend), 351 new net::HttpCache(http_network_session, std::move(main_backend),
352 true /* set_up_quic_server_info */); 352 true /* set_up_quic_server_info */);
353 main_context_->set_http_transaction_factory(main_cache); 353 main_context_->set_http_transaction_factory(main_cache);
354 354
355 net::URLRequestJobFactoryImpl* job_factory = 355 // TODO(mgersh): Fix this leak too. See https://crbug.com/523858.
356 new net::URLRequestJobFactoryImpl; 356 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory =
357 main_context_->set_job_factory(job_factory); 357 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers();
358 main_context_->set_job_factory(job_factory.release());
358 main_context_->set_net_log(net_log_.get()); 359 main_context_->set_net_log(net_log_.get());
359 } 360 }
360 361
361 std::string CronetEnvironment::user_agent() { 362 std::string CronetEnvironment::user_agent() {
362 const net::HttpUserAgentSettings* user_agent_settings = 363 const net::HttpUserAgentSettings* user_agent_settings =
363 main_context_->http_user_agent_settings(); 364 main_context_->http_user_agent_settings();
364 if (!user_agent_settings) { 365 if (!user_agent_settings) {
365 return nullptr; 366 return nullptr;
366 } 367 }
367 368
368 return user_agent_settings->GetUserAgent(); 369 return user_agent_settings->GetUserAgent();
369 } 370 }
370 371
371 } // namespace cronet 372 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698