Commit 39030edb authored by dcheng's avatar dcheng Committed by Commit bot

Net-related fixups for scoped_refptr conversion operator cleanup.

BUG=110610
TBR=pkasting@chromium.org

Review URL: https://codereview.chromium.org/511163002

Cr-Commit-Position: refs/heads/master@{#292600}
parent ad3c6870
......@@ -20,7 +20,7 @@ typedef std::pair<net::SSLCertRequestInfo*, net::X509Certificate*> CertDetails;
SSLClientAuthObserver::SSLClientAuthObserver(
const net::HttpNetworkSession* network_session,
net::SSLCertRequestInfo* cert_request_info,
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info,
const base::Callback<void(net::X509Certificate*)>& callback)
: network_session_(network_session),
cert_request_info_(cert_request_info),
......
......@@ -20,7 +20,7 @@ class SSLClientAuthObserver : public content::NotificationObserver {
public:
SSLClientAuthObserver(
const net::HttpNetworkSession* network_session,
net::SSLCertRequestInfo* cert_request_info,
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info,
const base::Callback<void(net::X509Certificate*)>& callback);
virtual ~SSLClientAuthObserver();
......
......@@ -5,15 +5,17 @@
#include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h"
#include "net/http/http_transaction_factory.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
SSLClientAuthRequestorMock::SSLClientAuthRequestorMock(
net::URLRequest* request,
net::SSLCertRequestInfo* cert_request_info)
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info)
: cert_request_info_(cert_request_info),
http_network_session_(
request->context()->http_transaction_factory()->GetSession()) {
http_network_session_(request->context()
->http_transaction_factory()
->GetSession()) {
}
SSLClientAuthRequestorMock::~SSLClientAuthRequestorMock() {}
......@@ -20,11 +20,11 @@ class SSLClientAuthRequestorMock
public:
SSLClientAuthRequestorMock(
net::URLRequest* request,
net::SSLCertRequestInfo* cert_request_info);
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info);
MOCK_METHOD1(CertificateSelected, void(net::X509Certificate* cert));
net::SSLCertRequestInfo* cert_request_info_;
scoped_refptr<net::SSLCertRequestInfo> cert_request_info_;
net::HttpNetworkSession* http_network_session_;
protected:
......
......@@ -83,10 +83,10 @@ void CertificateSelectorTableModel::SetObserver(
SSLClientCertificateSelector::SSLClientCertificateSelector(
content::WebContents* web_contents,
const net::HttpNetworkSession* network_session,
net::SSLCertRequestInfo* cert_request_info,
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info,
const chrome::SelectCertificateCallback& callback)
: SSLClientAuthObserver(network_session, cert_request_info, callback),
model_(new CertificateSelectorTableModel(cert_request_info)),
model_(new CertificateSelectorTableModel(cert_request_info.get())),
web_contents_(web_contents),
table_(NULL),
view_cert_button_(NULL) {
......
......@@ -41,7 +41,7 @@ class SSLClientCertificateSelector : public SSLClientAuthObserver,
SSLClientCertificateSelector(
content::WebContents* web_contents,
const net::HttpNetworkSession* network_session,
net::SSLCertRequestInfo* cert_request_info,
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info,
const chrome::SelectCertificateCallback& callback);
virtual ~SSLClientCertificateSelector();
......
......@@ -656,7 +656,7 @@ void SimpleBackendImpl::GetNextEntryInIterator(
void SimpleBackendImpl::OnEntryOpenedFromHash(
uint64 hash,
Entry** entry,
scoped_refptr<SimpleEntryImpl> simple_entry,
const scoped_refptr<SimpleEntryImpl>& simple_entry,
const CompletionCallback& callback,
int error_code) {
if (error_code != net::OK) {
......@@ -665,7 +665,7 @@ void SimpleBackendImpl::OnEntryOpenedFromHash(
}
DCHECK(*entry);
std::pair<EntryMap::iterator, bool> insert_result =
active_entries_.insert(EntryMap::value_type(hash, simple_entry));
active_entries_.insert(EntryMap::value_type(hash, simple_entry.get()));
EntryMap::iterator& it = insert_result.first;
const bool did_insert = insert_result.second;
if (did_insert) {
......@@ -686,7 +686,7 @@ void SimpleBackendImpl::OnEntryOpenedFromHash(
void SimpleBackendImpl::OnEntryOpenedFromKey(
const std::string key,
Entry** entry,
scoped_refptr<SimpleEntryImpl> simple_entry,
const scoped_refptr<SimpleEntryImpl>& simple_entry,
const CompletionCallback& callback,
int error_code) {
int final_code = error_code;
......
......@@ -169,7 +169,7 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend,
// using a key in the meantime.
void OnEntryOpenedFromHash(uint64 hash,
Entry** entry,
scoped_refptr<SimpleEntryImpl> simple_entry,
const scoped_refptr<SimpleEntryImpl>& simple_entry,
const CompletionCallback& callback,
int error_code);
......@@ -177,7 +177,7 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend,
// opened, a check for key mismatch is performed.
void OnEntryOpenedFromKey(const std::string key,
Entry** entry,
scoped_refptr<SimpleEntryImpl> simple_entry,
const scoped_refptr<SimpleEntryImpl>& simple_entry,
const CompletionCallback& callback,
int error_code);
......
......@@ -135,10 +135,11 @@ bool EntryMetadata::Deserialize(PickleIterator* it) {
return true;
}
SimpleIndex::SimpleIndex(base::SingleThreadTaskRunner* io_thread,
SimpleIndexDelegate* delegate,
net::CacheType cache_type,
scoped_ptr<SimpleIndexFile> index_file)
SimpleIndex::SimpleIndex(
const scoped_refptr<base::SingleThreadTaskRunner>& io_thread,
SimpleIndexDelegate* delegate,
net::CacheType cache_type,
scoped_ptr<SimpleIndexFile> index_file)
: delegate_(delegate),
cache_type_(cache_type),
cache_size_(0),
......@@ -152,7 +153,8 @@ SimpleIndex::SimpleIndex(base::SingleThreadTaskRunner* io_thread,
// Creating the callback once so it is reused every time
// write_to_disk_timer_.Start() is called.
write_to_disk_cb_(base::Bind(&SimpleIndex::WriteToDisk, AsWeakPtr())),
app_on_background_(false) {}
app_on_background_(false) {
}
SimpleIndex::~SimpleIndex() {
DCHECK(io_thread_checker_.CalledOnValidThread());
......
......@@ -77,7 +77,7 @@ class NET_EXPORT_PRIVATE SimpleIndex
public:
typedef std::vector<uint64> HashList;
SimpleIndex(base::SingleThreadTaskRunner* io_thread,
SimpleIndex(const scoped_refptr<base::SingleThreadTaskRunner>& io_thread,
SimpleIndexDelegate* delegate,
net::CacheType cache_type,
scoped_ptr<SimpleIndexFile> simple_index_file);
......
......@@ -97,7 +97,7 @@ namespace net {
TransportSecurityPersister::TransportSecurityPersister(
TransportSecurityState* state,
const base::FilePath& profile_path,
base::SequencedTaskRunner* background_runner,
const scoped_refptr<base::SequencedTaskRunner>& background_runner,
bool readonly)
: transport_security_state_(state),
writer_(profile_path.AppendASCII("TransportSecurity"), background_runner),
......
......@@ -13,7 +13,7 @@
// This means that it's possible for pages opened very quickly not to get the
// correct transport security information.
//
// To load the state, we schedule a Task on file_task_runner, which
// To load the state, we schedule a Task on background_runner, which
// deserializes and configures the TransportSecurityState.
//
// The TransportSecurityState object supports running a callback function
......@@ -51,16 +51,17 @@ namespace net {
// Reads and updates on-disk TransportSecurity state. Clients of this class
// should create, destroy, and call into it from one thread.
//
// file_task_runner is the task runner this class should use internally to
// background_runner is the task runner this class should use internally to
// perform file IO, and can optionally be associated with a different thread.
class NET_EXPORT TransportSecurityPersister
: public TransportSecurityState::Delegate,
public base::ImportantFileWriter::DataSerializer {
public:
TransportSecurityPersister(TransportSecurityState* state,
const base::FilePath& profile_path,
base::SequencedTaskRunner* file_task_runner,
bool readonly);
TransportSecurityPersister(
TransportSecurityState* state,
const base::FilePath& profile_path,
const scoped_refptr<base::SequencedTaskRunner>& background_runner,
bool readonly);
virtual ~TransportSecurityPersister();
// Called by the TransportSecurityState when it changes its state.
......
......@@ -1527,7 +1527,7 @@ int SSLClientSocketOpenSSL::CertVerifyCallback(X509_STORE_CTX* store_ctx) {
CHECK(server_cert_.get());
PeerCertificateChain chain(store_ctx->untrusted);
if (chain.IsValid() && server_cert_->Equals(chain.AsOSChain()))
if (chain.IsValid() && server_cert_->Equals(chain.AsOSChain().get()))
return 1;
if (!chain.IsValid())
......
......@@ -46,15 +46,15 @@ SSLSocketParams::SSLSocketParams(
force_spdy_over_ssl_(force_spdy_over_ssl),
want_spdy_over_npn_(want_spdy_over_npn),
ignore_limits_(false) {
if (direct_params_) {
DCHECK(!socks_proxy_params_);
DCHECK(!http_proxy_params_);
if (direct_params_.get()) {
DCHECK(!socks_proxy_params_.get());
DCHECK(!http_proxy_params_.get());
ignore_limits_ = direct_params_->ignore_limits();
} else if (socks_proxy_params_) {
DCHECK(!http_proxy_params_);
} else if (socks_proxy_params_.get()) {
DCHECK(!http_proxy_params_.get());
ignore_limits_ = socks_proxy_params_->ignore_limits();
} else {
DCHECK(http_proxy_params_);
DCHECK(http_proxy_params_.get());
ignore_limits_ = http_proxy_params_->ignore_limits();
}
}
......@@ -62,18 +62,18 @@ SSLSocketParams::SSLSocketParams(
SSLSocketParams::~SSLSocketParams() {}
SSLSocketParams::ConnectionType SSLSocketParams::GetConnectionType() const {
if (direct_params_) {
DCHECK(!socks_proxy_params_);
DCHECK(!http_proxy_params_);
if (direct_params_.get()) {
DCHECK(!socks_proxy_params_.get());
DCHECK(!http_proxy_params_.get());
return DIRECT;
}
if (socks_proxy_params_) {
DCHECK(!http_proxy_params_);
if (socks_proxy_params_.get()) {
DCHECK(!http_proxy_params_.get());
return SOCKS_PROXY;
}
DCHECK(http_proxy_params_);
DCHECK(http_proxy_params_.get());
return HTTP_PROXY;
}
......
......@@ -93,7 +93,7 @@ TEST(WebSocketInflaterTest, ChokedInvalidData) {
EXPECT_TRUE(inflater.AddBytes("\xf2\x48\xcd\xc9INVALID DATA", 16));
EXPECT_TRUE(inflater.Finish());
EXPECT_EQ(1u, inflater.CurrentOutputSize());
EXPECT_FALSE(inflater.GetOutput(1024));
EXPECT_FALSE(inflater.GetOutput(1024).get());
}
TEST(WebSocketInflaterTest, MultipleAddBytesCalls) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment