summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-04 17:35:13 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-04 17:35:13 +0000
commit1653d32148fca4a2061a272d5dd8a028dcf827a7 (patch)
tree438fab5999e61cb26db0ec536f1b95ddfa1be276 /net
parent8bea43f3f9b607adf6b25f92e69e7dbcba6e6992 (diff)
downloadchromium_src-1653d32148fca4a2061a272d5dd8a028dcf827a7.zip
chromium_src-1653d32148fca4a2061a272d5dd8a028dcf827a7.tar.gz
chromium_src-1653d32148fca4a2061a272d5dd8a028dcf827a7.tar.bz2
Fix remaining uses of WeakPtr<T>'s operator T* conversion
These cases weren't caught by the automated pass and/or needed to be solved in another way than using .get(). BUG=245942 TBR=darin@chromium.org Review URL: https://codereview.chromium.org/16207005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203996 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/quic/quic_stream_factory.cc3
-rw-r--r--net/socket/ssl_client_socket_nss.cc16
-rw-r--r--net/spdy/spdy_write_queue_unittest.cc14
3 files changed, 17 insertions, 16 deletions
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index 6e767d7..5b0ded2 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -253,8 +253,7 @@ int QuicStreamFactory::Create(const HostPortProxyPair& host_port_proxy_pair,
return ERR_IO_PENDING;
}
- Job* job = new Job(weak_factory_.GetWeakPtr(), host_resolver_,
- host_port_proxy_pair, net_log);
+ Job* job = new Job(this, host_resolver_, host_port_proxy_pair, net_log);
int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete,
base::Unretained(this), job));
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 141387a..cf21688 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -282,18 +282,19 @@ void DestroyCertificates(CERTCertificate** certs, size_t len) {
// Helper functions to make it possible to log events from within the
// SSLClientSocketNSS::Core.
-void AddLogEvent(BoundNetLog* net_log, NetLog::EventType event_type) {
- if (!net_log)
+void AddLogEvent(const base::WeakPtr<BoundNetLog>& net_log,
+ NetLog::EventType event_type) {
+ if (!net_log.get())
return;
net_log->AddEvent(event_type);
}
// Helper function to make it possible to log events from within the
// SSLClientSocketNSS::Core.
-void AddLogEventWithCallback(BoundNetLog* net_log,
+void AddLogEventWithCallback(const base::WeakPtr<BoundNetLog>& net_log,
NetLog::EventType event_type,
const NetLog::ParametersCallback& callback) {
- if (!net_log)
+ if (!net_log.get())
return;
net_log->AddEvent(event_type, callback);
}
@@ -308,9 +309,10 @@ void AddLogEventWithCallback(BoundNetLog* net_log,
// Instead, provide a signature that accepts an IOBuffer*, so that a reference
// to the owning IOBuffer can be bound to the Callback. This ensures that the
// IOBuffer will stay alive long enough to cross threads if needed.
-void LogByteTransferEvent(BoundNetLog* net_log, NetLog::EventType event_type,
- int len, IOBuffer* buffer) {
- if (!net_log)
+void LogByteTransferEvent(
+ const base::WeakPtr<BoundNetLog>& net_log, NetLog::EventType event_type,
+ int len, IOBuffer* buffer) {
+ if (!net_log.get())
return;
net_log->AddByteTransferEvent(event_type, len, buffer->data());
}
diff --git a/net/spdy/spdy_write_queue_unittest.cc b/net/spdy/spdy_write_queue_unittest.cc
index 1865619..f287472 100644
--- a/net/spdy/spdy_write_queue_unittest.cc
+++ b/net/spdy/spdy_write_queue_unittest.cc
@@ -94,12 +94,12 @@ TEST_F(SpdyWriteQueueTest, DequeuesByPriority) {
ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream));
EXPECT_EQ(RST_STREAM, frame_type);
EXPECT_EQ("HIGHEST", ProducerToString(frame_producer.Pass()));
- EXPECT_EQ(stream_highest, stream);
+ EXPECT_EQ(stream_highest, stream.get());
ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream));
EXPECT_EQ(SYN_REPLY, frame_type);
EXPECT_EQ("MEDIUM", ProducerToString(frame_producer.Pass()));
- EXPECT_EQ(stream_medium, stream);
+ EXPECT_EQ(stream_medium, stream.get());
ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream));
EXPECT_EQ(SYN_STREAM, frame_type);
@@ -135,17 +135,17 @@ TEST_F(SpdyWriteQueueTest, DequeuesFIFO) {
ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream));
EXPECT_EQ(SYN_STREAM, frame_type);
EXPECT_EQ(1, ProducerToInt(frame_producer.Pass()));
- EXPECT_EQ(stream1, stream);
+ EXPECT_EQ(stream1, stream.get());
ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream));
EXPECT_EQ(SYN_REPLY, frame_type);
EXPECT_EQ(2, ProducerToInt(frame_producer.Pass()));
- EXPECT_EQ(stream2, stream);
+ EXPECT_EQ(stream2, stream.get());
ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream));
EXPECT_EQ(RST_STREAM, frame_type);
EXPECT_EQ(3, ProducerToInt(frame_producer.Pass()));
- EXPECT_EQ(stream3, stream);
+ EXPECT_EQ(stream3, stream.get());
EXPECT_FALSE(write_queue.Dequeue(&frame_type, &frame_producer, &stream));
}
@@ -174,7 +174,7 @@ TEST_F(SpdyWriteQueueTest, RemovePendingWritesForStream) {
ASSERT_TRUE(write_queue.Dequeue(&frame_type, &frame_producer, &stream));
EXPECT_EQ(SYN_STREAM, frame_type);
EXPECT_EQ(i, ProducerToInt(frame_producer.Pass()));
- EXPECT_EQ(stream1, stream);
+ EXPECT_EQ(stream1, stream.get());
}
SpdyFrameType frame_type = DATA;
@@ -218,7 +218,7 @@ TEST_F(SpdyWriteQueueTest, RemovePendingWritesForStreamsAfter) {
<< "Unable to Dequeue i: " << i;
EXPECT_EQ(SYN_STREAM, frame_type);
EXPECT_EQ(i, ProducerToInt(frame_producer.Pass()));
- EXPECT_EQ(stream1, stream);
+ EXPECT_EQ(stream1, stream.get());
}
SpdyFrameType frame_type = DATA;