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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 int rv = RestartNetworkRequest(); | 303 int rv = RestartNetworkRequest(); |
304 | 304 |
305 if (rv == ERR_IO_PENDING) | 305 if (rv == ERR_IO_PENDING) |
306 callback_ = callback; | 306 callback_ = callback; |
307 | 307 |
308 return rv; | 308 return rv; |
309 } | 309 } |
310 | 310 |
311 int HttpCache::Transaction::RestartWithCertificate( | 311 int HttpCache::Transaction::RestartWithCertificate( |
312 X509Certificate* client_cert, | 312 scoped_refptr<X509Certificate> client_cert, |
313 SSLPrivateKey* client_private_key, | 313 scoped_refptr<SSLPrivateKey> client_private_key, |
314 const CompletionCallback& callback) { | 314 const CompletionCallback& callback) { |
315 DCHECK(!callback.is_null()); | 315 DCHECK(!callback.is_null()); |
316 | 316 |
317 // Ensure that we only have one asynchronous call at a time. | 317 // Ensure that we only have one asynchronous call at a time. |
318 DCHECK(callback_.is_null()); | 318 DCHECK(callback_.is_null()); |
319 | 319 |
320 if (!cache_.get()) | 320 if (!cache_.get()) |
321 return ERR_UNEXPECTED; | 321 return ERR_UNEXPECTED; |
322 | 322 |
323 int rv = | 323 int rv = RestartNetworkRequestWithCertificate(std::move(client_cert), |
324 RestartNetworkRequestWithCertificate(client_cert, client_private_key); | 324 std::move(client_private_key)); |
325 | 325 |
326 if (rv == ERR_IO_PENDING) | 326 if (rv == ERR_IO_PENDING) |
327 callback_ = callback; | 327 callback_ = callback; |
328 | 328 |
329 return rv; | 329 return rv; |
330 } | 330 } |
331 | 331 |
332 int HttpCache::Transaction::RestartWithAuth( | 332 int HttpCache::Transaction::RestartWithAuth( |
333 const AuthCredentials& credentials, | 333 const AuthCredentials& credentials, |
334 const CompletionCallback& callback) { | 334 const CompletionCallback& callback) { |
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2248 DCHECK_EQ(STATE_NONE, next_state_); | 2248 DCHECK_EQ(STATE_NONE, next_state_); |
2249 | 2249 |
2250 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 2250 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
2251 int rv = network_trans_->RestartIgnoringLastError(io_callback_); | 2251 int rv = network_trans_->RestartIgnoringLastError(io_callback_); |
2252 if (rv != ERR_IO_PENDING) | 2252 if (rv != ERR_IO_PENDING) |
2253 return DoLoop(rv); | 2253 return DoLoop(rv); |
2254 return rv; | 2254 return rv; |
2255 } | 2255 } |
2256 | 2256 |
2257 int HttpCache::Transaction::RestartNetworkRequestWithCertificate( | 2257 int HttpCache::Transaction::RestartNetworkRequestWithCertificate( |
2258 X509Certificate* client_cert, | 2258 scoped_refptr<X509Certificate> client_cert, |
2259 SSLPrivateKey* client_private_key) { | 2259 scoped_refptr<SSLPrivateKey> client_private_key) { |
2260 DCHECK(mode_ & WRITE || mode_ == NONE); | 2260 DCHECK(mode_ & WRITE || mode_ == NONE); |
2261 DCHECK(network_trans_.get()); | 2261 DCHECK(network_trans_.get()); |
2262 DCHECK_EQ(STATE_NONE, next_state_); | 2262 DCHECK_EQ(STATE_NONE, next_state_); |
2263 | 2263 |
2264 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 2264 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
2265 int rv = network_trans_->RestartWithCertificate( | 2265 int rv = network_trans_->RestartWithCertificate( |
2266 client_cert, client_private_key, io_callback_); | 2266 std::move(client_cert), std::move(client_private_key), io_callback_); |
2267 if (rv != ERR_IO_PENDING) | 2267 if (rv != ERR_IO_PENDING) |
2268 return DoLoop(rv); | 2268 return DoLoop(rv); |
2269 return rv; | 2269 return rv; |
2270 } | 2270 } |
2271 | 2271 |
2272 int HttpCache::Transaction::RestartNetworkRequestWithAuth( | 2272 int HttpCache::Transaction::RestartNetworkRequestWithAuth( |
2273 const AuthCredentials& credentials) { | 2273 const AuthCredentials& credentials) { |
2274 DCHECK(mode_ & WRITE || mode_ == NONE); | 2274 DCHECK(mode_ & WRITE || mode_ == NONE); |
2275 DCHECK(network_trans_.get()); | 2275 DCHECK(network_trans_.get()); |
2276 DCHECK_EQ(STATE_NONE, next_state_); | 2276 DCHECK_EQ(STATE_NONE, next_state_); |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3017 } | 3017 } |
3018 | 3018 |
3019 void HttpCache::Transaction::TransitionToState(State state) { | 3019 void HttpCache::Transaction::TransitionToState(State state) { |
3020 // Ensure that the state is only set once per Do* state. | 3020 // Ensure that the state is only set once per Do* state. |
3021 DCHECK(in_do_loop_); | 3021 DCHECK(in_do_loop_); |
3022 DCHECK_EQ(STATE_UNSET, next_state_) << "Next state is " << state; | 3022 DCHECK_EQ(STATE_UNSET, next_state_) << "Next state is " << state; |
3023 next_state_ = state; | 3023 next_state_ = state; |
3024 } | 3024 } |
3025 | 3025 |
3026 } // namespace net | 3026 } // namespace net |
OLD | NEW |