OLD | NEW |
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/http/http_cache_transaction.h" | 5 #include "net/http/http_cache_transaction.h" |
6 | 6 |
7 #include "build/build_config.h" // For OS_POSIX | 7 #include "build/build_config.h" // For OS_POSIX |
8 | 8 |
9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 int rv = RestartNetworkRequest(); | 299 int rv = RestartNetworkRequest(); |
300 | 300 |
301 if (rv == ERR_IO_PENDING) | 301 if (rv == ERR_IO_PENDING) |
302 callback_ = callback; | 302 callback_ = callback; |
303 | 303 |
304 return rv; | 304 return rv; |
305 } | 305 } |
306 | 306 |
307 int HttpCache::Transaction::RestartWithCertificate( | 307 int HttpCache::Transaction::RestartWithCertificate( |
308 X509Certificate* client_cert, | 308 scoped_refptr<X509Certificate> client_cert, |
309 SSLPrivateKey* client_private_key, | 309 scoped_refptr<SSLPrivateKey> client_private_key, |
310 const CompletionCallback& callback) { | 310 const CompletionCallback& callback) { |
311 DCHECK(!callback.is_null()); | 311 DCHECK(!callback.is_null()); |
312 | 312 |
313 // Ensure that we only have one asynchronous call at a time. | 313 // Ensure that we only have one asynchronous call at a time. |
314 DCHECK(callback_.is_null()); | 314 DCHECK(callback_.is_null()); |
315 | 315 |
316 if (!cache_.get()) | 316 if (!cache_.get()) |
317 return ERR_UNEXPECTED; | 317 return ERR_UNEXPECTED; |
318 | 318 |
319 int rv = | 319 int rv = RestartNetworkRequestWithCertificate(std::move(client_cert), |
320 RestartNetworkRequestWithCertificate(client_cert, client_private_key); | 320 std::move(client_private_key)); |
321 | 321 |
322 if (rv == ERR_IO_PENDING) | 322 if (rv == ERR_IO_PENDING) |
323 callback_ = callback; | 323 callback_ = callback; |
324 | 324 |
325 return rv; | 325 return rv; |
326 } | 326 } |
327 | 327 |
328 int HttpCache::Transaction::RestartWithAuth( | 328 int HttpCache::Transaction::RestartWithAuth( |
329 const AuthCredentials& credentials, | 329 const AuthCredentials& credentials, |
330 const CompletionCallback& callback) { | 330 const CompletionCallback& callback) { |
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2353 DCHECK_EQ(STATE_NONE, next_state_); | 2353 DCHECK_EQ(STATE_NONE, next_state_); |
2354 | 2354 |
2355 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 2355 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
2356 int rv = network_trans_->RestartIgnoringLastError(io_callback_); | 2356 int rv = network_trans_->RestartIgnoringLastError(io_callback_); |
2357 if (rv != ERR_IO_PENDING) | 2357 if (rv != ERR_IO_PENDING) |
2358 return DoLoop(rv); | 2358 return DoLoop(rv); |
2359 return rv; | 2359 return rv; |
2360 } | 2360 } |
2361 | 2361 |
2362 int HttpCache::Transaction::RestartNetworkRequestWithCertificate( | 2362 int HttpCache::Transaction::RestartNetworkRequestWithCertificate( |
2363 X509Certificate* client_cert, | 2363 scoped_refptr<X509Certificate> client_cert, |
2364 SSLPrivateKey* client_private_key) { | 2364 scoped_refptr<SSLPrivateKey> client_private_key) { |
2365 DCHECK(mode_ & WRITE || mode_ == NONE); | 2365 DCHECK(mode_ & WRITE || mode_ == NONE); |
2366 DCHECK(network_trans_.get()); | 2366 DCHECK(network_trans_.get()); |
2367 DCHECK_EQ(STATE_NONE, next_state_); | 2367 DCHECK_EQ(STATE_NONE, next_state_); |
2368 | 2368 |
2369 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 2369 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
2370 int rv = network_trans_->RestartWithCertificate( | 2370 int rv = network_trans_->RestartWithCertificate( |
2371 client_cert, client_private_key, io_callback_); | 2371 std::move(client_cert), std::move(client_private_key), io_callback_); |
2372 if (rv != ERR_IO_PENDING) | 2372 if (rv != ERR_IO_PENDING) |
2373 return DoLoop(rv); | 2373 return DoLoop(rv); |
2374 return rv; | 2374 return rv; |
2375 } | 2375 } |
2376 | 2376 |
2377 int HttpCache::Transaction::RestartNetworkRequestWithAuth( | 2377 int HttpCache::Transaction::RestartNetworkRequestWithAuth( |
2378 const AuthCredentials& credentials) { | 2378 const AuthCredentials& credentials) { |
2379 DCHECK(mode_ & WRITE || mode_ == NONE); | 2379 DCHECK(mode_ & WRITE || mode_ == NONE); |
2380 DCHECK(network_trans_.get()); | 2380 DCHECK(network_trans_.get()); |
2381 DCHECK_EQ(STATE_NONE, next_state_); | 2381 DCHECK_EQ(STATE_NONE, next_state_); |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3130 } | 3130 } |
3131 | 3131 |
3132 void HttpCache::Transaction::TransitionToState(State state) { | 3132 void HttpCache::Transaction::TransitionToState(State state) { |
3133 // Ensure that the state is only set once per Do* state. | 3133 // Ensure that the state is only set once per Do* state. |
3134 DCHECK(in_do_loop_); | 3134 DCHECK(in_do_loop_); |
3135 DCHECK_EQ(STATE_UNSET, next_state_) << "Next state is " << state; | 3135 DCHECK_EQ(STATE_UNSET, next_state_) << "Next state is " << state; |
3136 next_state_ = state; | 3136 next_state_ = state; |
3137 } | 3137 } |
3138 | 3138 |
3139 } // namespace net | 3139 } // namespace net |
OLD | NEW |