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_stream_factory_impl_job.h" | 5 #include "net/http/http_stream_factory_impl_job.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 void HttpStreamFactoryImpl::Job::Orphan(const Request* request) { | 211 void HttpStreamFactoryImpl::Job::Orphan(const Request* request) { |
212 DCHECK_EQ(request_, request); | 212 DCHECK_EQ(request_, request); |
213 request_ = NULL; | 213 request_ = NULL; |
214 if (blocking_job_) { | 214 if (blocking_job_) { |
215 // We've been orphaned, but there's a job we're blocked on. Don't bother | 215 // We've been orphaned, but there's a job we're blocked on. Don't bother |
216 // racing, just cancel ourself. | 216 // racing, just cancel ourself. |
217 DCHECK(blocking_job_->waiting_job_); | 217 DCHECK(blocking_job_->waiting_job_); |
218 blocking_job_->waiting_job_ = NULL; | 218 blocking_job_->waiting_job_ = NULL; |
219 blocking_job_ = NULL; | 219 blocking_job_ = NULL; |
220 if (stream_factory_->for_websockets_ && | 220 if (stream_factory_->for_websockets_ && |
221 connection_ && connection_->socket()) | 221 connection_ && connection_->socket()) { |
222 connection_->socket()->Disconnect(); | 222 connection_->socket()->Disconnect(); |
| 223 } |
223 stream_factory_->OnOrphanedJobComplete(this); | 224 stream_factory_->OnOrphanedJobComplete(this); |
224 } else if (stream_factory_->for_websockets_) { | 225 } else if (stream_factory_->for_websockets_) { |
225 // We cancel this job because a WebSocketHandshakeStream can't be created | 226 // We cancel this job because a WebSocketHandshakeStream can't be created |
226 // without a WebSocketHandshakeStreamBase::CreateHelper which is stored in | 227 // without a WebSocketHandshakeStreamBase::CreateHelper which is stored in |
227 // the Request class and isn't accessible from this job. | 228 // the Request class and isn't accessible from this job. |
228 if (connection_ && connection_->socket()) | 229 if (connection_ && connection_->socket()) { |
229 connection_->socket()->Disconnect(); | 230 connection_->socket()->Disconnect(); |
| 231 } |
230 stream_factory_->OnOrphanedJobComplete(this); | 232 stream_factory_->OnOrphanedJobComplete(this); |
231 } | 233 } |
232 } | 234 } |
233 | 235 |
234 void HttpStreamFactoryImpl::Job::SetPriority(RequestPriority priority) { | 236 void HttpStreamFactoryImpl::Job::SetPriority(RequestPriority priority) { |
235 priority_ = priority; | 237 priority_ = priority; |
236 // TODO(akalin): Propagate this to |connection_| and maybe the | 238 // TODO(akalin): Propagate this to |connection_| and maybe the |
237 // preconnect state. | 239 // preconnect state. |
238 } | 240 } |
239 | 241 |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | | 1492 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | |
1491 net::LOAD_IS_DOWNLOAD)) { | 1493 net::LOAD_IS_DOWNLOAD)) { |
1492 // Avoid pipelining resources that may be streamed for a long time. | 1494 // Avoid pipelining resources that may be streamed for a long time. |
1493 return false; | 1495 return false; |
1494 } | 1496 } |
1495 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( | 1497 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( |
1496 *http_pipelining_key_.get()); | 1498 *http_pipelining_key_.get()); |
1497 } | 1499 } |
1498 | 1500 |
1499 } // namespace net | 1501 } // namespace net |
OLD | NEW |