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

Side by Side Diff: net/http/http_stream_factory_impl_job.cc

Issue 288003006: Tiny refactor of HttpStreamFactoryImpl::Job::Orphan to simplify the code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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/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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 210
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;
mmenke 2014/05/15 18:30:21 We're no longer calling OnOrphanedJobComplete in t
Ryan Hamilton 2014/05/15 18:47:39 ARGH! No, this was *not* intentional. I misread th
220 if (stream_factory_->for_websockets_ && 220 }
221 connection_ && connection_->socket()) 221
222 connection_->socket()->Disconnect(); 222 if (stream_factory_->for_websockets_ &&
223 stream_factory_->OnOrphanedJobComplete(this); 223 connection_ && connection_->socket()) {
224 } else if (stream_factory_->for_websockets_) { 224 connection_->socket()->Disconnect();
225 // We cancel this job because a WebSocketHandshakeStream can't be created 225 // We cancel this job because a WebSocketHandshakeStream can't be created
226 // without a WebSocketHandshakeStreamBase::CreateHelper which is stored in 226 // without a WebSocketHandshakeStreamBase::CreateHelper which is stored in
227 // the Request class and isn't accessible from this job. 227 // the Request class and isn't accessible from this job.
228 if (connection_ && connection_->socket())
229 connection_->socket()->Disconnect();
230 stream_factory_->OnOrphanedJobComplete(this); 228 stream_factory_->OnOrphanedJobComplete(this);
231 } 229 }
232 } 230 }
233 231
234 void HttpStreamFactoryImpl::Job::SetPriority(RequestPriority priority) { 232 void HttpStreamFactoryImpl::Job::SetPriority(RequestPriority priority) {
235 priority_ = priority; 233 priority_ = priority;
236 // TODO(akalin): Propagate this to |connection_| and maybe the 234 // TODO(akalin): Propagate this to |connection_| and maybe the
237 // preconnect state. 235 // preconnect state.
238 } 236 }
239 237
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | 1488 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH |
1491 net::LOAD_IS_DOWNLOAD)) { 1489 net::LOAD_IS_DOWNLOAD)) {
1492 // Avoid pipelining resources that may be streamed for a long time. 1490 // Avoid pipelining resources that may be streamed for a long time.
1493 return false; 1491 return false;
1494 } 1492 }
1495 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( 1493 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining(
1496 *http_pipelining_key_.get()); 1494 *http_pipelining_key_.get());
1497 } 1495 }
1498 1496
1499 } // namespace net 1497 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698