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

Unified Diff: trunk/src/net/socket_stream/socket_stream.cc

Issue 197463003: Revert 256579 "Allow the content browser client to specify a spe..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/net/socket_stream/socket_stream.h ('k') | trunk/src/net/socket_stream/socket_stream_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/net/socket_stream/socket_stream.cc
===================================================================
--- trunk/src/net/socket_stream/socket_stream.cc (revision 256581)
+++ trunk/src/net/socket_stream/socket_stream.cc (working copy)
@@ -87,13 +87,11 @@
SocketStream::ResponseHeaders::~ResponseHeaders() { data_ = NULL; }
-SocketStream::SocketStream(const GURL& url, Delegate* delegate,
- URLRequestContext* context,
- CookieStore* cookie_store)
+SocketStream::SocketStream(const GURL& url, Delegate* delegate)
: delegate_(delegate),
url_(url),
max_pending_send_allowed_(kMaxPendingSendAllowed),
- context_(context),
+ context_(NULL),
next_state_(STATE_NONE),
factory_(ClientSocketFactory::GetDefaultFactory()),
proxy_mode_(kDirectConnection),
@@ -110,24 +108,12 @@
waiting_for_write_completion_(false),
closing_(false),
server_closed_(false),
- metrics_(new SocketStreamMetrics(url)),
- cookie_store_(cookie_store) {
+ metrics_(new SocketStreamMetrics(url)) {
DCHECK(base::MessageLoop::current())
<< "The current base::MessageLoop must exist";
DCHECK(base::MessageLoopForIO::IsCurrent())
<< "The current base::MessageLoop must be TYPE_IO";
DCHECK(delegate_);
-
- if (context_) {
- if (!cookie_store_)
- cookie_store_ = context_->cookie_store();
-
- net_log_ = BoundNetLog::Make(
- context->net_log(),
- NetLog::SOURCE_SOCKET_STREAM);
-
- net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE);
- }
}
SocketStream::UserData* SocketStream::GetUserData(
@@ -146,20 +132,28 @@
return url_.SchemeIs("wss");
}
-void SocketStream::DetachContext() {
- if (!context_)
- return;
+void SocketStream::set_context(URLRequestContext* context) {
+ const URLRequestContext* prev_context = context_;
- if (pac_request_) {
- context_->proxy_service()->CancelPacRequest(pac_request_);
- pac_request_ = NULL;
- }
+ context_ = context;
- net_log_.EndEvent(NetLog::TYPE_REQUEST_ALIVE);
- net_log_ = BoundNetLog();
+ if (prev_context != context) {
+ if (prev_context && pac_request_) {
+ prev_context->proxy_service()->CancelPacRequest(pac_request_);
+ pac_request_ = NULL;
+ }
- context_ = NULL;
- cookie_store_ = NULL;
+ net_log_.EndEvent(NetLog::TYPE_REQUEST_ALIVE);
+ net_log_ = BoundNetLog();
+
+ if (context) {
+ net_log_ = BoundNetLog::Make(
+ context->net_log(),
+ NetLog::SOURCE_SOCKET_STREAM);
+
+ net_log_.BeginEvent(NetLog::TYPE_REQUEST_ALIVE);
+ }
+ }
}
void SocketStream::CheckPrivacyMode() {
@@ -324,7 +318,7 @@
}
SocketStream::~SocketStream() {
- DetachContext();
+ set_context(NULL);
DCHECK(!delegate_);
DCHECK(!pac_request_);
}
@@ -1348,8 +1342,4 @@
return ERR_IO_PENDING;
}
-CookieStore* SocketStream::cookie_store() const {
- return cookie_store_;
-}
-
} // namespace net
« no previous file with comments | « trunk/src/net/socket_stream/socket_stream.h ('k') | trunk/src/net/socket_stream/socket_stream_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698