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

Side by Side Diff: net/socket_stream/socket_stream.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 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 | « net/socket_stream/socket_stream.h ('k') | net/socket_stream/socket_stream_job.h » ('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) 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 // TODO(ukai): code is similar with http_network_transaction.cc. We should 5 // TODO(ukai): code is similar with http_network_transaction.cc. We should
6 // think about ways to share code, if possible. 6 // think about ways to share code, if possible.
7 7
8 #include "net/socket_stream/socket_stream.h" 8 #include "net/socket_stream/socket_stream.h"
9 9
10 #include <set> 10 #include <set>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 void SocketStream::ResponseHeaders::Realloc(size_t new_size) { 49 void SocketStream::ResponseHeaders::Realloc(size_t new_size) {
50 headers_.reset(static_cast<char*>(realloc(headers_.release(), new_size))); 50 headers_.reset(static_cast<char*>(realloc(headers_.release(), new_size)));
51 } 51 }
52 52
53 SocketStream::ResponseHeaders::~ResponseHeaders() { data_ = NULL; } 53 SocketStream::ResponseHeaders::~ResponseHeaders() { data_ = NULL; }
54 54
55 SocketStream::SocketStream(const GURL& url, Delegate* delegate) 55 SocketStream::SocketStream(const GURL& url, Delegate* delegate)
56 : delegate_(delegate), 56 : delegate_(delegate),
57 url_(url), 57 url_(url),
58 max_pending_send_allowed_(kMaxPendingSendAllowed), 58 max_pending_send_allowed_(kMaxPendingSendAllowed),
59 context_(NULL),
59 next_state_(STATE_NONE), 60 next_state_(STATE_NONE),
60 host_resolver_(NULL), 61 host_resolver_(NULL),
61 cert_verifier_(NULL), 62 cert_verifier_(NULL),
62 server_bound_cert_service_(NULL), 63 server_bound_cert_service_(NULL),
63 http_auth_handler_factory_(NULL), 64 http_auth_handler_factory_(NULL),
64 factory_(ClientSocketFactory::GetDefaultFactory()), 65 factory_(ClientSocketFactory::GetDefaultFactory()),
65 proxy_mode_(kDirectConnection), 66 proxy_mode_(kDirectConnection),
66 proxy_url_(url), 67 proxy_url_(url),
67 pac_request_(NULL), 68 pac_request_(NULL),
68 // Unretained() is required; without it, Bind() creates a circular 69 // Unretained() is required; without it, Bind() creates a circular
(...skipping 25 matching lines...) Expand all
94 } 95 }
95 96
96 void SocketStream::SetUserData(const void* key, UserData* data) { 97 void SocketStream::SetUserData(const void* key, UserData* data) {
97 user_data_[key] = linked_ptr<UserData>(data); 98 user_data_[key] = linked_ptr<UserData>(data);
98 } 99 }
99 100
100 bool SocketStream::is_secure() const { 101 bool SocketStream::is_secure() const {
101 return url_.SchemeIs("wss"); 102 return url_.SchemeIs("wss");
102 } 103 }
103 104
104 void SocketStream::set_context(URLRequestContext* context) { 105 void SocketStream::set_context(const URLRequestContext* context) {
105 scoped_refptr<URLRequestContext> prev_context = context_; 106 const URLRequestContext* prev_context = context_;
106 107
107 context_ = context; 108 context_ = context;
108 109
109 if (prev_context != context) { 110 if (prev_context != context) {
110 if (prev_context && pac_request_) { 111 if (prev_context && pac_request_) {
111 prev_context->proxy_service()->CancelPacRequest(pac_request_); 112 prev_context->proxy_service()->CancelPacRequest(pac_request_);
112 pac_request_ = NULL; 113 pac_request_ = NULL;
113 } 114 }
114 115
115 net_log_.EndEvent(NetLog::TYPE_REQUEST_ALIVE, NULL); 116 net_log_.EndEvent(NetLog::TYPE_REQUEST_ALIVE, NULL);
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 1217
1217 SSLConfigService* SocketStream::ssl_config_service() const { 1218 SSLConfigService* SocketStream::ssl_config_service() const {
1218 return context_->ssl_config_service(); 1219 return context_->ssl_config_service();
1219 } 1220 }
1220 1221
1221 ProxyService* SocketStream::proxy_service() const { 1222 ProxyService* SocketStream::proxy_service() const {
1222 return context_->proxy_service(); 1223 return context_->proxy_service();
1223 } 1224 }
1224 1225
1225 } // namespace net 1226 } // namespace net
OLDNEW
« no previous file with comments | « net/socket_stream/socket_stream.h ('k') | net/socket_stream/socket_stream_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698