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

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

Issue 222009: Replace some net::ERR_FAILED generic error codes with more specific codes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address wtc's comments Created 11 years, 3 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 | « net/http/http_network_layer.h ('k') | net/http/http_network_layer_unittest.cc » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_network_layer.h" 5 #include "net/http/http_network_layer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/http/http_network_session.h" 8 #include "net/http/http_network_session.h"
9 #include "net/http/http_network_transaction.h" 9 #include "net/http/http_network_transaction.h"
10 #include "net/socket/client_socket_factory.h" 10 #include "net/socket/client_socket_factory.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 : socket_factory_(ClientSocketFactory::GetDefaultFactory()), 52 : socket_factory_(ClientSocketFactory::GetDefaultFactory()),
53 ssl_config_service_(NULL), 53 ssl_config_service_(NULL),
54 session_(session), 54 session_(session),
55 suspended_(false) { 55 suspended_(false) {
56 DCHECK(session_.get()); 56 DCHECK(session_.get());
57 } 57 }
58 58
59 HttpNetworkLayer::~HttpNetworkLayer() { 59 HttpNetworkLayer::~HttpNetworkLayer() {
60 } 60 }
61 61
62 HttpTransaction* HttpNetworkLayer::CreateTransaction() { 62 int HttpNetworkLayer::CreateTransaction(scoped_ptr<HttpTransaction>* trans) {
63 if (suspended_) 63 if (suspended_)
64 return NULL; 64 return ERR_NETWORK_IO_SUSPENDED;
65 65
66 return new HttpNetworkTransaction(GetSession(), socket_factory_); 66 trans->reset(new HttpNetworkTransaction(GetSession(), socket_factory_));
67 return OK;
67 } 68 }
68 69
69 HttpCache* HttpNetworkLayer::GetCache() { 70 HttpCache* HttpNetworkLayer::GetCache() {
70 return NULL; 71 return NULL;
71 } 72 }
72 73
73 void HttpNetworkLayer::Suspend(bool suspend) { 74 void HttpNetworkLayer::Suspend(bool suspend) {
74 suspended_ = suspend; 75 suspended_ = suspend;
75 76
76 if (suspend && session_) 77 if (suspend && session_)
77 session_->tcp_socket_pool()->CloseIdleSockets(); 78 session_->tcp_socket_pool()->CloseIdleSockets();
78 } 79 }
79 80
80 HttpNetworkSession* HttpNetworkLayer::GetSession() { 81 HttpNetworkSession* HttpNetworkLayer::GetSession() {
81 if (!session_) { 82 if (!session_) {
82 DCHECK(proxy_service_); 83 DCHECK(proxy_service_);
83 session_ = new HttpNetworkSession(host_resolver_, proxy_service_, 84 session_ = new HttpNetworkSession(host_resolver_, proxy_service_,
84 socket_factory_, ssl_config_service_); 85 socket_factory_, ssl_config_service_);
85 // These were just temps for lazy-initializing HttpNetworkSession. 86 // These were just temps for lazy-initializing HttpNetworkSession.
86 host_resolver_ = NULL; 87 host_resolver_ = NULL;
87 proxy_service_ = NULL; 88 proxy_service_ = NULL;
88 } 89 }
89 return session_; 90 return session_;
90 } 91 }
91 92
92 } // namespace net 93 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_layer.h ('k') | net/http/http_network_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698