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

Side by Side Diff: net/url_request/url_request_context_builder.cc

Issue 1525263003: Revert of Remove ScopedVector from url_request_context_builder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « net/url_request/url_request_context_builder.h ('k') | no next file » | 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 "net/url_request/url_request_context_builder.h" 5 #include "net/url_request/url_request_context_builder.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector>
9 8
10 #include "base/basictypes.h" 9 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
12 #include "base/logging.h" 11 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
15 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
16 #include "base/thread_task_runner_handle.h" 14 #include "base/thread_task_runner_handle.h"
17 #include "base/threading/thread.h" 15 #include "base/threading/thread.h"
18 #include "net/base/cache_type.h" 16 #include "net/base/cache_type.h"
19 #include "net/base/net_errors.h" 17 #include "net/base/net_errors.h"
20 #include "net/base/network_delegate_impl.h" 18 #include "net/base/network_delegate_impl.h"
21 #include "net/base/sdch_manager.h" 19 #include "net/base/sdch_manager.h"
22 #include "net/cert/cert_verifier.h" 20 #include "net/cert/cert_verifier.h"
23 #include "net/cookies/cookie_monster.h" 21 #include "net/cookies/cookie_monster.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 NextProtosWithSpdyAndQuic(spdy_enabled, quic_enabled); 244 NextProtosWithSpdyAndQuic(spdy_enabled, quic_enabled);
247 http_network_session_params_.enable_quic = quic_enabled; 245 http_network_session_params_.enable_quic = quic_enabled;
248 } 246 }
249 247
250 void URLRequestContextBuilder::SetCertVerifier( 248 void URLRequestContextBuilder::SetCertVerifier(
251 scoped_ptr<CertVerifier> cert_verifier) { 249 scoped_ptr<CertVerifier> cert_verifier) {
252 cert_verifier_ = cert_verifier.Pass(); 250 cert_verifier_ = cert_verifier.Pass();
253 } 251 }
254 252
255 void URLRequestContextBuilder::SetInterceptors( 253 void URLRequestContextBuilder::SetInterceptors(
256 std::vector<scoped_ptr<URLRequestInterceptor>> url_request_interceptors) { 254 ScopedVector<URLRequestInterceptor> url_request_interceptors) {
257 url_request_interceptors_ = std::move(url_request_interceptors); 255 url_request_interceptors_ = url_request_interceptors.Pass();
258 } 256 }
259 257
260 void URLRequestContextBuilder::SetCookieAndChannelIdStores( 258 void URLRequestContextBuilder::SetCookieAndChannelIdStores(
261 const scoped_refptr<CookieStore>& cookie_store, 259 const scoped_refptr<CookieStore>& cookie_store,
262 scoped_ptr<ChannelIDService> channel_id_service) { 260 scoped_ptr<ChannelIDService> channel_id_service) {
263 DCHECK(cookie_store); 261 DCHECK(cookie_store);
264 cookie_store_ = cookie_store; 262 cookie_store_ = cookie_store;
265 channel_id_service_ = channel_id_service.Pass(); 263 channel_id_service_ = channel_id_service.Pass();
266 } 264 }
267 265
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 job_factory->SetProtocolHandler( 451 job_factory->SetProtocolHandler(
454 "ftp", make_scoped_ptr( 452 "ftp", make_scoped_ptr(
455 new FtpProtocolHandler(ftp_transaction_factory_.get()))); 453 new FtpProtocolHandler(ftp_transaction_factory_.get())));
456 } 454 }
457 #endif // !defined(DISABLE_FTP_SUPPORT) 455 #endif // !defined(DISABLE_FTP_SUPPORT)
458 456
459 scoped_ptr<net::URLRequestJobFactory> top_job_factory(job_factory); 457 scoped_ptr<net::URLRequestJobFactory> top_job_factory(job_factory);
460 if (!url_request_interceptors_.empty()) { 458 if (!url_request_interceptors_.empty()) {
461 // Set up interceptors in the reverse order. 459 // Set up interceptors in the reverse order.
462 460
463 for (auto i = url_request_interceptors_.rbegin(); 461 for (ScopedVector<net::URLRequestInterceptor>::reverse_iterator i =
462 url_request_interceptors_.rbegin();
464 i != url_request_interceptors_.rend(); ++i) { 463 i != url_request_interceptors_.rend(); ++i) {
465 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( 464 top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
466 std::move(top_job_factory), std::move(*i))); 465 top_job_factory.Pass(), make_scoped_ptr(*i)));
467 } 466 }
468 url_request_interceptors_.clear(); 467 url_request_interceptors_.weak_clear();
469 } 468 }
470 storage->set_job_factory(std::move(top_job_factory)); 469 storage->set_job_factory(top_job_factory.Pass());
471 // TODO(willchan): Support sdch. 470 // TODO(willchan): Support sdch.
472 471
473 return std::move(context); 472 return context.Pass();
474 } 473 }
475 474
476 } // namespace net 475 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_context_builder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698