diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 18:22:42 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 18:22:42 +0000 |
commit | 70503b2e6a0c8adce71d7e18c726e7f3f7c9b0c1 (patch) | |
tree | f63b2c2319615670c0e7c3cf3213a7dfe2da556f /net/websockets/websocket_job.cc | |
parent | b03f53cdce4455ae3ddf80e2faea6ca9bc4b2c62 (diff) | |
download | chromium_src-70503b2e6a0c8adce71d7e18c726e7f3f7c9b0c1.zip chromium_src-70503b2e6a0c8adce71d7e18c726e7f3f7c9b0c1.tar.gz chromium_src-70503b2e6a0c8adce71d7e18c726e7f3f7c9b0c1.tar.bz2 |
Remove async functionality from net::CookiePolicy.
This lets us stop refcounting URLRequestHttpJob.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6749044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/websockets/websocket_job.cc')
-rw-r--r-- | net/websockets/websocket_job.cc | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc index 8379523..7a5e030 100644 --- a/net/websockets/websocket_job.cc +++ b/net/websockets/websocket_job.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -68,10 +68,6 @@ WebSocketJob::WebSocketJob(SocketStream::Delegate* delegate) handshake_response_(new WebSocketHandshakeResponseHandler), handshake_request_sent_(0), response_cookies_save_index_(0), - ALLOW_THIS_IN_INITIALIZER_LIST(can_get_cookies_callback_( - this, &WebSocketJob::OnCanGetCookiesCompleted)), - ALLOW_THIS_IN_INITIALIZER_LIST(can_set_cookie_callback_( - this, &WebSocketJob::OnCanSetCookieCompleted)), send_frame_handler_(new WebSocketFrameHandler), receive_frame_handler_(new WebSocketFrameHandler) { } @@ -281,18 +277,14 @@ bool WebSocketJob::SendHandshakeRequest(const char* data, int len) { } void WebSocketJob::AddCookieHeaderAndSend() { - AddRef(); // Balanced in OnCanGetCookiesCompleted - int policy = OK; if (socket_->context()->cookie_policy()) { GURL url_for_cookies = GetURLForCookies(); policy = socket_->context()->cookie_policy()->CanGetCookies( url_for_cookies, - url_for_cookies, - &can_get_cookies_callback_); - if (policy == ERR_IO_PENDING) - return; // Wait for completion callback + url_for_cookies); } + DCHECK_NE(ERR_IO_PENDING, policy); OnCanGetCookiesCompleted(policy); } @@ -322,7 +314,6 @@ void WebSocketJob::OnCanGetCookiesCompleted(int policy) { socket_->SendData(handshake_request.data(), handshake_request.size()); } - Release(); // Balance AddRef taken in AddCookieHeaderAndSend } void WebSocketJob::OnSentHandshakeRequest( @@ -414,20 +405,16 @@ void WebSocketJob::SaveNextCookie() { return; } - AddRef(); // Balanced in OnCanSetCookieCompleted - int policy = OK; if (socket_->context()->cookie_policy()) { GURL url_for_cookies = GetURLForCookies(); policy = socket_->context()->cookie_policy()->CanSetCookie( url_for_cookies, url_for_cookies, - response_cookies_[response_cookies_save_index_], - &can_set_cookie_callback_); - if (policy == ERR_IO_PENDING) - return; // Wait for completion callback + response_cookies_[response_cookies_save_index_]); } + DCHECK_NE(ERR_IO_PENDING, policy); OnCanSetCookieCompleted(policy); } @@ -447,7 +434,6 @@ void WebSocketJob::OnCanSetCookieCompleted(int policy) { response_cookies_save_index_++; SaveNextCookie(); } - Release(); // Balance AddRef taken in SaveNextCookie } GURL WebSocketJob::GetURLForCookies() const { |